<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[a Time Traveler's]]></title><description><![CDATA[a Time Traveler's]]></description><link>https://musings.suryacheed.com</link><image><url>https://substackcdn.com/image/fetch/$s_!Rr7L!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F913fb287-6243-4147-bf36-726180d49327_1000x1000.png</url><title>a Time Traveler&apos;s</title><link>https://musings.suryacheed.com</link></image><generator>Substack</generator><lastBuildDate>Fri, 06 Nov 2026 14:16:54 GMT</lastBuildDate><atom:link href="https://musings.suryacheed.com/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Surya Cheedella]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[atimetravelers@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[atimetravelers@substack.com]]></itunes:email><itunes:name><![CDATA[Surya Cheedella]]></itunes:name></itunes:owner><itunes:author><![CDATA[Surya Cheedella]]></itunes:author><googleplay:owner><![CDATA[atimetravelers@substack.com]]></googleplay:owner><googleplay:email><![CDATA[atimetravelers@substack.com]]></googleplay:email><googleplay:author><![CDATA[Surya Cheedella]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[Hello world, again!]]></title><description><![CDATA[As Opus and Fable are doing majority of my work these days and I&#8217;m on verge of exiting my current startup Proxima Labs, I started going through old stuff and found my decade old wordpress blog. Migrated old posts to substack and went through them only to be embarrassed. They are decade old posts when I was barely 18. So, I can forgive my old self.]]></description><link>https://musings.suryacheed.com/p/hello-world-again</link><guid isPermaLink="false">https://musings.suryacheed.com/p/hello-world-again</guid><dc:creator><![CDATA[Surya Cheedella]]></dc:creator><pubDate>Sat, 26 Sep 2026 16:33:17 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/6e0bf249-1296-4daf-b40f-369c147a7b53_1254x1254.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!zPgg!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9d04331-d622-468e-85b5-8f212e037573_1254x608.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!zPgg!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9d04331-d622-468e-85b5-8f212e037573_1254x608.png 424w, https://substackcdn.com/image/fetch/$s_!zPgg!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9d04331-d622-468e-85b5-8f212e037573_1254x608.png 848w, https://substackcdn.com/image/fetch/$s_!zPgg!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9d04331-d622-468e-85b5-8f212e037573_1254x608.png 1272w, https://substackcdn.com/image/fetch/$s_!zPgg!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9d04331-d622-468e-85b5-8f212e037573_1254x608.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!zPgg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9d04331-d622-468e-85b5-8f212e037573_1254x608.png" width="1254" height="608" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b9d04331-d622-468e-85b5-8f212e037573_1254x608.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:608,&quot;width&quot;:1254,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1485323,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://musings.suryacheed.com/i/217554707?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9d04331-d622-468e-85b5-8f212e037573_1254x608.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!zPgg!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9d04331-d622-468e-85b5-8f212e037573_1254x608.png 424w, https://substackcdn.com/image/fetch/$s_!zPgg!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9d04331-d622-468e-85b5-8f212e037573_1254x608.png 848w, https://substackcdn.com/image/fetch/$s_!zPgg!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9d04331-d622-468e-85b5-8f212e037573_1254x608.png 1272w, https://substackcdn.com/image/fetch/$s_!zPgg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9d04331-d622-468e-85b5-8f212e037573_1254x608.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>As Opus and Fable are doing majority of my work these days and I&#8217;m on verge of exiting my current startup <a href="https://proximalabs.xyz/">Proxima Labs</a>, I started going through old stuff and found my decade old wordpress <a href="https://x.com/suryacheed/status/2100259729390072251">blog</a>. Migrated old posts to substack and went through them only to be embarrassed. They are decade old posts when I was barely 18. So, I can forgive my old self. </p><p>Anyway, thought I&#8217;d give writing another try. </p><p>Will be writing my musings, thoughts, reflections, notions, reveries, etc here. As matter of principle, none of my posts here will contain AI generated text. Stay tuned and subscribe for good old human intelligence!</p><p>Adios</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://musings.suryacheed.com/p/hello-world-again?utm_source=substack&utm_medium=email&utm_content=share&action=share&quot;,&quot;text&quot;:&quot;Share&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://musings.suryacheed.com/p/hello-world-again?utm_source=substack&utm_medium=email&utm_content=share&action=share"><span>Share</span></a></p><p></p>]]></content:encoded></item><item><title><![CDATA[Applying to aimacode as part of GSoC’16]]></title><description><![CDATA[After spending about three weeks with aimacode, porting the code base from Python2 to Python3; implementing algorithms in python that accompany the Pseudo-code in the book&#8212;AI: A Modern Approach&#8212; and fixing bugs, I could clearly see I am addicted to aima-python.]]></description><link>https://musings.suryacheed.com/p/applying-for-aimacode-as-part-of-gsoc16</link><guid isPermaLink="false">https://musings.suryacheed.com/p/applying-for-aimacode-as-part-of-gsoc16</guid><dc:creator><![CDATA[Surya Cheedella]]></dc:creator><pubDate>Wed, 23 Mar 2016 03:13:38 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!Rr7L!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F913fb287-6243-4147-bf36-726180d49327_1000x1000.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>After spending about three weeks with aimacode, porting the code base from Python2 to Python3; implementing&nbsp;algorithms in python that accompany the Pseudo-code in the book&#8212;AI: A Modern Approach&#8212; and fixing bugs, I could clearly see I am addicted to aima-python. I am spending days &amp; nights&#8212;even skipping classes&#8212;to fix some more bugs/to implement one more algorithm by coding in my room and in Library. <a href="https://github.com/aimacode/aima-python/commits?author=SnShine">Here</a> are my contributions to &#8220;aima-python&#8221; till date. I think I am doing pretty well.</p><p>Two years back, when we were taught an Introductory AI course, I wasn&#8217;t aware of an official code base for our prescribed book&#8212;AI: A Modern Approach by Stuart J. Russell, Peter Norvig. If I would have known that, my learning experience would be a lot more different, lot more great.</p><p>The online course taught by Peter Norvig and&nbsp;Sebastian Thrun, Intro to Artificial Intelligence, has got a whopping 115,000 registered for the course. And don&#8217;t get me started on the original Artificial Intelligence course by the same teachers which had got 160,000 students signed up for the course and 23,000 of them successfully completed the whole course. These both courses are in the lines of the book AI: A Modern Approach, but the official code base isn&#8217;t as popular as the accompanying courses. That&#8217;s why I decided to contribute to the project and applied for GSoC&#8217;16. I will be contributing to the codebase by fixing bugs, make the code look more like pseudo-code, implementing interactive visualizations, and python implementations, regardless of my selection for GSoC&#8217;16.</p><p>Adios<br>Surya Teja</p>]]></content:encoded></item><item><title><![CDATA[Object Classification on aYahoo image dataset]]></title><description><![CDATA[Disclaimer:]]></description><link>https://musings.suryacheed.com/p/object-classification-on-ayahoo-image-dataset</link><guid isPermaLink="false">https://musings.suryacheed.com/p/object-classification-on-ayahoo-image-dataset</guid><dc:creator><![CDATA[Surya Cheedella]]></dc:creator><pubDate>Wed, 25 Mar 2015 05:45:26 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!Rr7L!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F913fb287-6243-4147-bf36-726180d49327_1000x1000.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>Disclaimer:<br>1. You need to have Caffe installed on your system to run the below tasks. If not follow the tutorial <a href="https://suryatejacheedella.wordpress.com/2015/03/22/install-caffe-on-ubuntu-14-04/" title="Install Caffe">here</a> to get Caffe up and running on your system.<br>2. You need to download aYahoo image dataset <a href="http://vision.cs.uiuc.edu/attributes/ayahoo_test_images.tar.gz" title="Download starts!">here</a>.<br>3. You need to get all the pre-trained models: alexnet.caffemodel, coffenet.caffemodel and googlenet.caffemodel to get started on extracting features from images.</em></p><p>We will start by getting the paths to all the downloaded images into a text file. Run this line in terminal with correct path to images&#8217; folder and path to text file in which we need to append all the paths to images.</p><pre><code>find `pwd`/examples/images/ayahoo -type f -exec echo {} \; &gt; examples/tempFeaExtr/temp.txt
</code></pre><p>Now we need to label the images. I am assigning labels starting from 0. It is recommended to sort all the names in text file, so we can divide the whole dataset into train and test datasets with reasonable number of images of each class in both datasets rather than randomly the whole data.</p><pre><code>#to_label
outfile= open('zz_temp.txt', 'w')
infile= open('z_temp.txt', 'r')
myset= []

for line in infile:
 a= line[(len(line)-(line[::-1].index('/'))):-1]
 a= a[:a.index('_')]
 myset.append(a)

 if a== "bag":
 b= "0"
 elif a== "building":
 b= "1"
 elif a== "carriage":
 b= "2"
 elif a== "centaur":
 b= "3"
 elif a== "donkey":
 b= "4"
 elif a== "goat":
 b= "5"
 elif a== "jetski":
 b= "6"
 elif a== "monkey":
 b= "7"
 elif a== "mug":
 b= "8"
 elif a== "statue":
 b= "9"
 elif a== "wolf":
 b= "10"
 elif a== "zebra":
 b= "11"

 outfile.write(line[:-1]+ " "+ b+ "\n")
print(set(myset))

infile.close()
outfile.close()

#to_sort
infile= open('zz_temp.txt', 'r')
outfile= open('z_temp.txt', 'w')
myset= []

for line in infile:
 myset.append(line[:-1])

myset.sort()
for a in myset:
 outfile.write(a+"\n")

infile.close()
outfile.close()
</code></pre><p>As we have labeled and sorted the whole database, now, we divide it into two sets namely train_data.txt and test_data.txt. Try to keep the ratio of &#8220;no. of train images/ no. of test images&#8221; constant for all the classes. Now, we have train_data and test_data to proceed on to next step.</p><p>I am going to extract features of every image using the pre-trained models. After extracting I am gonna train SVM classifiers to predict the classes of test_data.</p><p>Link to the code to extract features and to train SVMs id <a href="https://github.com/SnShine/Object-Recognition-on-aYahoo-dataset" title="my GitHub repo!">here</a> on GitHub.</p><p><span data-color="rgb(0, 0, 255)" style="color: rgb(0, 0, 255);">Happy classifying images.</span><br><span data-color="rgb(0, 0, 255)" style="color: rgb(0, 0, 255);">Adios</span></p>]]></content:encoded></item><item><title><![CDATA[Install Caffe on Ubuntu 14.04]]></title><description><![CDATA[Disclaimer:]]></description><link>https://musings.suryacheed.com/p/install-caffe-on-ubuntu-14-04</link><guid isPermaLink="false">https://musings.suryacheed.com/p/install-caffe-on-ubuntu-14-04</guid><dc:creator><![CDATA[Surya Cheedella]]></dc:creator><pubDate>Sun, 22 Mar 2015 07:57:51 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!Rr7L!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F913fb287-6243-4147-bf36-726180d49327_1000x1000.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>Disclaimer:<br>1. As my machine has no GPU hardware, I am going to install Caffe without CUDA support.<br>2. I am going to install only Python wrapper for Caffe.</em></p><p>As the <a href="http://caffe.berkeleyvision.org/installation.html">installation page</a> on Caffe has no detailed instructions to install all the dependencies required and get your system ready to run CNNs , I am writing this small tutorial to set Caffe <em>Up</em> and <em>Running</em> on your machine.</p><p>Firstly, we will get stared by downloading latest release of Caffe from github. (You need to have Git installed on your machine)</p><pre><code>git clone&nbsp;https://github.com/BVLC/caffe.git
#add these following lines in the end of your .bashrc file
export PYTHONPATH=$PYTHONPATH:$HOME/caffe/python
export PYTHONPATH=$PYTHONPATH:$HOME/caffe/python/caffe
</code></pre><p>It is advised to use Anaconda Python distribution as it installs most of the requirements for python wrapper around Caffe (though it install a lot of packages we have no use). But, installing Anaconda is up to you.<br>Download Anaconda and run shell script. Add the path of bin to #PATH in file ~/.bashrc.</p><pre><code>bash Anaconda-2.1.0-Linux-x86_64.sh
#add the following line at the end to your .bashrc
export PATH=/home/suryateja/anaconda/bin:$PATH
</code></pre><p>Get gflags and install on your system.</p><pre><code>wget https://github.com/schuhschuh/gflags/archive/master.zip
unzip master.zip
cd gflags-master
mkdir build &amp;&amp; cd build
export CXXFLAGS="-fPIC" &amp;&amp; cmake .. &amp;&amp; make VERBOSE=1&lt;/pre&gt;
&lt;pre&gt;make
sudo make install
</code></pre><p>Download <a href="https://launchpad.net/ubuntu/+source/google-glog/0.3.3-2">google-glog</a> and install. You can also install through apt-get. And install snappy.</p><pre><code>tar -xvzf google-glog_0.3.3.orig.tar.gz
cd glog-0.3.3/
./configure
make
sudo make install
agi libgoogle-glog-dev
agi libsnappy-dev
</code></pre><p>Get leveldb onto your machine and lmdb with its dependencies.</p><pre><code>git clone https://code.google.com/p/leveldb/
cd leveldb
make
cp --preserve=links libleveldb.* /usr/local/lib
sudo cp --preserve=links libleveldb.* /usr/local/lib
sudo cp -r include/leveldb /usr/local/include/
ldconfig
sudo ldconfig
sudo apt-get install libffi-dev python-dev build-essential
sudo apt-get install liblmdb-dev
</code></pre><p>Download <a href="http://sourceforge.net/projects/math-atlas/files/Stable/3.10.2/">Atlas</a>&nbsp;and <a href="http://www.netlib.org/lapack/lapack-3.5.0.tgz">Lapack</a>&nbsp;(directly downloads when you click on link!). But before installing, you need to modify your CPU frequency/scaling. You you get errors saving the file, try to use different editor. I have tried sublime, gedit. Finally with&nbsp;I can modify with emacs. Change the scaling for all of your CPU cores to replace&nbsp;the single word in the file with &#8216;performance&#8217;.</p><pre><code>gksu emacs /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
gksu emacs /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
gksu emacs /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
gksu emacs /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor

bunzip2 -c atlas3.10.2.tar.bz2 | tar xfm -
mv ATLAS ATLAS3.10.2
cd ATLAS3.10.2
mkdir Linux_C2D64SSE3
cd Linux_C2D64SSE3
../configure -b 64 -D c -DPentiumCPS=2400 --prefix=/home/suryateja/lib/atlas --with-netlib-lapack-tarfile=/home/suryateja/Downloads/lapack-3.5.0.tgz

make build
make check
make ptcheck
make time
sudo make install
</code></pre><p>Install dependencies for python wrapper if you didn&#8217;t choose to install Anaconda Python distrubution. The dependencies file is in caffe/python. And install hdf5 via apt-get.</p><pre><code>cd python/
for req in $(cat requirements.txt); do sudo pip install $req; done
sudo apt-get install libhdf5-serial-dev
</code></pre><p>Download latest <a href="///home/suryateja/Downloads/opencv-3.0.0-beta.zip">3.0.0-beta version</a> (file automatically downloads if you click) of OpenCV and build it. But before install all the dependencies of OpenCV.</p><pre><code>sudo apt-get install build-essential
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev

cd Downloads
cd opencv-3.0.0-beta/
mkdir release
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
make
sudo make install
</code></pre><p>Now, we are almost done with getting all the dependencies of Caffe. So, lets dive into getting Caffe up and running on our machines. Modify the makefile as your needs as shown in <a href="http://caffe.berkeleyvision.org/installation.html">installation</a> page.</p><pre><code>cd caffe
cp Makefile.config.example Makefile.config
make all
make test
make runtest
</code></pre><p>If you have errors while installing even followed this tutorial, you can search for any known issues on their <a href="https://github.com/BVLC/caffe/issues">issues</a> page. One of the <a href="https://github.com/BVLC/caffe/issues/782">errors</a> I faced is <a href="https://github.com/BVLC/caffe/issues/1463">this</a>. And I am able to solve it as suggested in the comments section of issue page.</p><p>At last, now, you have Caffe installed and running on your machine.<br><span data-color="rgb(0, 0, 255)" style="color: rgb(0, 0, 255);">Happy training Deep Neural Networks. &#128512;</span></p>]]></content:encoded></item><item><title><![CDATA[Download friends’ profile pictures on facebook!]]></title><description><![CDATA[Hello guys, before going into the topic, I wanna say you one thing.]]></description><link>https://musings.suryacheed.com/p/download-friends-profile-pictures-on-facebook</link><guid isPermaLink="false">https://musings.suryacheed.com/p/download-friends-profile-pictures-on-facebook</guid><dc:creator><![CDATA[Surya Cheedella]]></dc:creator><pubDate>Wed, 08 Oct 2014 05:24:01 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!HJTQ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F169cc19b-dc61-482e-a90d-21abc528d30f_1312x600.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!HJTQ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F169cc19b-dc61-482e-a90d-21abc528d30f_1312x600.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!HJTQ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F169cc19b-dc61-482e-a90d-21abc528d30f_1312x600.webp 424w, https://substackcdn.com/image/fetch/$s_!HJTQ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F169cc19b-dc61-482e-a90d-21abc528d30f_1312x600.webp 848w, https://substackcdn.com/image/fetch/$s_!HJTQ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F169cc19b-dc61-482e-a90d-21abc528d30f_1312x600.webp 1272w, https://substackcdn.com/image/fetch/$s_!HJTQ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F169cc19b-dc61-482e-a90d-21abc528d30f_1312x600.webp 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!HJTQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F169cc19b-dc61-482e-a90d-21abc528d30f_1312x600.webp" width="1312" height="600" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/169cc19b-dc61-482e-a90d-21abc528d30f_1312x600.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:600,&quot;width&quot;:1312,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:316762,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/webp&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://atimetravelers.substack.com/i/216590479?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F169cc19b-dc61-482e-a90d-21abc528d30f_1312x600.webp&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!HJTQ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F169cc19b-dc61-482e-a90d-21abc528d30f_1312x600.webp 424w, https://substackcdn.com/image/fetch/$s_!HJTQ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F169cc19b-dc61-482e-a90d-21abc528d30f_1312x600.webp 848w, https://substackcdn.com/image/fetch/$s_!HJTQ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F169cc19b-dc61-482e-a90d-21abc528d30f_1312x600.webp 1272w, https://substackcdn.com/image/fetch/$s_!HJTQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F169cc19b-dc61-482e-a90d-21abc528d30f_1312x600.webp 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Hello guys, before going into the topic, I wanna say you one thing. This method may not fetch all of your facebook friends&#8217; profile pictures. But, this is the efficient way*(considering the number of pictures you get) you can find on whole internet(exaggerating &#128539;).<br>*depends on your popularity on FB.<br>Let me make sure you have:(Prerequisites, and don&#8217;t proceed without understanding these topics well.)</p><ul><li><p>Considerable knowledge of facebook <a href="https://developers.facebook.com/docs/graph-api">GraphAPI</a>. Nice <a href="https://www.youtube.com/watch?v=WteK95AppF4">video</a> explaining GraphAPI.</p></li><li><p>Installed third-party <a href="https://github.com/pythonforfacebook/facebook-sdk">facebook-sdk</a> for python. As I am going to use python.</p></li></ul><p>So, with a simple google search for getting friends&#8217; pics, you might land on a hell lot of pages with most of them using a call to friends (<span data-color="rgb(51, 102, 255)" style="color: rgb(51, 102, 255);">/friends</span>) with a user node(<span data-color="rgb(51, 102, 255)" style="color: rgb(51, 102, 255);">me/friends</span>).</p><blockquote><p><span data-color="rgb(255, 102, 0)" style="color: rgb(255, 102, 0);">Okay. So, why isn&#8217;t it efficient?</span></p></blockquote><p>Here&#8217;s the catch. The permissions required to make this call from <a href="https://developers.facebook.com/docs/graph-api/reference/v2.1/user/friends">this</a> page.</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!JGoK!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F746e17e8-dd8b-44be-8219-f727ce2946d5_655x165.png 424w, https://substackcdn.com/image/fetch/$s_!JGoK!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F746e17e8-dd8b-44be-8219-f727ce2946d5_655x165.png 848w, https://substackcdn.com/image/fetch/$s_!JGoK!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F746e17e8-dd8b-44be-8219-f727ce2946d5_655x165.png 1272w, https://substackcdn.com/image/fetch/$s_!JGoK!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F746e17e8-dd8b-44be-8219-f727ce2946d5_655x165.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!JGoK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F746e17e8-dd8b-44be-8219-f727ce2946d5_655x165.png" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/746e17e8-dd8b-44be-8219-f727ce2946d5_655x165.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:null,&quot;width&quot;:null,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;permissions&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="permissions" title="permissions" srcset="https://substackcdn.com/image/fetch/$s_!JGoK!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F746e17e8-dd8b-44be-8219-f727ce2946d5_655x165.png 424w, https://substackcdn.com/image/fetch/$s_!JGoK!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F746e17e8-dd8b-44be-8219-f727ce2946d5_655x165.png 848w, https://substackcdn.com/image/fetch/$s_!JGoK!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F746e17e8-dd8b-44be-8219-f727ce2946d5_655x165.png 1272w, https://substackcdn.com/image/fetch/$s_!JGoK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F746e17e8-dd8b-44be-8219-f727ce2946d5_655x165.png 1456w" sizes="100vw"></picture><div></div></div></div></figure></div><p> The &#8216;second point&#8217; states it will only return those who have use the app making the request. I don&#8217;t know what&#8217;s your case, but, for me it returned only 14 friends of 970 in my list. Very disappointing. Try it for yourself and let me know how many nodes it returned in comments. </p><pre><code>import facebook

graph= facebook.GraphAPI()
friends= graph.get_connections(&amp;quot;me&amp;quot;, &amp;quot;friends&amp;quot;)
print(len(friends["data"]))
</code></pre><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!31hi!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdfdb6483-2b5b-4643-a09f-ed9f460f0ccf_655x368.png 424w, https://substackcdn.com/image/fetch/$s_!31hi!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdfdb6483-2b5b-4643-a09f-ed9f460f0ccf_655x368.png 848w, https://substackcdn.com/image/fetch/$s_!31hi!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdfdb6483-2b5b-4643-a09f-ed9f460f0ccf_655x368.png 1272w, https://substackcdn.com/image/fetch/$s_!31hi!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdfdb6483-2b5b-4643-a09f-ed9f460f0ccf_655x368.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!31hi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdfdb6483-2b5b-4643-a09f-ed9f460f0ccf_655x368.png" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/dfdb6483-2b5b-4643-a09f-ed9f460f0ccf_655x368.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:null,&quot;width&quot;:null,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;It returned only 15 friends in my list.&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="It returned only 15 friends in my list." title="It returned only 15 friends in my list." srcset="https://substackcdn.com/image/fetch/$s_!31hi!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdfdb6483-2b5b-4643-a09f-ed9f460f0ccf_655x368.png 424w, https://substackcdn.com/image/fetch/$s_!31hi!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdfdb6483-2b5b-4643-a09f-ed9f460f0ccf_655x368.png 848w, https://substackcdn.com/image/fetch/$s_!31hi!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdfdb6483-2b5b-4643-a09f-ed9f460f0ccf_655x368.png 1272w, https://substackcdn.com/image/fetch/$s_!31hi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdfdb6483-2b5b-4643-a09f-ed9f460f0ccf_655x368.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div><figcaption class="image-caption">It returned only 15 friends in my list.</figcaption></figure></div><blockquote><p><span data-color="rgb(255, 102, 0)" style="color: rgb(255, 102, 0);">I think our aim is to fetch profile pics, not getting friends list!</span></p></blockquote><p>If you are thinking like that, just take a minute to re-think. To get pics through GraphAPI we can call <span data-color="rgb(51, 102, 255)" style="color: rgb(51, 102, 255);">me/picture</span> which returns present profile picture of user. We can give a username or user id in the place of &#8216;<span data-color="rgb(51, 102, 255)" style="color: rgb(51, 102, 255);">me</span>&#8216; while we are calling for pictures. That&#8217;s the reason we are obsessed to know our friends&#8217; list to get user id or username. But, here&#8217;s another catch. The ids you got are not the real ids. &#128550; See this&#8230;</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!362l!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9a62116-8f91-4d0a-9987-3c86fd393096_655x368.png 424w, https://substackcdn.com/image/fetch/$s_!362l!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9a62116-8f91-4d0a-9987-3c86fd393096_655x368.png 848w, https://substackcdn.com/image/fetch/$s_!362l!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9a62116-8f91-4d0a-9987-3c86fd393096_655x368.png 1272w, https://substackcdn.com/image/fetch/$s_!362l!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9a62116-8f91-4d0a-9987-3c86fd393096_655x368.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!362l!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9a62116-8f91-4d0a-9987-3c86fd393096_655x368.png" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a9a62116-8f91-4d0a-9987-3c86fd393096_655x368.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:null,&quot;width&quot;:null,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;You can see that for yourself. It returned some other value in the place of userid.&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="You can see that for yourself. It returned some other value in the place of userid." title="You can see that for yourself. It returned some other value in the place of userid." srcset="https://substackcdn.com/image/fetch/$s_!362l!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9a62116-8f91-4d0a-9987-3c86fd393096_655x368.png 424w, https://substackcdn.com/image/fetch/$s_!362l!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9a62116-8f91-4d0a-9987-3c86fd393096_655x368.png 848w, https://substackcdn.com/image/fetch/$s_!362l!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9a62116-8f91-4d0a-9987-3c86fd393096_655x368.png 1272w, https://substackcdn.com/image/fetch/$s_!362l!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9a62116-8f91-4d0a-9987-3c86fd393096_655x368.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div><figcaption class="image-caption">You can see that for yourself. It returned some other value in the place of user id.</figcaption></figure></div><blockquote><p><span data-color="rgb(255, 102, 0)" style="color: rgb(255, 102, 0);">So, now, some how, find a way to get user-id of our friends.</span></p></blockquote><h5><em><span data-color="rgb(255, 102, 0)" style="color: rgb(255, 102, 0);">Likes! Yes the answer is likes.</span></em></h5><p>You can get your friends&#8217; user-ids (depends on their settings. But, you can access 90% of them.) by passing any of our pics or statuses with most number of likes. Find its id in search bar by clicking on your pic. Now, you can pass <span data-color="rgb(51, 102, 255)" style="color: rgb(51, 102, 255);">&lt;pic-id&gt;/likes</span> which returns a list of friends who liked your pic. Now, here&#8217;s the brilliant part. FB provides a link to their profile who all liked your nodes(pics or statuses).</p><pre><code>likes= graph.get_connections(&amp;quot;&amp;lt;node-id&amp;gt;&amp;quot;, &amp;quot;likes?fields=link,name&amp;amp;limit=500&amp;quot;)
#returns only 1000 friends maximum.
#returns your friends profile as &amp;quot;https://www.facebook.com/&amp;lt;username&amp;gt;&amp;quot;
</code></pre><p>Now, we got our friends&#8217; usernames. Lets start downloading pics. &#128578;</p><pre><code>for i in range (0,len(likes["data"])):
myid= likes["data"][i]["id"]
myname= likes["data"][i]["name"]
mylink= likes["data"][i]["link"]
username= mylink[25:]
print(myname)
pic= graph.get_connections(username, &amp;quot;picture?height=9000&amp;amp;redirect=false&amp;quot;)
urllib.request.urlretrieve(pic["data"]["url"], "fb/likers/"+myname+".jpg")
print(&amp;quot;downloaded the pic&amp;quot;)

</code></pre><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Olq1!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00af0a30-a283-4156-afcc-24448174f978_655x368.png 424w, https://substackcdn.com/image/fetch/$s_!Olq1!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00af0a30-a283-4156-afcc-24448174f978_655x368.png 848w, https://substackcdn.com/image/fetch/$s_!Olq1!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00af0a30-a283-4156-afcc-24448174f978_655x368.png 1272w, https://substackcdn.com/image/fetch/$s_!Olq1!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00af0a30-a283-4156-afcc-24448174f978_655x368.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Olq1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00af0a30-a283-4156-afcc-24448174f978_655x368.png" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/00af0a30-a283-4156-afcc-24448174f978_655x368.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:null,&quot;width&quot;:null,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Downloading pics in action.&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Downloading pics in action." title="Downloading pics in action." srcset="https://substackcdn.com/image/fetch/$s_!Olq1!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00af0a30-a283-4156-afcc-24448174f978_655x368.png 424w, https://substackcdn.com/image/fetch/$s_!Olq1!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00af0a30-a283-4156-afcc-24448174f978_655x368.png 848w, https://substackcdn.com/image/fetch/$s_!Olq1!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00af0a30-a283-4156-afcc-24448174f978_655x368.png 1272w, https://substackcdn.com/image/fetch/$s_!Olq1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00af0a30-a283-4156-afcc-24448174f978_655x368.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div><figcaption class="image-caption">Downloading pics in action.</figcaption></figure></div><p>In this process you may get some errors fetching friends&#8217; username, because of their settings. In that case we check for it and try to ignore those links.</p><pre><code>#'https://www.facebook.com/profile.php?id=100005090622885&amp;amp;#8242' It looks similar to this. From which we can&#8217;t extract username.
check= (username[:7])
if(check == &amp;quot;profile&amp;quot;):
print(&amp;quot;Can&#8217;t fetch username due to their settings.&amp;quot;)
continue
</code></pre><p>If you are planning to download pictures of friends who liked your nodes from two or more nodes, you may get repeated users i.e. one of your friends may liked both of your nodes. In that case we try not to re-download their pictures.</p><pre><code>if (os.path.exists("fb/likers/"+nodename+".jpg")):
print("Already downloaded "+nodename+"&#8217;s picture!")
continue
</code></pre><blockquote><p><span data-color="rgb(255, 102, 0)" style="color: rgb(255, 102, 0);">OMG! omg! I got a lot of pics. So, now what to do?</span></p></blockquote><p>You can do a lot of things. Really a lot of things. You can build a crazy face-recogniser like this one <a href="http://saxenarajat99.wordpress.com/2014/10/05/facial-recognition-using-python-and-opencv/">here</a>.<br>And you can put it in your room, running, recognises the person entered&nbsp;your room. &#128539;</p><p>For entire code you can visit my <a href="https://github.com/SnShine/Projects/tree/master/Facebook-profile-pic-downloader">GitHub page</a>.</p><p>Any questions, feedback is always welcome at <a href="mailto:shine123surya@gmail.com">shine123surya@gmail.com&nbsp;</a></p>]]></content:encoded></item><item><title><![CDATA[Donated 104,390 rice grains using tesseract OCR (MARK I)]]></title><description><![CDATA[For each answer you get right, we donate 10 grains of rice through the World Food programme to help end hunger]]></description><link>https://musings.suryacheed.com/p/donated-104390-rice-grains-using-tesseract-ocr-mark-i</link><guid isPermaLink="false">https://musings.suryacheed.com/p/donated-104390-rice-grains-using-tesseract-ocr-mark-i</guid><dc:creator><![CDATA[Surya Cheedella]]></dc:creator><pubDate>Tue, 12 Aug 2014 11:25:27 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!MEVc!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ce5ff0d-8f45-43dc-9662-2d12daedea89_655x368.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote><p><span data-color="rgb(255, 153, 0)" style="color: rgb(255, 153, 0);">For each answer you get right, we donate 10 grains of rice through the World Food programme to help end hunger</span></p></blockquote><p>That&#8217;s what guys at <a href="http://freerice.com/#/multiplication-table/"><span data-color="rgb(0, 128, 0)" style="color: rgb(0, 128, 0);">freerice.com</span></a><span data-color="rgb(0, 128, 0)" style="color: rgb(0, 128, 0);"> </span>say. So, I answered 10,439 questions correctly, ending up donating 104,390 rice grains. &#128512;  As I mentioned in one of my <a href="https://suryatejacheedella.wordpress.com/2014/07/21/face-detection/"><span data-color="rgb(0, 128, 0)" style="color: rgb(0, 128, 0);">previous posts</span></a>, I am working on OCR (Optical Character Recognition) to win a bet with my friend. I have completed building an OCR system and donated 104,390 rice grains on this website <a href="http://freerice.com/#/multiplication-table"><span data-color="rgb(0, 128, 0)" style="color: rgb(0, 128, 0);">freerice.com</span></a>&nbsp;in a single day under United Nations world food program. As I said, I built this just to win a bet. This whole post is one down and dirty way &nbsp;to build a working OCR system. I know this isn&#8217;t efficient way to do this even. (that&#8217;s the reason for MARK I &#128539;) Here&#8217;s a screenshot of my score (aka rice grains donated) on that site-</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!MEVc!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ce5ff0d-8f45-43dc-9662-2d12daedea89_655x368.png 424w, https://substackcdn.com/image/fetch/$s_!MEVc!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ce5ff0d-8f45-43dc-9662-2d12daedea89_655x368.png 848w, https://substackcdn.com/image/fetch/$s_!MEVc!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ce5ff0d-8f45-43dc-9662-2d12daedea89_655x368.png 1272w, https://substackcdn.com/image/fetch/$s_!MEVc!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ce5ff0d-8f45-43dc-9662-2d12daedea89_655x368.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!MEVc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ce5ff0d-8f45-43dc-9662-2d12daedea89_655x368.png" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1ce5ff0d-8f45-43dc-9662-2d12daedea89_655x368.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:null,&quot;width&quot;:null,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;I let the code to run for a whole night and this is what it did by morning. 104390 rice grains are donated under UN World Food Program.&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="I let the code to run for a whole night and this is what it did by morning. 104390 rice grains are donated under UN World Food Program." title="I let the code to run for a whole night and this is what it did by morning. 104390 rice grains are donated under UN World Food Program." srcset="https://substackcdn.com/image/fetch/$s_!MEVc!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ce5ff0d-8f45-43dc-9662-2d12daedea89_655x368.png 424w, https://substackcdn.com/image/fetch/$s_!MEVc!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ce5ff0d-8f45-43dc-9662-2d12daedea89_655x368.png 848w, https://substackcdn.com/image/fetch/$s_!MEVc!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ce5ff0d-8f45-43dc-9662-2d12daedea89_655x368.png 1272w, https://substackcdn.com/image/fetch/$s_!MEVc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ce5ff0d-8f45-43dc-9662-2d12daedea89_655x368.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></div><figcaption class="image-caption">I let the code to run for a whole night and this is what it did by morning. 104,390 rice grains are donated under UN World Food Program.</figcaption></figure></div><p>And a screenshot while the code is running:</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!oFd2!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F939a2d76-9416-4959-b172-8662005fe81c_655x368.png 424w, https://substackcdn.com/image/fetch/$s_!oFd2!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F939a2d76-9416-4959-b172-8662005fe81c_655x368.png 848w, https://substackcdn.com/image/fetch/$s_!oFd2!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F939a2d76-9416-4959-b172-8662005fe81c_655x368.png 1272w, https://substackcdn.com/image/fetch/$s_!oFd2!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F939a2d76-9416-4959-b172-8662005fe81c_655x368.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!oFd2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F939a2d76-9416-4959-b172-8662005fe81c_655x368.png" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/939a2d76-9416-4959-b172-8662005fe81c_655x368.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:null,&quot;width&quot;:null,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!oFd2!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F939a2d76-9416-4959-b172-8662005fe81c_655x368.png 424w, https://substackcdn.com/image/fetch/$s_!oFd2!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F939a2d76-9416-4959-b172-8662005fe81c_655x368.png 848w, https://substackcdn.com/image/fetch/$s_!oFd2!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F939a2d76-9416-4959-b172-8662005fe81c_655x368.png 1272w, https://substackcdn.com/image/fetch/$s_!oFd2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F939a2d76-9416-4959-b172-8662005fe81c_655x368.png 1456w" sizes="100vw"></picture><div></div></div></div><figcaption class="image-caption">Working fine but with 60% accuracy. (answered correctly 594 questions out of 1000, to be more specific)</figcaption></figure></div><p>So, lets dive into the juicy part, the code- The whole process is divided into small points.</p><ol><li><p>Take a screenshot while the required page, freerice.com in our case, is opened, crop it to get the area we are interested in to recognize characters&nbsp;i.e where the multiplication tables are. (Here in this project it is going to answer only multiplication type questions) Save the cropped image.</p></li><li><p>Analyse that image with Tesseract OCR to get a text file of recognized characters as output. (eventually saving it as a txt file next to our main program, I mean the folder)</p></li><li><p>Analyze that txt file and get the recognized information. (We are dealing with integers, so, convert a string txt file into integers)</p></li><li><p>After analysing the information in txt file, we get to know the question (7&#215;4 or something like that) and check for answer in options.</p></li><li><p>If the answer matches any of the options, move the mouse onto specific region. (works for me. It basically click on that pixel value, where that option is on screen, which I found by trail and error on my laptop)</p></li><li><p>If tesseract couldn&#8217;t find the correct answer, (answer we got by solving the first line &nbsp;(7&#215;4 for example) and answer by analysing the options) it randomly clicks on any of the four options just not to break the loop. (LOOP? where&#8217;s that? See next point)</p></li><li><p>Embed everything from 1 to 6 points in a loop so, it does its work while you are sleeping.</p></li></ol><p>I have briefly commented what&#8217;s each line is contributing to the code, making it as a whole.</p><pre><code>#Import required libraries. We need to download some, if you don't have tham.
import cv2
import os
import pyscreenshot as ImageGrab
import numpy as np
import time
from pymouse import PyMouse
import random

#defining a function rand.
def rand():
    m = PyMouse()
    #find a random int and put it into 'do'
    do= random.randint(1,4)
    #basic if, elif loop
    if do == 1:
    #clicking at point (395, 429). Here 1 implies a   left-click
    m.click(395, 429, 1)
    elif do== 2:
    m.click(395, 466, 1)
    elif do == 3:
    m.click(395, 505, 1)
    else:
    m.click(395, 544, 1)
    m.move(50,50)
    print("Rand")
    #wait for 1 sec, giving time to browser to refresh
    time.sleep(1)

trails= 0
#two forloops because, I am waiting for 5 secs after every 10 calculations just to make the system stable
for guns in range (0,1000):
  for buns in range(0,10):
  #Using try,catch to avoid any errors
    try:
      img= ImageGrab.grab() #taking a screenshot
      img.save('output.png')
      pic= cv2.imread('output.png')
      pic2= pic[360:570, 380:470] #cropping the pic, works in my case
      cv2.imwrite('output.png', pic2)
      u= 'convert output.png -resize 700 output.png'
      os.system(u) #writing to terminal (re-sizing the pic)
      s= 'tesseract output.png output'
      os.system(s) #writing to terminal (running Tesseract)
      f= open('output.txt', 'r')
      string= f.read().replace('\n', ' ')
      string= string.replace(' ', ' ')
      string= string.replace(' ', ' ')
      first= string[:string.find('x')] #finding first integer
      second= string[string.find('x')+1:string.find(' ')] #finding second integer
      pro= int(first)*int(second)
      print(pro)
      print(string)
      m= PyMouse()
      string= string[string.find(' ')+1:]
      a= int(string[:string.find(' ')])
      #print(a)
      #checking if product is equal to any of answers and clicking on that particular option
      if pro == a:
        m.click(395, 429, 1)
        m.move(50,50) #move cursor to any random point which is not in our area of interest, avoiding tesseract to think it as some character
        print("Pass")
        time.sleep(1)
      else:
        string= string[string.find(' ')+1:]
        b= int(string[:string.find(' ')])
        #print(b)
        if pro == b:
          m.click(395, 466, 1)
          m.move(50,50)
          print("Pass")
          time.sleep(1)
        else:
          string= string[string.find(' ')+1:]
          c= int(string[:string.find(' ')])
          #print(c)
          if pro == c:
            m.click(395, 505, 1)
            m.move(50,50)
            print("Pass")
            time.sleep(1)
          else:
            d= int(string[string.find(' ')+1:])
            #print(d)
            if pro == d:
              m.click(395, 544, 1)
              m.move(50,50)
              print("Pass")
              time.sleep(1)
            else:
              rand() #tesseract can't detect 100% accurately. So, tick any option randomly in case it didn't find correct answer
              #print("haha")
    except (ValueError, NameError, TypeError):
      rand() #tick randomly in case of any errors
  trails+= 10
  print("Total= " + str(trails))
  time.sleep(5) #waiting for 5secs after every 10 loops to make my system stable.
</code></pre><p>I&#8217;ll be back soon with MARK II of OCR system and next time I&#8217;ll not be using TesseractOCR. (Target accuracy- 90% (just a thought, though)) <em>If you have any questions or some feedback, please feel free to add comments. I&#8217;d be happy to get some feedback from you. &nbsp;</em> So, happy <a href="http://freerice.com/#/multiplication-table/"><span data-color="rgb(255, 153, 0)" style="color: rgb(255, 153, 0);">donating</span></a>. Any time</p><p style="text-align: right;"><strong>-SuryaTeja Cheedella</strong></p>]]></content:encoded></item><item><title><![CDATA[Car detection in MATLAB]]></title><description><![CDATA[Hello guys, how&#8217;s it going]]></description><link>https://musings.suryacheed.com/p/car-detection-in-matlab</link><guid isPermaLink="false">https://musings.suryacheed.com/p/car-detection-in-matlab</guid><dc:creator><![CDATA[Surya Cheedella]]></dc:creator><pubDate>Mon, 28 Jul 2014 07:08:58 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!kzY0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6376d1ca-12ec-4590-9442-d587d9381425_1312x600.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!kzY0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6376d1ca-12ec-4590-9442-d587d9381425_1312x600.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!kzY0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6376d1ca-12ec-4590-9442-d587d9381425_1312x600.webp 424w, https://substackcdn.com/image/fetch/$s_!kzY0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6376d1ca-12ec-4590-9442-d587d9381425_1312x600.webp 848w, https://substackcdn.com/image/fetch/$s_!kzY0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6376d1ca-12ec-4590-9442-d587d9381425_1312x600.webp 1272w, https://substackcdn.com/image/fetch/$s_!kzY0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6376d1ca-12ec-4590-9442-d587d9381425_1312x600.webp 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!kzY0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6376d1ca-12ec-4590-9442-d587d9381425_1312x600.webp" width="1312" height="600" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6376d1ca-12ec-4590-9442-d587d9381425_1312x600.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:600,&quot;width&quot;:1312,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:40970,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/webp&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://atimetravelers.substack.com/i/216590482?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6376d1ca-12ec-4590-9442-d587d9381425_1312x600.webp&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!kzY0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6376d1ca-12ec-4590-9442-d587d9381425_1312x600.webp 424w, https://substackcdn.com/image/fetch/$s_!kzY0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6376d1ca-12ec-4590-9442-d587d9381425_1312x600.webp 848w, https://substackcdn.com/image/fetch/$s_!kzY0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6376d1ca-12ec-4590-9442-d587d9381425_1312x600.webp 1272w, https://substackcdn.com/image/fetch/$s_!kzY0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6376d1ca-12ec-4590-9442-d587d9381425_1312x600.webp 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Hello guys, how&#8217;s it going</p><p>Today we are going to train a cascadeDetector, which returns an XML file. We can use that XML file &nbsp;to detect objects, cars (only from&nbsp;side-view) in this case, in an image.</p><p>As we are going to use matlab, I assume you have matlab installed on your PC along with image processing and computer vision toolboxes.&nbsp;The whole post is of two steps:</p><ol><li><p>Train our cascade detector with all the data files.</p></li><li><p>Use the output XML file to detect objects in a pic.</p></li></ol><p>The following pic. says it all.</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!GNZ-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae79fcc0-1a90-4908-a010-687d8d350735_656x140.png 424w, https://substackcdn.com/image/fetch/$s_!GNZ-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae79fcc0-1a90-4908-a010-687d8d350735_656x140.png 848w, https://substackcdn.com/image/fetch/$s_!GNZ-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae79fcc0-1a90-4908-a010-687d8d350735_656x140.png 1272w, https://substackcdn.com/image/fetch/$s_!GNZ-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae79fcc0-1a90-4908-a010-687d8d350735_656x140.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!GNZ-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae79fcc0-1a90-4908-a010-687d8d350735_656x140.png" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ae79fcc0-1a90-4908-a010-687d8d350735_656x140.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:null,&quot;width&quot;:null,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Overview &quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Overview " title="Overview " srcset="https://substackcdn.com/image/fetch/$s_!GNZ-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae79fcc0-1a90-4908-a010-687d8d350735_656x140.png 424w, https://substackcdn.com/image/fetch/$s_!GNZ-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae79fcc0-1a90-4908-a010-687d8d350735_656x140.png 848w, https://substackcdn.com/image/fetch/$s_!GNZ-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae79fcc0-1a90-4908-a010-687d8d350735_656x140.png 1272w, https://substackcdn.com/image/fetch/$s_!GNZ-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae79fcc0-1a90-4908-a010-687d8d350735_656x140.png 1456w" sizes="100vw"></picture><div></div></div></div><figcaption class="image-caption">Overview of what we are going to do in here.</figcaption></figure></div><p>Before going into the topics, lets see what we are going to build:</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ebVD!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8800982b-b7cb-4e5f-adab-319f57ade78d_655x368.png 424w, https://substackcdn.com/image/fetch/$s_!ebVD!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8800982b-b7cb-4e5f-adab-319f57ade78d_655x368.png 848w, https://substackcdn.com/image/fetch/$s_!ebVD!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8800982b-b7cb-4e5f-adab-319f57ade78d_655x368.png 1272w, https://substackcdn.com/image/fetch/$s_!ebVD!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8800982b-b7cb-4e5f-adab-319f57ade78d_655x368.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ebVD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8800982b-b7cb-4e5f-adab-319f57ade78d_655x368.png" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8800982b-b7cb-4e5f-adab-319f57ade78d_655x368.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:null,&quot;width&quot;:null,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Detected correctly &quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Detected correctly " title="Detected correctly " srcset="https://substackcdn.com/image/fetch/$s_!ebVD!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8800982b-b7cb-4e5f-adab-319f57ade78d_655x368.png 424w, https://substackcdn.com/image/fetch/$s_!ebVD!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8800982b-b7cb-4e5f-adab-319f57ade78d_655x368.png 848w, https://substackcdn.com/image/fetch/$s_!ebVD!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8800982b-b7cb-4e5f-adab-319f57ade78d_655x368.png 1272w, https://substackcdn.com/image/fetch/$s_!ebVD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8800982b-b7cb-4e5f-adab-319f57ade78d_655x368.png 1456w" sizes="100vw"></picture><div></div></div></div><figcaption class="image-caption">This is the final output we are going to get by the end.</figcaption></figure></div><h6><span data-color="rgb(0, 128, 0)" style="color: rgb(0, 128, 0);">1.&nbsp; Training the cascade file.&nbsp;</span></h6><p>First things first, to train a cascade detector we need a dataSet. A dataSet contains a lot of positive and negative images for a specific object. So, download the image dataBase from <a href="http://cogcomp.cs.illinois.edu/Data/Car/">here</a>. You can see a lot of image files (.pgm) in folders testImages, trainImages. You can get an overview by reading the &#8216;README.txt&#8217; file in that downloaded folder. In this part we are concentrating only on trainImages folder and in next part we get onto teatImages. Make new folders &#8216;trainImagesNeg&#8217; and &#8216;trainImagesPos&#8217; and remember the path. Copy&amp;Paste or Cut&amp;Paste the pictures in &#8216;trainImages&#8217; folder to these new folders. (you may know all the negative pictures are named neg-n.pgm and positive pictures as pos-n.pgm if you read that &#8216;.txt&#8217; file)</p><p>So, here is the line to train your data:</p><pre><code>trainCascadeObjectDetector('carTraindata4.xml', mydata, negativeFolder);
</code></pre><blockquote><p><span data-color="rgb(255, 102, 0)" style="color: rgb(255, 102, 0);">So, what&#8217;s with those arguments? Where the heck are they initialized.</span></p></blockquote><p>Here we go, the first argument, a xml file is going to be saved in our current directory, so that we can use it for detecting objects. You can name it as you wish, but don&#8217;t forget the extension &#8216;.xml&#8217;. Next argument is actually a <span data-color="rgb(255, 102, 0)" style="color: rgb(255, 102, 0);">struct</span>&nbsp;in matlab, which is the data of all positive images. It contains two fields namely <span data-color="rgb(0, 128, 0)" style="color: rgb(0, 128, 0);">imageFilename</span> and <span data-color="rgb(0, 128, 0)" style="color: rgb(0, 128, 0);">objectBoundingBoxes</span>. Size of this struct would be 1x(no. of pos images), 1&#215;550 in this case as we have 550 pos images. Have a look at this:</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_Xrn!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb70ddd00-411d-4322-8cc3-4199df317cf0_585x419.png 424w, https://substackcdn.com/image/fetch/$s_!_Xrn!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb70ddd00-411d-4322-8cc3-4199df317cf0_585x419.png 848w, https://substackcdn.com/image/fetch/$s_!_Xrn!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb70ddd00-411d-4322-8cc3-4199df317cf0_585x419.png 1272w, https://substackcdn.com/image/fetch/$s_!_Xrn!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb70ddd00-411d-4322-8cc3-4199df317cf0_585x419.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!_Xrn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb70ddd00-411d-4322-8cc3-4199df317cf0_585x419.png" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b70ddd00-411d-4322-8cc3-4199df317cf0_585x419.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:null,&quot;width&quot;:null,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Struct-mydata&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Struct-mydata" title="Struct-mydata" srcset="https://substackcdn.com/image/fetch/$s_!_Xrn!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb70ddd00-411d-4322-8cc3-4199df317cf0_585x419.png 424w, https://substackcdn.com/image/fetch/$s_!_Xrn!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb70ddd00-411d-4322-8cc3-4199df317cf0_585x419.png 848w, https://substackcdn.com/image/fetch/$s_!_Xrn!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb70ddd00-411d-4322-8cc3-4199df317cf0_585x419.png 1272w, https://substackcdn.com/image/fetch/$s_!_Xrn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb70ddd00-411d-4322-8cc3-4199df317cf0_585x419.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div><figcaption class="image-caption">Screenshot of struct of positive images with objectBoundingBoxes field</figcaption></figure></div><p>In the first field, the path of all 550 pos images are entered and in the second field the bounding boxes of our image of interest. As we got this whole data of images from a dataSets site, rather than collecting from internet, we don&#8217;t need to take that huge task of manually putting that values of bounding boxes into second field. (Thank God) Those values in second field are like [x of top-left point, y of top-left, width, height]. All the pictures in the dataSet are of size (100,40), and are already cropped to the image of interest. So, we can just select the whole pic by giving arguments as [1, 1, 100, 40]. And add that folder trainImagesPos to matlab path by right-clicking on it and click addpath.</p><blockquote><p><span data-color="rgb(255, 102, 0)" style="color: rgb(255, 102, 0);">Okay, I see where this is going. You mean I should do this for 550 times? (as there are 550 pos images)&nbsp;</span></p></blockquote><p>It&#8217;s absolutely your wish or you could use this for loop after initializing the struct &#8216;mydata&#8217;- (code is self-explanatory)</p><pre><code>mydata= struct('imageFilename', 'Just a random string', 'objectBoundingBoxes', 'Just a random string');
for i=0:549,
 mydata(i+1).imageFilename = strcat('trainImagesPos/pos-', num2str(i), '.pgm');
 mydata(i+1).objectBoundingBoxes = [1, 1, 100, 40]
end

</code></pre><p>Now, the whole thing with the second argument &#8216;mydata&#8217; is closed. As the name suggests the third argument &#8216;negativeFolder&#8217; is just a folder containing negative images. There is no need of bounding boxes for negative images. So, no need of thing like struct. Just assign the folder path to this variable named negativeFolder-</p><pre><code>negativeFolder= fullfile('C:\Users\Surya Teja Cheedella\Documents\MATLAB\carDetection\carData\trainImagesNeg')
</code></pre><p>For a good training, there should be a large number of negative images. As the number of neg. images in the dataSet are relatively low, I copy&amp;pasted a lot of my personal images into that <span data-color="rgb(0, 128, 0)" style="color: rgb(0, 128, 0);">trainImagesNeg</span> folder (make sure they don&#8217;t have pics of cars in side-view).</p><p>You can learn more about this function trainCascadeObjectDetector <a href="http://www.mathworks.in/help/vision/ref/traincascadeobjectdetector.html">here</a>.</p><p>Now, run the code&nbsp;with all arguments initialized. It took around 40 mins. to complete 13 stages of training on my laptop and returned a xml file.</p><blockquote><p><span data-color="rgb(255, 153, 0)" style="color: rgb(255, 153, 0);">Stages? What do you mean by them? Where did they come from?</span></p></blockquote><p>See THIS.</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!M7UW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a99873e-c385-41f7-a837-18c8a46c6807_656x375.png 424w, https://substackcdn.com/image/fetch/$s_!M7UW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a99873e-c385-41f7-a837-18c8a46c6807_656x375.png 848w, https://substackcdn.com/image/fetch/$s_!M7UW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a99873e-c385-41f7-a837-18c8a46c6807_656x375.png 1272w, https://substackcdn.com/image/fetch/$s_!M7UW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a99873e-c385-41f7-a837-18c8a46c6807_656x375.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!M7UW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a99873e-c385-41f7-a837-18c8a46c6807_656x375.png" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1a99873e-c385-41f7-a837-18c8a46c6807_656x375.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:null,&quot;width&quot;:null,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Stages while training&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Stages while training" title="Stages while training" srcset="https://substackcdn.com/image/fetch/$s_!M7UW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a99873e-c385-41f7-a837-18c8a46c6807_656x375.png 424w, https://substackcdn.com/image/fetch/$s_!M7UW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a99873e-c385-41f7-a837-18c8a46c6807_656x375.png 848w, https://substackcdn.com/image/fetch/$s_!M7UW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a99873e-c385-41f7-a837-18c8a46c6807_656x375.png 1272w, https://substackcdn.com/image/fetch/$s_!M7UW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a99873e-c385-41f7-a837-18c8a46c6807_656x375.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div><figcaption class="image-caption">An overview of what it&#8217;s gonna do in various stages.</figcaption></figure></div><h6></h6><h6><span data-color="rgb(0, 128, 0)" style="color: rgb(0, 128, 0);">2. &nbsp;Detecting objects in an image.</span></h6><p>After successful training, we can use the xml file to detect objects (cars in this case) in a picture. These lines of code will do that for us:</p><pre><code>%initialising the variable detector with the xml file
detector= vision.CascadeObjectDetector('carTraindata3.xml');
%reading an image file in current dir.
img= imread('sun.png');
%bounding box around detected object
box= step(detector, img);
%inserting that bounding box in given picture and showing it
figure,imshow(insertObjectAnnotation(img, 'rectangle', box,' '));
</code></pre><p>I have manually tested my trained xml file with all the pics in the testImages folder. It has an accuracy of 93% and out of 180 images these are the statistics:</p><ul><li><p>False Positives- 10 (single object in 120 pics and double objects in remaining)</p></li><li><p>True Negatives- 9</p></li></ul><p>Here is the code (just a for loop) to detect a large number of images and display them-</p><pre><code>for j= 1:100,
 img= imread(strcat('test-', num2str(j-1), '.pgm'));
 bbox= step(detector, img);
 figure,imshow(insertObjectAnnotation(img, 'rectangle', bbox,' '));
 pause(0.5);
end
</code></pre><p>As usual my training has a small defect. You can understand by seeing the pic below</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!jnQq!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1dd1579-1c83-4720-8b02-25b55dae6b61_655x368.png 424w, https://substackcdn.com/image/fetch/$s_!jnQq!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1dd1579-1c83-4720-8b02-25b55dae6b61_655x368.png 848w, https://substackcdn.com/image/fetch/$s_!jnQq!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1dd1579-1c83-4720-8b02-25b55dae6b61_655x368.png 1272w, https://substackcdn.com/image/fetch/$s_!jnQq!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1dd1579-1c83-4720-8b02-25b55dae6b61_655x368.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!jnQq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1dd1579-1c83-4720-8b02-25b55dae6b61_655x368.png" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a1dd1579-1c83-4720-8b02-25b55dae6b61_655x368.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:false,&quot;imageSize&quot;:&quot;normal&quot;,&quot;height&quot;:null,&quot;width&quot;:null,&quot;resizeWidth&quot;:0,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Wrongly detected images&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:&quot;center&quot;,&quot;offset&quot;:false}" class="sizing-normal" alt="Wrongly detected images" title="Wrongly detected images" srcset="https://substackcdn.com/image/fetch/$s_!jnQq!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1dd1579-1c83-4720-8b02-25b55dae6b61_655x368.png 424w, https://substackcdn.com/image/fetch/$s_!jnQq!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1dd1579-1c83-4720-8b02-25b55dae6b61_655x368.png 848w, https://substackcdn.com/image/fetch/$s_!jnQq!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1dd1579-1c83-4720-8b02-25b55dae6b61_655x368.png 1272w, https://substackcdn.com/image/fetch/$s_!jnQq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1dd1579-1c83-4720-8b02-25b55dae6b61_655x368.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p><span data-color="rgb(255, 102, 0)" style="color: rgb(255, 102, 0);">So, Happy Training!</span></p><p><strong>&#8211;</strong><br><strong>Surya</strong></p>]]></content:encoded></item><item><title><![CDATA[Face Detection using openCV in Python]]></title><description><![CDATA[Hello folks, How&#8217;s it going!]]></description><link>https://musings.suryacheed.com/p/face-detection</link><guid isPermaLink="false">https://musings.suryacheed.com/p/face-detection</guid><dc:creator><![CDATA[Surya Cheedella]]></dc:creator><pubDate>Mon, 21 Jul 2014 12:59:06 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!kUrC!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c0ca9d0-89b6-48bb-853e-5029c668c6c0_1312x600.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!kUrC!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c0ca9d0-89b6-48bb-853e-5029c668c6c0_1312x600.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!kUrC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c0ca9d0-89b6-48bb-853e-5029c668c6c0_1312x600.webp 424w, https://substackcdn.com/image/fetch/$s_!kUrC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c0ca9d0-89b6-48bb-853e-5029c668c6c0_1312x600.webp 848w, https://substackcdn.com/image/fetch/$s_!kUrC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c0ca9d0-89b6-48bb-853e-5029c668c6c0_1312x600.webp 1272w, https://substackcdn.com/image/fetch/$s_!kUrC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c0ca9d0-89b6-48bb-853e-5029c668c6c0_1312x600.webp 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!kUrC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c0ca9d0-89b6-48bb-853e-5029c668c6c0_1312x600.webp" width="1312" height="600" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3c0ca9d0-89b6-48bb-853e-5029c668c6c0_1312x600.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:600,&quot;width&quot;:1312,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:521976,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/webp&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://atimetravelers.substack.com/i/216590483?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c0ca9d0-89b6-48bb-853e-5029c668c6c0_1312x600.webp&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!kUrC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c0ca9d0-89b6-48bb-853e-5029c668c6c0_1312x600.webp 424w, https://substackcdn.com/image/fetch/$s_!kUrC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c0ca9d0-89b6-48bb-853e-5029c668c6c0_1312x600.webp 848w, https://substackcdn.com/image/fetch/$s_!kUrC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c0ca9d0-89b6-48bb-853e-5029c668c6c0_1312x600.webp 1272w, https://substackcdn.com/image/fetch/$s_!kUrC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c0ca9d0-89b6-48bb-853e-5029c668c6c0_1312x600.webp 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Hello folks, How&#8217;s it going!</p><p>Today I am going to introduce my face detection algorithm. (not a big one though) Don&#8217;t think that this is really a huge task! I am not working from scratch (means I am not actually gathering a huge data set of all pictures (both negative and positive, i.e having faces and not ) and train my algorithm). I have used haar Cascading files.</p><blockquote><p><span data-color="rgb(0, 128, 0)" style="color: rgb(0, 128, 0);">What the heck are they? Here we go.</span></p></blockquote><p>Taking samples of a lot of image files of both types (having faces and not having faces) and train the algorithm, make it learn when ever (most probably every time) it makes a mistake and store the whole data into xml files. In this case I am using haar Cascading xml files. As I already said they are huge, wanna know their size? 35k lines of code in each xml file! Yes, you read that right, 35K lines of random numbers.</p><p>Coming to the juicy part, the code, here it is. I have commented briefly what each line is contributing.</p><pre><code>#import numpy as np
import cv2
#import PIL

#import the xml files. here i am using frontal face and eye.
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
eye_cascade = cv2.CascadeClassifier('haarcascade_eye.xml')

img= cv2.imread('5.jpg') #reading the image
gray_img= cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) #converting into gratscale(algos work with grayscale images)

faces = face_cascade.detectMultiScale(gray_img, 1.3, 5) #detecting faces. lightning conditions may affect the output
print (faces) #just printing to console. this will print boundary points of detected face(s)

#searching for eyes only in faces. easy and efficient to search only in face rather than whole image
for (p,q,r,s) in faces:
 cv2.rectangle(img,(p,q),(p+r,q+s),(150,125,0),2)        #drawing a rectangle indicating face
 face_gray = gray_img[q:q+s, p:p+r] #cropping   face in gray image
 face_color = img[q:q+s, p:p+r] #cropping face in  color image
 eyes = eye_cascade.detectMultiScale(face_gray)  #searching for eyes in grayscale img
 for (ep,eq,er,es) in eyes:
  cv2.rectangle(face_color,(ep,eq),(ep+er,eq+es), (100,210,150),2) #for each eye drawing rectangle

cv2.imshow("output", img)
cv2.waitKey(0) #showing the img

#this only takes a image and shows the faces in the image. It dont modifies the image.
#if you want to save the resulted image use this...
#cv2.imwrite("output.jpg", img)

</code></pre><p>Wanna know what it did? I gave this image</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://suryatejacheedella.wordpress.com/2014/07/21/face-detection/attachment/5/" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!aVYI!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcbdf4c3-5318-4ff5-b0ed-44ff80198b5b_450x445.jpeg 424w, https://substackcdn.com/image/fetch/$s_!aVYI!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcbdf4c3-5318-4ff5-b0ed-44ff80198b5b_450x445.jpeg 848w, https://substackcdn.com/image/fetch/$s_!aVYI!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcbdf4c3-5318-4ff5-b0ed-44ff80198b5b_450x445.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!aVYI!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcbdf4c3-5318-4ff5-b0ed-44ff80198b5b_450x445.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!aVYI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcbdf4c3-5318-4ff5-b0ed-44ff80198b5b_450x445.jpeg" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bcbdf4c3-5318-4ff5-b0ed-44ff80198b5b_450x445.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:null,&quot;width&quot;:null,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Input image&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:&quot;https://suryatejacheedella.wordpress.com/2014/07/21/face-detection/attachment/5/&quot;,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Input image" title="Input image" srcset="https://substackcdn.com/image/fetch/$s_!aVYI!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcbdf4c3-5318-4ff5-b0ed-44ff80198b5b_450x445.jpeg 424w, https://substackcdn.com/image/fetch/$s_!aVYI!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcbdf4c3-5318-4ff5-b0ed-44ff80198b5b_450x445.jpeg 848w, https://substackcdn.com/image/fetch/$s_!aVYI!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcbdf4c3-5318-4ff5-b0ed-44ff80198b5b_450x445.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!aVYI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcbdf4c3-5318-4ff5-b0ed-44ff80198b5b_450x445.jpeg 1456w" sizes="100vw"></picture><div></div></div></a></figure></div><p>and it returned THIS!&#8230;&#8230;.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://suryatejacheedella.wordpress.com/2014/07/21/face-detection/attachment/123/" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!eqZ8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97934315-a1ed-4f8c-80cc-fded56e4be9f_655x368.png 424w, https://substackcdn.com/image/fetch/$s_!eqZ8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97934315-a1ed-4f8c-80cc-fded56e4be9f_655x368.png 848w, https://substackcdn.com/image/fetch/$s_!eqZ8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97934315-a1ed-4f8c-80cc-fded56e4be9f_655x368.png 1272w, https://substackcdn.com/image/fetch/$s_!eqZ8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97934315-a1ed-4f8c-80cc-fded56e4be9f_655x368.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!eqZ8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97934315-a1ed-4f8c-80cc-fded56e4be9f_655x368.png" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/97934315-a1ed-4f8c-80cc-fded56e4be9f_655x368.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:null,&quot;width&quot;:null,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Output&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:&quot;https://suryatejacheedella.wordpress.com/2014/07/21/face-detection/attachment/123/&quot;,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Output" title="Output" srcset="https://substackcdn.com/image/fetch/$s_!eqZ8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97934315-a1ed-4f8c-80cc-fded56e4be9f_655x368.png 424w, https://substackcdn.com/image/fetch/$s_!eqZ8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97934315-a1ed-4f8c-80cc-fded56e4be9f_655x368.png 848w, https://substackcdn.com/image/fetch/$s_!eqZ8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97934315-a1ed-4f8c-80cc-fded56e4be9f_655x368.png 1272w, https://substackcdn.com/image/fetch/$s_!eqZ8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F97934315-a1ed-4f8c-80cc-fded56e4be9f_655x368.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Screenshot of the output</figcaption></figure></div><p>Currently, I am working on alphabet detection thing to won in a bet with my friend.</p><p>Bieeee &nbsp;^_^</p><p>Here somewhere in Milky Way</p><p><span data-color="rgb(255, 102, 0)" style="color: rgb(255, 102, 0);">-Surya&nbsp;</span></p>]]></content:encoded></item><item><title><![CDATA[First ML Code on Gradient descent!]]></title><description><![CDATA[Hii there,]]></description><link>https://musings.suryacheed.com/p/first-ml-code</link><guid isPermaLink="false">https://musings.suryacheed.com/p/first-ml-code</guid><dc:creator><![CDATA[Surya Cheedella]]></dc:creator><pubDate>Fri, 11 Jul 2014 17:04:50 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!HHmu!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbc1386d3-0b60-409b-a2f9-0723941c995c_656x300.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!HHmu!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbc1386d3-0b60-409b-a2f9-0723941c995c_656x300.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!HHmu!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbc1386d3-0b60-409b-a2f9-0723941c995c_656x300.webp 424w, https://substackcdn.com/image/fetch/$s_!HHmu!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbc1386d3-0b60-409b-a2f9-0723941c995c_656x300.webp 848w, https://substackcdn.com/image/fetch/$s_!HHmu!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbc1386d3-0b60-409b-a2f9-0723941c995c_656x300.webp 1272w, https://substackcdn.com/image/fetch/$s_!HHmu!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbc1386d3-0b60-409b-a2f9-0723941c995c_656x300.webp 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!HHmu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbc1386d3-0b60-409b-a2f9-0723941c995c_656x300.webp" width="656" height="300" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bc1386d3-0b60-409b-a2f9-0723941c995c_656x300.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:300,&quot;width&quot;:656,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:122154,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/webp&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://atimetravelers.substack.com/i/216590484?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbc1386d3-0b60-409b-a2f9-0723941c995c_656x300.webp&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!HHmu!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbc1386d3-0b60-409b-a2f9-0723941c995c_656x300.webp 424w, https://substackcdn.com/image/fetch/$s_!HHmu!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbc1386d3-0b60-409b-a2f9-0723941c995c_656x300.webp 848w, https://substackcdn.com/image/fetch/$s_!HHmu!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbc1386d3-0b60-409b-a2f9-0723941c995c_656x300.webp 1272w, https://substackcdn.com/image/fetch/$s_!HHmu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbc1386d3-0b60-409b-a2f9-0723941c995c_656x300.webp 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Hii there,</p><p>Hmm&#8230; my first program exceeding 20 lines.</p><p>Basically, it is a gradient descent problem (don&#8217;t know much about it ). As I am taking Machine Learning course on Cousera I wanna solve some problems on ML. I found some AI problems (don&#8217;t know much about this too) on HakerRank site and started solving this one. This guy is an output of my 5 hours of work.</p><pre><code>import java.util.Scanner;


public class houseCosts {
&#9;public static void main(String[] args){
&#9;&#9;System.out.println(&amp;amp;quot;Enter&amp;amp;quot;);
&#9;&#9;Scanner in = new Scanner(System.in);
&#9;&#9;int n = in.nextInt();
&#9;&#9;int m = in.nextInt();
&#9;&#9;//System.out.println(n+&amp;amp;quot;&amp;amp;quot;+m);
&#9;&#9;float[][] x = new float[n+2][m];
&#9;&#9;float[] t = new float[n+1];                       
&#9;&#9;float[] temp = new float[n+1];
&#9;&#9;float alpha = (float) 0.3;                      //alpha
&#9;&#9;//inputs
&#9;&#9;for(int j = 0; j&amp;amp;lt;m; j++){
&#9;&#9;&#9;for(int i=1; i&amp;amp;lt;n+2; i++){
&#9;&#9;&#9;&#9;x[i][j] = in.nextFloat();
&#9;&#9;&#9;&#9;//System.out.println(&amp;amp;quot;x &amp;amp;quot;+i+&amp;amp;quot; &amp;amp;quot;+j+&amp;amp;quot;= &amp;amp;quot;+x[i][j]);
&#9;&#9;&#9;}
&#9;&#9;}
&#9;&#9;
&#9;&#9;int num = in.nextInt();
&#9;&#9;//System.out.println(num);
&#9;&#9;float[][] out = new float[n+1][num];
&#9;&#9;for(int j = 0; j&amp;amp;lt;num; j++){
&#9;&#9;&#9;for(int i=1; i&amp;amp;lt;n+1; i++){
&#9;&#9;&#9;&#9;out[i][j] = in.nextFloat();
&#9;&#9;&#9;&#9;//System.out.println(&amp;amp;quot;out &amp;amp;quot;+i+&amp;amp;quot; &amp;amp;quot;+j+&amp;amp;quot;= &amp;amp;quot;+out[i][j]);
&#9;&#9;&#9;}
&#9;&#9;}
&#9;&#9;for(int i=0; i&amp;amp;lt;num; i++){
&#9;&#9;&#9;out[0][i] = 1;
&#9;&#9;&#9;//System.out.println(&amp;amp;quot;x &amp;amp;quot;+0+&amp;amp;quot; &amp;amp;quot;+i+&amp;amp;quot;= &amp;amp;quot;+x[0][i]);
&#9;&#9;}
&#9;&#9;
&#9;&#9;//Initializations 
&#9;&#9;for(int i=0; i&amp;amp;lt;m; i++){
&#9;&#9;&#9;x[0][i] = 1;
&#9;&#9;&#9;
&#9;&#9;&#9;//System.out.println(&amp;amp;quot;x &amp;amp;quot;+0+&amp;amp;quot; &amp;amp;quot;+i+&amp;amp;quot;= &amp;amp;quot;+x[0][i]);
&#9;&#9;}
&#9;&#9;for(int j=0; j&amp;amp;lt;n+1; j++){
&#9;&#9;&#9;t[j] = 0;                                  //theta value initializing
&#9;&#9;}
&#9;&#9;
&#9;&#9;for(int p = 0; p&amp;amp;lt;500; p++){                   //no. of times
&#9;&#9;&#9;//body
&#9;&#9;&#9;for(int k=0; k&amp;amp;lt;n+1; k++){
&#9;&#9;&#9;&#9;float dum = 0;
&#9;&#9;&#9;&#9;for(int j=0; j&amp;amp;lt;m; j++){
&#9;&#9;&#9;&#9;&#9;float ans = 0;
&#9;&#9;&#9;&#9;&#9;for(int i=0; i&amp;amp;lt;n+1; i++){
&#9;&#9;&#9;&#9;&#9;&#9;ans+= t[i] * x[i][j];
&#9;&#9;&#9;&#9;&#9;&#9;//System.out.println(ans);
&#9;&#9;&#9;&#9;&#9;}
&#9;&#9;&#9;&#9;&#9;ans-= x[n+1][j];
&#9;&#9;&#9;&#9;&#9;//System.out.println(ans);
&#9;&#9;&#9;&#9;&#9;ans*= x[k][j];
&#9;&#9;&#9;&#9;&#9;dum+=ans;
&#9;&#9;&#9;&#9;&#9;//System.out.println(&amp;amp;quot;x &amp;amp;quot;+k+&amp;amp;quot; &amp;amp;quot;+j+&amp;amp;quot; =&amp;amp;quot;+x[k][j]);
&#9;&#9;&#9;&#9;&#9;//System.out.println(ans);
&#9;&#9;&#9;&#9;}
&#9;&#9;&#9;&#9;//System.out.println(dum);
&#9;&#9;&#9;&#9;temp[k] = (float) (t[k]-(alpha * dum * (1.0/m)));
&#9;&#9;&#9;&#9;//System.out.println(temp[k]);
&#9;&#9;&#9;}
&#9;&#9;&#9;for(int k=0; k&amp;amp;lt;=n; k++){
&#9;&#9;&#9;&#9;t[k]=temp[k];
&#9;&#9;&#9;&#9;//System.out.print(t[k]+&amp;amp;quot; &amp;amp;quot;);
&#9;&#9;&#9;}
&#9;&#9;&#9;//System.out.println(&amp;amp;quot; &amp;amp;quot;);
&#9;&#9;}
&#9;&#9;
&#9;&#9;for(int i = 0; i&amp;amp;lt;num; i++){
&#9;&#9;&#9;float foo = 0;
&#9;&#9;&#9;for(int j=0; j&amp;amp;lt;n+1; j++){
&#9;&#9;&#9;&#9;foo+=out[j][i] * t[j];
&#9;&#9;&#9;}
&#9;&#9;&#9;System.out.println(foo);
&#9;&#9;}
&#9;&#9;
&#9;}
}

</code></pre><p>Don&#8217;t judge me by this code coz, I don&#8217;t know much about algorithms and ML. And there are so many stdouts because I dunno how to debug in eclipse or any IDE for that mater. BTW, I got ten on ten for this problem.</p><p>Something Productive- CHECK!</p><p>Don&#8217;t forget to travel in time.</p><p>Cheerios</p><p>&#8211;<span data-color="rgb(255, 102, 0)" style="color: rgb(255, 102, 0);">Surya</span></p>]]></content:encoded></item><item><title><![CDATA[Birthday code! (Thanking friends on facebook using GraphAPI)]]></title><description><![CDATA[I wrote this on my birthday,]]></description><link>https://musings.suryacheed.com/p/birthday-code</link><guid isPermaLink="false">https://musings.suryacheed.com/p/birthday-code</guid><dc:creator><![CDATA[Surya Cheedella]]></dc:creator><pubDate>Wed, 09 Jul 2014 16:20:52 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!qY5x!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb464c36d-e943-4897-a8aa-43eaff478bd1_1024x468.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!qY5x!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb464c36d-e943-4897-a8aa-43eaff478bd1_1024x468.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!qY5x!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb464c36d-e943-4897-a8aa-43eaff478bd1_1024x468.webp 424w, https://substackcdn.com/image/fetch/$s_!qY5x!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb464c36d-e943-4897-a8aa-43eaff478bd1_1024x468.webp 848w, https://substackcdn.com/image/fetch/$s_!qY5x!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb464c36d-e943-4897-a8aa-43eaff478bd1_1024x468.webp 1272w, https://substackcdn.com/image/fetch/$s_!qY5x!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb464c36d-e943-4897-a8aa-43eaff478bd1_1024x468.webp 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!qY5x!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb464c36d-e943-4897-a8aa-43eaff478bd1_1024x468.webp" width="1024" height="468" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b464c36d-e943-4897-a8aa-43eaff478bd1_1024x468.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:468,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:49552,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/webp&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://atimetravelers.substack.com/i/216590485?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb464c36d-e943-4897-a8aa-43eaff478bd1_1024x468.webp&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!qY5x!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb464c36d-e943-4897-a8aa-43eaff478bd1_1024x468.webp 424w, https://substackcdn.com/image/fetch/$s_!qY5x!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb464c36d-e943-4897-a8aa-43eaff478bd1_1024x468.webp 848w, https://substackcdn.com/image/fetch/$s_!qY5x!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb464c36d-e943-4897-a8aa-43eaff478bd1_1024x468.webp 1272w, https://substackcdn.com/image/fetch/$s_!qY5x!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb464c36d-e943-4897-a8aa-43eaff478bd1_1024x468.webp 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>I wrote this on my birthday,</p><pre><code>import facebook

graph = facebook.GraphAPI('Access token you got from facebook developers page')
feed = graph.get_connections(&amp;quot;suryateja.cheedella&amp;quot;, &amp;quot;feed?limit=200&amp;quot;)
for a in range (0,200):
    post = feed[&amp;quot;data&amp;quot;][a]
    fromDetails = (post[&amp;quot;from&amp;quot;])
    fromName = fromDetails[&amp;quot;name&amp;quot;]
    graph.put_like(post[&amp;quot;id&amp;quot;])
    graph.put_object(post[&amp;quot;id&amp;quot;], &amp;quot;comments&amp;quot;, message=&amp;quot;Thank you :d &amp;quot; + fromName)
</code></pre><p>and then there, it thanked all my friends who wished me on my timeline.</p><p>Hello, what&#8217;s up guys,</p><p>It&#8217;s afternoon on 4th and as usually I am browsing on quora and facebook. I stumbled upon &#8216;what are the best python codes you have written&#8217; question on quora. I saw some top answers which are actually thanking friends on FB on their birthday. Actually it&#8217;s the best time to learn or just copy&amp;paste all of that code so, I can make my thanking task easy for tomorrow. But, I wrote &#8216;Hello world&#8217; program in python just two weeks back. And completed reading like 100 pages of &#8216;Head first python&#8217;. So, I started searching on web and got to know about some thing called GraphAPI. After spending like 5 to 6 hours, I wrote that 10 lines of code (in a perfectly working condition) and tested it.</p><p>You can say, dude why don&#8217;t you use that already written code found on quora. Basically all those codes are old. I mean those are the codes written before releasing GraphAPI by facebook. With that <strong>thing</strong>&nbsp;for facebook developers, one can reduce their code to 10 lines (yeah, you look their) from 40 to 50 lines of code which I have found on Quora.</p><p>That is not the best way to reach our goal (like commenting on last &#8216;x&#8217; number of posts on my wall) but, that is what I can learn in that span of time.</p><p>Shine.</p><p>&#8211;<em><strong><span data-color="rgb(0, 128, 0)" style="color: rgb(0, 128, 0);">S&nbsp;</span></strong></em></p>]]></content:encoded></item><item><title><![CDATA[What I have found?!]]></title><description><![CDATA[Hello, HaHaaa..]]></description><link>https://musings.suryacheed.com/p/what-i-have-found</link><guid isPermaLink="false">https://musings.suryacheed.com/p/what-i-have-found</guid><dc:creator><![CDATA[Surya Cheedella]]></dc:creator><pubDate>Wed, 02 Jul 2014 15:18:37 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/37039a09-57eb-4cc8-bce4-feec81e441fc_600x450.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hello,</p><p>HaHaaa.. I received all of my summer toys from element14 for free. Yeah, you heard that right, absolutely for FREE. It&#8217;s part of roadtest by element14. This is a group dedicated to testing and reviewing new products. I submitted my idea of testing these products and they selected me. And I should agree to their conditions that I should provide them with a neat review within two months of receiving kits. Here are they:</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!y-Qh!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc924b2f1-5015-419a-a3d1-6f90e96ca8ac_600x450.jpeg 424w, https://substackcdn.com/image/fetch/$s_!y-Qh!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc924b2f1-5015-419a-a3d1-6f90e96ca8ac_600x450.jpeg 848w, https://substackcdn.com/image/fetch/$s_!y-Qh!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc924b2f1-5015-419a-a3d1-6f90e96ca8ac_600x450.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!y-Qh!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc924b2f1-5015-419a-a3d1-6f90e96ca8ac_600x450.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!y-Qh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc924b2f1-5015-419a-a3d1-6f90e96ca8ac_600x450.jpeg" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c924b2f1-5015-419a-a3d1-6f90e96ca8ac_600x450.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:null,&quot;width&quot;:null,&quot;resizeWidth&quot;:618,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;My Toys&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="My Toys" title="My Toys" srcset="https://substackcdn.com/image/fetch/$s_!y-Qh!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc924b2f1-5015-419a-a3d1-6f90e96ca8ac_600x450.jpeg 424w, https://substackcdn.com/image/fetch/$s_!y-Qh!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc924b2f1-5015-419a-a3d1-6f90e96ca8ac_600x450.jpeg 848w, https://substackcdn.com/image/fetch/$s_!y-Qh!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc924b2f1-5015-419a-a3d1-6f90e96ca8ac_600x450.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!y-Qh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc924b2f1-5015-419a-a3d1-6f90e96ca8ac_600x450.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></div><figcaption class="image-caption">Got from element14. Hahaa</figcaption></figure></div><p>Briefly, an MSP430 launchpad from TI with Anaren air kit to control a robot or a robotic car with smartphones via bluetooth. Raspberry Pi with Enocean modules (self-powered sensors kit) for home automation. And my idea is switch-off computers or laptops when you leave your room.</p><p>After spending all these days lazily, it&#8217;s time to start working on these things and provide them with review helps me to spend remaining time lazily&#8230;.!</p><p>Bye for now.</p><p>Peace</p><p>&#8211;<span data-color="rgb(0, 128, 0)" style="color: rgb(0, 128, 0);">S</span></p>]]></content:encoded></item><item><title><![CDATA[Competition is everything !]]></title><description><![CDATA[In my room, on a rainy evening]]></description><link>https://musings.suryacheed.com/p/inspiration-is-everything</link><guid isPermaLink="false">https://musings.suryacheed.com/p/inspiration-is-everything</guid><dc:creator><![CDATA[Surya Cheedella]]></dc:creator><pubDate>Wed, 21 May 2014 12:49:29 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!Rr7L!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F913fb287-6243-4147-bf36-726180d49327_1000x1000.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote><p><span data-color="rgb(255, 102, 0)" style="color: rgb(255, 102, 0);">In my room, on a rainy evening</span></p></blockquote><p>It&#8217;s rainy evening of august, time is 7 and I am in my room with windows and door closed. It&#8217;s first month on campus. Life is very interesting with new environment, new friends, new aims and a little bit of <strong>interaction</strong>(this is what we call ragging, in here). Even though I joined college few weeks ago, I have already started bunking classes(Bitsians). Now, I am feeling bored and even homesick, coz this is my first experience with&nbsp;hostels. I don&#8217;t have any important work except eating and sleeping. I am refreshing my news-feed and adding everyone from BITS with mutual friend count more than 5. But in&nbsp;background&nbsp;I am thinking about home, myself, what I should do. Time is 8:30 and my threshold value of mutual friend count raised to 10 as some people added me back. I am refreshing news-feed, adding people and I am feeling sleepy. At last, a screen I wanted to see &#8220;<strong>Blocked from sending friend requests</strong>&#8220;(although crossed many obstacles like &#8220;are you sure you want to add&#8230;.. &#128539; &#8220;) .</p><p>The next thing I remembered is someone banging on my door(I slept in chair and now time is 9:30 and I missed supper). I am feeling&nbsp;hungry and I didn&#8217;t make any close friends till now who know&nbsp;my room no. and can bang &nbsp;it. Maybe it&#8217;s warden(<em>wtf, is there anything like&nbsp;checking rooms?</em>). Maybe it&#8217;s parents(least probability, though). I am about to open the door and a voice came, saying loudly &#8220;<strong>Sorry</strong>&#8220;. I don&#8217;t<br>know who it is and I don&#8217;t want to know. I made my way to bed and I slept. I woke up at 12:30, I am thirsty, hungry and my water<br>bottle is empty. I, somehow managed to get water from my neighbour and settled myself in my room with closed window and door as usual. I am not sleepy any more and some 45 people added me back plus I got 4 add friend requests. I am refreshing and saw some thing interesting! Now it&#8217;s time to talk about this post&#8217;s heading ( &#128539; ) .</p><p>I saw some random&nbsp;guy&nbsp;(from BITS, in a BITSian group) asking a doubt regarding RC plane controller, where to buy, how to control. Followed by comments saying</p><ul><li><p>beta, just go and study</p></li><li><p>i can help you, inbox me</p></li><li><p>dude, you started working on that?</p></li></ul><p>and a lot more(some even with useful links). There are many comments starting with beta and I assumed him as <strong>first yearite</strong>. I was thinking like, even first yearites are working on projects from first month and I am just eating and sleeping. I thought maybe he has a lot of knowledge in those things and I started refreshing. But in background I can&#8217;t <strong>tolerate</strong> the fact he is first yearite and working on projects. So, I followed all the links in the comments and learned a lot about those things by 3 O&#8217;clock. I am very much inspired by&nbsp;all the videos on YouTube and the matter in links provided.</p><blockquote><p>A first yearite is working on projects, why can&#8217;t&nbsp;I?</p></blockquote><p>I tried to message the guy who has posted that question, but he is offline then. I started viewing the required electronic parts to build it and I ordered parts which costs around 6K INR(even now, I don&#8217;t know how I managed to order them without taking permission from&nbsp;my mom). I started chatting with some guys who commented on that post. They said that this equipment is costly and buy them only if you are planning to participate in any TECH fests. But, I have already ordered them, So, it&#8217;s time to search any TECH fests around here in a month or two. I found NIT warangal&#8217;s <strong>Technozion</strong>&nbsp;and I wanted to participate in it. I am a bit nervous till now coz, I didn&#8217;t consult my mom before ordering, but now there is a solid reason. &nbsp;<strong> I am going to participate in TECH Fest. &#128512;</strong></p><p>It&#8217;s 6 O&#8217;clock in the morning and that guy who asked the question is online. I started chatting with him, about his project and after a long chat I enquired his room no. just to meet him in person. The answer from him gave me a shock. He is from shankar Bhavan which is second yearites&#8217; Bhavan. I thought he is junior as so many people called him &#8216;beta&#8217;. I asked him about &#8216;beta&#8217; and he answered they are his seniors, third yearites. Ohh! I missed this logic&#8230;&#8230;&#8230;</p><p>The sole reason, I wanted to know about this project, I ordered parts is that he is a first yearite, but now he is no more a first yearite. I ordered parts worth 6k(That&#8217;s a subset of whole parts required for the project), I have a solid reason (participating in TECH Fest). So, I worked on my project. (teaming up with some friends)</p><div><hr></div><blockquote><p><span data-color="rgb(255, 102, 0)" style="color: rgb(255, 102, 0);">At </span><strong><span data-color="rgb(255, 102, 0)" style="color: rgb(255, 102, 0);">Technozion, </span></strong><span data-color="rgb(255, 102, 0)" style="color: rgb(255, 102, 0);">on a sunny morning</span></p></blockquote><p>Now, I am very proud of myself. We are the only first year team participating in this RC Plane event. Not even a single team participated, consists of second yearites, all of them are third and final year guys. We stood at 7 out of 22 participated teams consisting of&nbsp;super seniors and more.</p><p>All Happies.</p><p>And there is a solid reason behind &#8216;Why I started blogging&#8217;, which I am going to reveal in my next posts.</p><p>After all, Competition is everything!</p><p>I am really feeling sleepy.</p><p>Bye for now.</p><p>-Surya</p>]]></content:encoded></item><item><title><![CDATA[Hello Universe!]]></title><description><![CDATA[Hello all!]]></description><link>https://musings.suryacheed.com/p/hello-universe</link><guid isPermaLink="false">https://musings.suryacheed.com/p/hello-universe</guid><dc:creator><![CDATA[Surya Cheedella]]></dc:creator><pubDate>Fri, 02 May 2014 13:09:04 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!Rr7L!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F913fb287-6243-4147-bf36-726180d49327_1000x1000.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hello all!</p><p>Very much excited on getting a blog for me. This post is just to know how wordpress works.</p><p>As I said, in &#8216;About Me&#8217;, I am very much interested in topics like Robotics, AI, Embedded Electronics&#8230;etc . In this blog, I am going to open myself, both Technically and Psychologically.</p><p>I worked on electronic projects like Rc Planes, QuadCopters, Autonomous obstacle Avoider(land vehicle), about which I am going to&nbsp;share my knowledge(or experience, whatever it may be) in this blog.</p><h3><strong><span data-color="rgb(0, 128, 0)" style="color: rgb(0, 128, 0);">REASON FOR CREATING THIS BLOG</span></strong></h3><p>As compres are about to start, I am jobless(most of Bitsians are) and just browsing something, which I forgot now. And then an idea struck my head, Why don&#8217;t I start a blog, and there are 2 months of holidays to make my blog as a beautiful master-piece(only if, I&nbsp;started blogging).</p><p>So,&nbsp;herewe go, my blog &#8216;<span data-color="rgb(0, 128, 0)" style="color: rgb(0, 128, 0);">this is ME, that is MINE</span>&#8216;(and don&#8217;t ask me what that means(btw, I have changed the name &#128539; )).</p><p>Hope I wont bore you with my posts &#128578;</p>]]></content:encoded></item></channel></rss>