<?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:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Subodh Malgonde on Medium]]></title>
        <description><![CDATA[Stories by Subodh Malgonde on Medium]]></description>
        <link>https://medium.com/@subodh.malgonde?source=rss-5fc94a696f7e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Y7FvEGOpIg0Y-b4qeEzsGg.jpeg</url>
            <title>Stories by Subodh Malgonde on Medium</title>
            <link>https://medium.com/@subodh.malgonde?source=rss-5fc94a696f7e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 17:03:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@subodh.malgonde/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Resources to help you build an indoor self driving car]]></title>
            <link>https://medium.com/@subodh.malgonde/resources-to-help-you-build-an-indoor-self-driving-car-f1c0df54b6e1?source=rss-5fc94a696f7e------2</link>
            <guid isPermaLink="false">https://medium.com/p/f1c0df54b6e1</guid>
            <category><![CDATA[robot-operating-system]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[robotics]]></category>
            <category><![CDATA[self-driving-cars]]></category>
            <category><![CDATA[sensors]]></category>
            <dc:creator><![CDATA[Subodh Malgonde]]></dc:creator>
            <pubDate>Mon, 28 Jan 2019 13:29:08 GMT</pubDate>
            <atom:updated>2019-01-28T13:33:12.408Z</atom:updated>
            <content:encoded><![CDATA[<p>Couple of months back I wrote a <a href="https://medium.com/@subodh.malgonde/building-an-actual-self-driving-car-53f67ca41566">post</a> on how I went about building a 1/10th scale self driving car, which can roam around in my house. Checkout <a href="https://youtu.be/h8Mnkqyv338">this video</a> of the car in action. This post lists down some of the online resources which helped me build this car.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0x-LLYlaP-mR4lWcLCCu7A.png" /><figcaption>My 1/10th scale self driving car. See <a href="https://medium.com/@subodh.malgonde/building-an-actual-self-driving-car-53f67ca41566">this post</a>.</figcaption></figure><h4>MIT Racecar</h4><p>As mentioned in the earlier post, my project was inspired by the <a href="https://mit-racecar.github.io/">MIT Racecar</a>, which is a research platform used in multiple courses at the Massachusetts Institute of Technology. Their website won’t help you much. It only contains very basic information about the car and its hardware components.</p><p>So a good place to start is by going through this <a href="https://mit-racecar.github.io/6.141-spring-2016-team-5-documentation/">series of blog posts</a>. These were posted by the teaching assistants (TAs) of <em>Robotics: Science and Systems, </em>one of the courses which uses this platform. Its ok if you don’t understand everything in the first read. The blog posts will serve as a guideline for your own development. The blog posts start off with basic software setup, then gradually guide you through implementing wall following, obstacle detection, localization and path planning.</p><h4>F1/10</h4><p><a href="http://f1tenth.org/">F1/10</a> is a competition which involves designing, building, and testing an autonomous 1/10th scale F1 race car. The car platform used for this competition is inspired by the MIT Racecar and is almost the same, barring few changes. They also reuse most of the <a href="https://github.com/mit-racecar">software developed by the MIT Racecar team</a> for simulation, localization and motor control. The idea of this competition is to have a common hardware platform for all competing teams and judge them on how well their cars drive around the racetrack.</p><p>Their website has excellent documentation which includes build instructions, bill of materials, reference manual (don’t miss this!) and tutorials (videos). They also have an active forum where one can seek help with issues.</p><h4>HyphaROS</h4><p><a href="https://github.com/Hypha-ROS/hypharos_racecar">HyphaROS Racecar</a> is another open source project inspired by the MIT Racecar. They have used hardware substitutions to lower the cost of the car. Specifically they use a cheaper LIDAR and onboard computer. These substitutions helped me lower the cost of the car to below $1000. They have a very good <a href="https://github.com/Hypha-ROS/hypharos_racecar/blob/ver.1-release/document/Hypha-ROS-RaceCar-Tutorial_V1.1.pdf">tutorial</a> on building the car. The creators of this project were kind enough to help me with a few issues that I had raised on their github repo.</p><p>Recently they released a 1/20th scale version of the car, further bringing down the cost. Checkout <a href="https://github.com/Hypha-ROS/hypharos_minicar">HyphaROS Minicar</a>.</p><h4>JetsonHacks</h4><p><a href="https://www.jetsonhacks.com/">JetsonHacks</a> is a community centred around building projects using the NVIDIA Jetson computing platform. The MIT Racecar uses Jetson TX1 kit as its onboard computer. Newer projects, like F1/10, use Jetson TX2. This forum has 2 series of blog posts on building an MIT style racecar:</p><ol><li><a href="https://www.jetsonhacks.com/category/robotics/jetson-racecar/">Jetson Racecar</a> (Older version)</li><li><a href="https://www.jetsonhacks.com/category/robotics/racecarj/">RacecarJ</a> (Newer version)</li></ol><p>The 2 versions mainly differ on the mounting of electronics components and motor controller. The newer version uses an open source motor controller, which is also used by MIT Racecar and F1/10.</p><p>Both the projects have tutorials on building the hardware platform and a few posts on the software stack. I would recommend you to go through the videos associated with each blog post to get an idea of how different components connect with each other.</p><p>These resources should help you with assembling the hardware components of the car. You will need to get familiar with the Robot Operating System (ROS), which serves as the software backbone of the car. ROS will help you read data from sensors (using open source ROS drivers), implement localization and path planning algorithms (using open source ROS packages) and motor control. This will be the subject of my next blog post.</p><p><strong>Note</strong>: I am exploring applications of autonomous robots in industries such as logistics, warehousing and agriculture. My objective is to find a use case and then build an autonomous robot for it. If you are interested in this or would just like to have a chat then reach out to me on <a href="https://www.linkedin.com/in/subodh-malgonde/">LinkedIn</a>. I would be happy to talk :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f1c0df54b6e1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building an actual self driving car]]></title>
            <link>https://medium.com/@subodh.malgonde/building-an-actual-self-driving-car-53f67ca41566?source=rss-5fc94a696f7e------2</link>
            <guid isPermaLink="false">https://medium.com/p/53f67ca41566</guid>
            <category><![CDATA[robotics]]></category>
            <category><![CDATA[robot-operating-system]]></category>
            <category><![CDATA[self-driving-cars]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[sensors]]></category>
            <dc:creator><![CDATA[Subodh Malgonde]]></dc:creator>
            <pubDate>Mon, 26 Nov 2018 11:58:13 GMT</pubDate>
            <atom:updated>2019-07-29T05:22:15.417Z</atom:updated>
            <content:encoded><![CDATA[<h3>How I built a self driving car, which roams around in my house</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b-9jkKA7hTYPIfFLTJ4zig.png" /><figcaption>A 1/10th scale self driving car</figcaption></figure><p>It has been a long time since I wrote my last blog post. I feel very excited to write this one as this is about the hard work that I have been putting in for the last 4 months.</p><h4>Background &amp; Motivation</h4><p>I have spent most part of my last 2 years teaching myself machine learning, convolutional neural networks and robotics. I did this through a combination of online courses, personal projects and mentoring/teaching assignments. My last teaching assignment was as an instructor on self driving cars. There I spent about 4 months taking classroom sessions on the sub-components involved in developing a self driving car.</p><p>My mentoring and teaching assignments gave me a good grasp of the underlying theoretical concepts that go in to building a self driving car. They kindled a desire in me to work on an actual car and not limit my experience to theory. However I was not confident I could actually build one.</p><p><em>What hardware platform should be used as the base? Which software stack to use? What sensors to buy? How much would this cost? How much time would it take? Would I be able to do it by myself? Whom to ask for help if I get stuck on something?</em> The task seemed to be too daunting to be taken upon.</p><p>While searching for clues online I stumbled upon the <a href="https://mit-racecar.github.io/">MIT RACECAR</a>. It houses state-of-the-art sensors and computing hardware on top of a 1/10th scale (meaning 1/10th the size of an actual car) RC car.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zKLQb1XDVBQn7jceP78JsQ.png" /><figcaption>The MIT RACECAR</figcaption></figure><p>This platform is used in multiple courses at the <a href="http://www.mit.edu/">Massachusetts Institute of Technology</a>. One of these courses is <em>Robotics: Science and Systems. </em>This course teaches the foundation of robotics — perception, motion planning and control. The teaching assistants of this course were kind enough to share their experience working on this platform in a <a href="https://mit-racecar.github.io/6.141-spring-2016-team-5-documentation/">series of blog posts</a>. The course instructors have open sourced some components of the software stack and all the hardware stack. You can find them <a href="https://github.com/mit-racecar/">here</a>.</p><p>There are other projects, inspired by the MIT RACECAR , which have some documentation to help you build the car, at least as far as the hardware part is concerned. This was perfect for me. The blog posts and online repositories <strong>did not</strong> have all the necessary information, but sufficient enough to get me started.</p><h4>Timeline &amp; Budget</h4><p>The cost of the MIT RACECAR is about <strong>$4500!!!</strong>. This was way out of my budget. Taking a cue from other similar projects I figured I could make some hardware substitutions to bring the cost down to <em>less than $1000 </em>(more on this in a later post).</p><p>Time wise I had estimated that it would take me about <strong><em>2 months</em></strong> to develop this car. It took me longer than estimated to get fully familiar with the <a href="http://ros.org/">Robot Operating System</a> or ROS in short, which makes up the software backbone. Unexpected component failures and delay in getting the sensors (they had to be imported) further added to the development time. I also spent a considerable time figuring out the path planning and motor control of the car. Any autonomous robot given its current location and a goal, needs to plan a path which takes into account its physical limitations. A car has a finite turning radius and it cannot move freely in all directions. This puts limitations on paths which are realizable by the car. Almost all the open source path planners are designed for omnidirectional robots i.e. robots which can move freely in any direction. This was the tricky part but I eventually figured it out (more on this in a later post). <strong>Given all these factors, it actually took me 4 months to develop this car!! </strong>Twice the amount of time I had budgeted!!</p><h4>The Result</h4><p>The result was well worth all the time spent :) Checkout this video where I make the car roam around in my house:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fh8Mnkqyv338%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dh8Mnkqyv338&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fh8Mnkqyv338%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/80f638a0a1fa935df60360759e1c80e9/href">https://medium.com/media/80f638a0a1fa935df60360759e1c80e9/href</a></iframe><p>You can see that the car has the ability to go backward and correct itself if it overshoots or misses its path. I am especially proud of the way it performs a series of forward &amp; backward turns to make a 180 degree turnaround after having reached one end of the house.</p><h4>Next</h4><p>I will follow this post with a series of blog posts describing my experience developing the various subsystems of this car. Specifically I will blog about these topics:</p><ul><li>Other similar projects, forums, tutorials and blog posts which helped me in this process. See <a href="https://medium.com/@subodh.malgonde/resources-to-help-you-build-an-indoor-self-driving-car-f1c0df54b6e1">this post</a>.</li><li>Hardware substitutions to reduce the cost to less than $1000. See <a href="https://medium.com/@subodh.malgonde/resources-to-help-you-build-an-indoor-self-driving-car-f1c0df54b6e1">this post</a>.</li><li>The Robot Operating System (<a href="http://ros.org/">ROS</a>), simulation and visualization tools</li><li>Open source packages for localization, path planning and control</li><li>Figuring out the path planning and motor control part of the project</li></ul><p><strong>EDIT</strong>: Since I am engaged in other endeavours right now, I won’t be able to fulfil the above promise. So I will just post the code and a google doc containing my development log here.</p><h3>Development Log</h3><p>Google doc where I documented all my steps and findings:<br><a href="https://docs.google.com/document/d/1Goass2MHtOLEt76rTJ7ziMXQQR4XG6Ni1m3ht_AThY0/edit?usp=sharing">https://docs.google.com/document/d/1Goass2MHtOLEt76rTJ7ziMXQQR4XG6Ni1m3ht_AThY0/edit?usp=sharing</a></p><h3><strong>Source Code</strong></h3><p>1. ROS Project: <a href="https://bitbucket.org/subodhmalgonde/racecar/">https://bitbucket.org/subodhmalgonde/racecar/</a><br>2. Localization: <a href="https://github.com/subodh-malgonde/particle_filter">https://github.com/subodh-malgonde/particle_filter</a><br>3. Motor controller driver: <a href="https://github.com/subodh-malgonde/vesc">https://github.com/subodh-malgonde/vesc</a><br>4. ROS plumbing: <a href="https://github.com/subodh-malgonde/racecar">https://github.com/subodh-malgonde/racecar</a><br>5. Simulator (Gazebo): <a href="https://github.com/subodh-malgonde/racecar-simulator">https://github.com/subodh-malgonde/racecar-simulator</a><br>6. IMU ROS package: <a href="https://github.com/subodh-malgonde/razor_imu_9dof">https://github.com/subodh-malgonde/razor_imu_9dof</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=53f67ca41566" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Transfer learning using Tensorflow]]></title>
            <link>https://medium.com/@subodh.malgonde/transfer-learning-using-tensorflow-52a4f6bcde3e?source=rss-5fc94a696f7e------2</link>
            <guid isPermaLink="false">https://medium.com/p/52a4f6bcde3e</guid>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[transfer-learning]]></category>
            <dc:creator><![CDATA[Subodh Malgonde]]></dc:creator>
            <pubDate>Fri, 18 May 2018 06:17:19 GMT</pubDate>
            <atom:updated>2018-05-18T06:24:39.697Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f2_PnaPgA9iC5bpQaTroRw.png" /></figure><p>This is a short blog post on using the Tensorflow API to perform transfer learning using a pre-trained model. This is a very common use case for machine learning engineers, but surprisingly there are very few resources which explain how to implement this using Tensorflow.</p><p>This gist summarises the code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b13b2fd234efad4aaa92d57fdf54641c/href">https://medium.com/media/b13b2fd234efad4aaa92d57fdf54641c/href</a></iframe><p>Hope this helps you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=52a4f6bcde3e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using convolutional neural networks for image segmentation — a quick intro.]]></title>
            <link>https://medium.com/good-audience/using-convolutional-neural-networks-for-image-segmentation-a-quick-intro-75bd68779225?source=rss-5fc94a696f7e------2</link>
            <guid isPermaLink="false">https://medium.com/p/75bd68779225</guid>
            <category><![CDATA[segmentation]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[self-driving-cars]]></category>
            <category><![CDATA[convolutional-network]]></category>
            <dc:creator><![CDATA[Subodh Malgonde]]></dc:creator>
            <pubDate>Sun, 24 Dec 2017 12:13:22 GMT</pubDate>
            <atom:updated>2018-02-23T04:26:08.601Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently I implemented image segmentation as a part of my <a href="https://in.udacity.com/course/self-driving-car-engineer-nanodegree--nd013">Self Driving Car Nanodegree Program</a>. The purpose of this post is to provide a quick introduction to image segmentation for people with background in convolutional neural networks (CNNs).</p><p>Segmentation refers to the process of mapping each pixel in an image to an object class. Here is an example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hf6J8vsX7gmHhZnbPa4y9g.png" /><figcaption>Image source: <a href="https://devblogs.nvidia.com/parallelforall/image-segmentation-using-digits-5/">Nvidia dev blog</a></figcaption></figure><p>In the above image you can see that all cars are labelled with the same colour. Each object class has been segmented separately. As one can imagine, this is a much more complex problem as compared to the classification problem.</p><p>We performed segmentation using a technique called Fully Convolutional Networks (FCNs), first introduced in this research paper: <a href="https://people.eecs.berkeley.edu/~jonlong/long_shelhamer_fcn.pdf">Fully Convolutional Networks for Semantic Segmentation</a>. <strong>This is one of the few readable research papers which does not overwhelm you with mathematical symbols, terminology and deep learning jargon.</strong> Do give it a read if you have used convolutional neural networks (CNNs) before.</p><p>I’ll try to introduce 2 important techniques which allow you to convert an pre-trained CNN, trained for image classification, to an FCN which can be used for image segmentation.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2F7b0181%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2F7b0181%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/748a06e9019942f2677bba917ef55804/href">https://medium.com/media/748a06e9019942f2677bba917ef55804/href</a></iframe><h4>Converting fully connected (FC) to convolutional (CONV) layers</h4><blockquote>It is worth noting that the only difference between FC and CONV layers is that the neurons in the CONV layer are connected only to a local region in the input, and that many of the neurons in a CONV volume share parameters. However, the neurons in both layers still compute dot products, so their functional form is identical. Therefore, it turns out that it’s possible to convert between FC and CONV layers.</blockquote><blockquote>Source: <a href="http://cs231n.github.io/convolutional-networks/#convert">cs231n lecture notes</a>.</blockquote><p>Lets say you have a convolutional layers which outputs a volume of size <em>7×7×512</em> and this is followed by a FC layer with 4096 neurons i.e. the output of the FC layers is 1x4096 for a single image input.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4khobU2QrwUKlMopA2w9sA.png" /></figure><p>You can replace this FC layer with a convolutional layer with filter size <em>7x7</em>, padding of zero, stride of <em>1</em> and output depth of <em>4906</em>. You can do a quick calculation to see that the output will simply be <em>1x1x4096, </em>equivalent to the output of the FC layer.</p><h4>Practical utility of FC to CONV conversion</h4><p>Lets consider the a network architecture, which takes a <em>224 x 224 x 3 </em>image and then uses a series of <em>CONV, POOL </em>and<em> FC </em>layers to reduce the image to an activations volume of size <em>1000 </em>i.e. classification scores for 1000 object classes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LNi7r7NKB5av_RGqxxhwGQ.png" /><figcaption>Example CNN architecture</figcaption></figure><p>In the above architecture you can observe that the output of layer <em>Conv5</em> is a volume of size <em>7x7x512</em>. It is followed by 2 <em>FC</em> layers having <em>4096</em> neurons each. At the end of the 5th layer, the above architecture downsamples the input spatially by a factor of <em>2⁵</em>, making the final spatial size <em>224/2/2/2/2/2 = 7.</em></p><blockquote>Disclaimer: Most of the text in this section has been taken from <a href="http://cs231n.github.io/convolutional-networks/#convert">Stanford cs231n course website</a>.</blockquote><p>We can convert each of these three FC layers to CONV layers as described above:</p><ul><li>Replace the first FC layer that looks at [7x7x512] volume with a CONV layer that uses filter size <em>7x7 </em>and output depth of<em> 4096 </em>giving output volume <em>[1x1x4096]</em>.</li><li>Replace the second FC layer with a CONV layer that uses filter size <em>1x1 </em>and output<em> </em>depth of<em> 4096, </em>giving output volume <em>[1x1x4096]</em></li><li>Replace the last FC layer, similarly, with a CONV layer that uses filter size <em>1x1 </em>and output<em> </em>depth of<em> 1000, </em>giving output volume <em>[1x1x1000]</em></li></ul><p>For example, if <em>224x224</em> image gives a volume of size <em>[7x7x512]</em> — i.e. a reduction by 32, then forwarding an image of size <em>384x384</em> through the converted architecture would give the equivalent volume in size <em>[12x12x512]</em>, since <em>384/32 = 12</em>. Following through with the next 3 CONV layers that we just converted from FC layers would now give the final volume of size <em>[6x6x1000]</em>, since <em>(12–7)/1 + 1 = 6</em>. Note that instead of a single vector of class scores of size <em>[1x1x1000]</em>, we’re now getting an entire 6x6 array of class scores across the <em>384x384</em> image.</p><blockquote><em>Evaluating the original ConvNet (with FC layers) independently across 224x224 crops of the 384x384 image in strides of 32 pixels gives an identical result to forwarding the converted modified ConvNet (with only CONV layers) one time.</em></blockquote><p><strong>How do you interpret this output of size 6x6x1000 for each image? </strong>One can think of each of the 6x6 slices as downsampled heatmap for each of the 1000 object classes!!! You can re-size this downsampled heatmap, using interpolation, to the size of the original image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/998/1*rmwsWzeGU0zkqY4xBtKOzw.jpeg" /><figcaption>Original Image and overlayed heatmap. Image source: <a href="https://mathematica.stackexchange.com/questions/144060/sliding-fullyconvolutional-net-over-larger-images/148033#148033">StackExchange</a>.</figcaption></figure><p>You can overlay this heatmap on top of the original image to observe the location of that object in the image. Above you can see one such heatmap for the class ‘dog’. If you would like to look at a code example for this, please have a look at <a href="https://github.com/m2dsupsdlclass/lectures-labs/blob/master/labs/05_conv_nets_2/Fully_Convolutional_Neural_Networks_rendered.ipynb">this implementation</a>.</p><h4>From coarse heatmaps to pixel level segmentation</h4><p>Although a good start, the heatmap produced using the technique described above is quite coarse. We need a way to efficiently upsample the coarse heatmap. This is where <strong><em>transposed convolutional layers</em></strong> come into play.</p><p>Transposed convolution works exactly the opposite of a normal convolution, i.e. from something that has the shape of the output of some convolution to something that has the shape of its input while maintaining a connectivity pattern that is compatible with said convolution.</p><p>Here is an example of a transposed convolution which upsamples the input by 2x.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/344/1*KGrCz7aav02KoGuO6znO0w.gif" /><figcaption>Transposed Convolution. Source <a href="https://github.com/vdumoulin/conv_arithmetic">Github</a></figcaption></figure><p>The input is 2x2 while the output is 4x4. This is achieved by heavily zero padding the input. <strong>This is just one of the ways to perform this upsampling. </strong>There are other transposed convolutional techniques, here is a good source on this — <a href="http://deeplearning.net/software/theano/tutorial/conv_arithmetic.html#transposed-convolution-arithmetic">Transposed Convolution Arithmetic</a>.</p><p>You can use such transposed convolutional layers to upsample the coarse heatmap to the size of the original input. <strong>Then you can train this neural network end to end so that it learns to output a pixel level segmented image. </strong>But how does the training label data look like?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vf0_y-P0Hvu2OU1KJRy70w.png" /><figcaption>Training data — input</figcaption></figure><p>Lets say you want to train such a network to segment the road area from given a image, like the one posted above. The label looks something like the image below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*NuhO1tO243IjY_7gAVqk_A.png" /><figcaption>Training data — label</figcaption></figure><p><strong>You need to pre-process the label image so that each pixel value is equal to the object class number, so that you can use the softmax entropy loss function for training.</strong></p><p>Here are some sample outputs from my network. Code available <a href="https://github.com/subodh-malgonde/semantic-segmentation">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*NK5EPlzi0vxvrsBN1LX_nw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*X3RSYFWLAL-oPr4oyhRHbg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*p6AxhmIsOL3S0wpGDtjvFA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*1gbK7WwYwR4erMPPAG25eg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*q0rOdFfAH-ZliCRuZpI_3w.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=75bd68779225" width="1" height="1" alt=""><hr><p><a href="https://medium.com/good-audience/using-convolutional-neural-networks-for-image-segmentation-a-quick-intro-75bd68779225">Using convolutional neural networks for image segmentation — a quick intro.</a> was originally published in <a href="https://medium.com/good-audience">Good Audience</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Teaching a car to mimic your driving behaviour]]></title>
            <link>https://medium.com/@subodh.malgonde/teaching-a-car-to-mimic-your-driving-behaviour-c1f0ae543686?source=rss-5fc94a696f7e------2</link>
            <guid isPermaLink="false">https://medium.com/p/c1f0ae543686</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[autonomous-cars]]></category>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[self-driving-cars]]></category>
            <dc:creator><![CDATA[Subodh Malgonde]]></dc:creator>
            <pubDate>Tue, 10 Jan 2017 19:06:36 GMT</pubDate>
            <atom:updated>2017-01-10T19:28:31.723Z</atom:updated>
            <content:encoded><![CDATA[<h4>An demonstration of using deep networks for behavioral cloning</h4><p>This post is about a very interesting project I did as a part of <a href="https://www.udacity.com/drive"><em>Udacity&#39;s Self Driving Car Nano Degree</em></a>. The task was to train a car to drive by itself in a simulated environment (like a video game). The idea is to first use the simulator in the manual mode, where the simulator records data like camera images, steering angle, speed, etc. as you drive down the track. Then use this data to train a deep neural network to drive the car when provided with a new input feed from the cameras. To keep things simple only the steering angle needed to be predicted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ub-duJjpjLkKVDPNDs4U3A.png" /><figcaption>Screenshot of the simulator used in this project</figcaption></figure><p>If you just want to jump straight to the demo video- here is the <a href="http://%3Ciframe%20width=%22560%22%20height=%22315%22%20src=%22https://www.youtube.com/embed/jFrpmZDU10k%22%20frameborder=%220%22%20allowfullscreen%3E%3C/iframe%3E">YouTube link</a>.</p><p><strong><em>About the setup</em></strong></p><p>The car is equipped with 3 cameras at the front. One each on the left, right and center. The left and right cameras point straight, along the length of the car.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*a_V1uphZnub4Vce_Nmh1DQ.png" /><figcaption>Images from 3 cameras</figcaption></figure><p>Each image is a 160 by 320 color image. Here are some sample images recorded by the cameras.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*womgE81JTpvw2RpQ6PY71Q.png" /><figcaption>Sample images from the dataset</figcaption></figure><p><strong><em>Training for recovery</em></strong></p><p>As you can imagine, if you record the training data driving through the center of the track, then most of your recorded steering angles will be close to zero. This data will have bias for driving straight. Since the training track has more left turns than right, it also had a slight bias for turing left.</p><p>To overcome this bias you could employ 2 approaches. One of the approach is to deliberately drive towards the edge of the track and record the data while you make the car recover to the center of the track. This requires high precision. One needs to ensure that only the recovery is recorded and not the part where you drive towards the edge. Sounds easy but is very difficult to execute in practice. I tried recording recovery data multiple times but could only manage to make the car wobble and veer off the track.</p><p>The other approach is to use the images from the left and right cameras to simulate recovery. You can do this because the left and right camera images are like parallel transformations of the car. The main idea being the left camera has to move right to get to the center, and right camera has to move left. So you could take the left camera image and add a constant value to steering (positive steering implies turing right) and do the opposite for the right camera image. The second approach is well demonstrated in <a href="http://images.nvidia.com/content/tegra/automotive/images/2016/solutions/pdf/end-to-end-dl-using-px.pdf">this paper by NVIDIA</a>. This approach is simple, can be implemented in code and it worked really well for me!</p><p><strong>Getting more data</strong></p><p>One of the issues with working on deep neural networks is that they require a lot of training data. For complex problems it could be millions of data points. When trained on a small data the network tends to overfit i.e. it fails to generalise the solution to new data. To get more data one could either record more training data by driving more laps on the track or generate new data by augmenting the existing data.</p><p>The first approach has its limitations since a human can only drive so many laps without introducing errors in the dataset. The second approach -augmentation- is simple, can be implemented in code and one can practically generate an infinite amount of training data. I have to thank <a href="https://chatbotslife.com/using-augmentation-to-mimic-human-driving-496b569760a9#.d779iwp28"><em>this fantastic blog post</em></a> for providing ideas for augmentation techniques for this problem.</p><p>I used only 2 augmentation techniques, since they were sufficient for this problem:</p><ol><li><strong><em>Flipping the images horizontally</em></strong><br>Since the dataset has a lot more images with the car turning left than right(because there are more left turns in the track), you can flip the images horizontally to simulate turing right and also reverse the corresponding steering angle.</li><li><strong><em>Brightness Adjustment</em></strong><br>In this you adjust the brightness of the image to simulate driving in different lighting conditions</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*NhgdMaEPIUV0o9i3kTZPlA.png" /><figcaption>Augmentation Techniques</figcaption></figure><p>The sub-image on the top left in the above image, is from the center camera. The one to its right is from the left camera with an adjusted steering angle. The one on the bottom left if the horizontally flipped version of the center camera, with its steering angle reversed. The last one is a brightness adjusted image (random brightness adjustment).</p><p><strong><em>Training the Network</em></strong></p><p>I used a 5 layer neural network for this project. The technical details of my neural network and code can be found in <a href="https://github.com/subodh-malgonde/behavioral-cloning">this github repository</a>.</p><p>Before starting this project I had imagined that I would need powerful hardware, with GPUs and lots of RAM, to train my neural network but as it turned out I could just use my Macbook to train it. It took only 15 minutes for my network to converge to a solution.</p><p><strong><em>Network Performance</em></strong></p><p>Here is the video of the car driving itself on the track. The numbers you see on the right are the steering angles and throttle values sent by the code to the car.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FkElUwEoZ7P0%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DkElUwEoZ7P0&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FkElUwEoZ7P0%2Fhqdefault.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/08ad493566c2019701f85f8307fca092/href">https://medium.com/media/08ad493566c2019701f85f8307fca092/href</a></iframe><p><strong><em>Performance on an unseen track</em></strong></p><p>The true test of a neural network is how well it performs on unseen data i.e. data not used in training. To evaluate this the simulator had a second track which was very different from the one used for training. It was darker, had slopes while the first track was more or less flat, had sharper turns and more right turns as compared to the first track. The network had never seen data from this track. However some of these differences were accounted for in the network due to image augmentation techniques described above.</p><p>Here is a video of the car driving itself on the second track.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FjFrpmZDU10k%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DjFrpmZDU10k&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FjFrpmZDU10k%2Fhqdefault.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/d300f54085523132c0cb823687854f38/href">https://medium.com/media/d300f54085523132c0cb823687854f38/href</a></iframe><p>Code available at <a href="https://github.com/subodh-malgonde/behavioral-cloning">https://github.com/subodh-malgonde/behavioral-cloning</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c1f0ae543686" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to get started with machine learning?]]></title>
            <link>https://medium.com/@subodh.malgonde/how-to-get-started-with-machine-learning-4edec16f5160?source=rss-5fc94a696f7e------2</link>
            <guid isPermaLink="false">https://medium.com/p/4edec16f5160</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[getting-started]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Subodh Malgonde]]></dc:creator>
            <pubDate>Sun, 26 Jun 2016 17:37:58 GMT</pubDate>
            <atom:updated>2016-06-26T18:27:48.178Z</atom:updated>
            <content:encoded><![CDATA[<h4>Why machine learning?</h4><p>March 2016, there was a lot of buzz around Google’s AlphaGo program taking on world champion Lee Se-dol at the game of Go, a board based game that I had no idea about. <a href="http://www.theverge.com/2016/3/9/11184362/google-alphago-go-deepmind-result">AlphaGo won a series of 5 games 4–1 against Se-dol.</a> ‘What is all the fuss about?’, I thought to my programmer self, ‘Code the rules of the game into a program and make the best possible decision on every move’. But this was different. Go was considered to be one of the toughest games to teach to a computer. Computers match or surpass top humans in a wide variety of games: Othello, Scrabble, backgammon, poker, even Jeopardy. But not Go. <a href="http://www.wired.com/2014/05/the-world-of-computer-go/">As recently as 2014, the automation of expert-level Go remained one of AI’s greatest unsolved riddles</a>.</p><p>Apparently folks at <a href="https://deepmind.com/">Deep Mind</a>, which developed AlphaGo and they were later acquired by Google, had trained a computer program to teach itself Go. They had apparently not explicitly coded the rules of the game into the program, but had programmed it to learn the game by trial and error. They called it deep reinforcement learning. <a href="http://www.theverge.com/2016/3/9/11185030/google-deepmind-alphago-go-artificial-intelligence-impact">This was considered to be a huge event.</a> Everything sounded like rocket science to me.</p><p>There was a <a href="https://techcrunch.com/search/machine+learning#stq=machine%20learning&amp;stp=1">sudden surge</a> in articles about artificial intelligence and machine learning. There was <a href="https://techcrunch.com/2016/05/29/robots-add-real-value-when-working-with-humans-not-replacing-them/">talk</a> of super intelligent bots taking away all our jobs. Elon Musk even termed AI as the biggest <a href="https://en.wikipedia.org/wiki/Existential_risk_from_artificial_general_intelligence">existential threat</a> to humanity!! Was it true? How had the world come to this? What else can be achieved through machine learning? Can I make use of it in my work? I had so many questions. Hence I resolved to teach myself sufficiently to be able to understand all this.</p><h4>So where should one start?</h4><p>Don’t waste any time looking further and take <a href="https://www.coursera.org/learn/machine-learning">this course</a> on <a href="https://www.coursera.org/">Coursera</a>. It is a introductory level course on machine learning. Starting with linear regression, the course gradually introduces you to advanced machine learning topics. The course contents are divided in 10 `weeks`. Each ‘week’ has video lectures of about 2 hours and an assignment, which can take up to 3 hours to be done depending on your understanding of course materials . The course is self paced and you don’t have to stick to the ‘week’ schedule. I completed the course in 2 weeks (I was not working and as a result I had a lot of free time).</p><p>The course is not mathematically rigorous and is only designed to give you a flavor of various machine learning algorithms and topics. However one could feel a bit lost without knowledge of linear algebra, statistics and probability. If you have studied these topics before you can quickly brush up your knowledge here— <a href="http://cs229.stanford.edu/section/cs229-linalg.pdf">linear algebra review</a>, <a href="http://cs229.stanford.edu/section/cs229-prob.pdf">probability review</a> and <a href="http://www.ssc.wisc.edu/~ctaber/410/statrev">statistics review</a>. I had studied these topics as a part of my undergrad, which was 4 years prior to taking this course, and yet I could understand the course contents without revising these topics. I only occasionally needed to google some concepts from these topics.</p><p>To complete the assignments you would be using Octave or MATLAB. You will do fine if you have used either of these software packages before. Don’t sweat if you haven’t, the course only makes use of very basic functionality and you can quickly learn to use these from online tutorials. I had used MATLAB before (again while pursuing my undergrad) but I decided to use Octave since it is free.</p><h4>Did taking this course help?</h4><p>Definitely. At least now everything doesn’t sound like rocket science to me. I can understand research papers and publications. Blog posts and news articles make more sense to me. At the startup, where I am working, I have already deployed a <a href="https://en.wikipedia.org/wiki/Binary_classification">binary classification</a> system, based on <a href="https://en.wikipedia.org/wiki/Supervised_learning">supervised learning</a>, in production. In the machine learning universe it is fairly “hello world”-ish but it serves our purpose.</p><h4>What next?</h4><p>This <a href="https://www.quora.com/I-have-completed-Andrew-Ngs-Coursera-class-on-Machine-Learning-What-should-I-do-next-What-*can*-I-do-next">question</a> on Quora serves as a very useful guide on more advanced topics which can be pursued after the introductory course.</p><p>If you are a python developer and are interested in seeing the machine learning algorithms in action you can start with <a href="http://scikit-learn.org/stable/">scikit-learn</a>. Its an open source python library and provides a lot of machine learning algorithms out of the box. <a href="https://www.dataquest.io/">DataQuest</a> has courses on using python for data science.</p><p>If you’re interested in a career in data science, many people go on from the introductory machine learning course to take the <a href="https://www.coursera.org/specializations/jhu-data-science/1">Data Science specialization</a>. According to Andrew Ng, the professor for this course, many students are successfully using this combination to start off data science careers.</p><p><a href="https://www.kaggle.com/about">Kaggle</a> is a community for data scientists and hosts data science competitions. If you are not sure what project to work on, Kaggle competitions can be a great way to start. Before working on Kaggle competitions you will have to understand and learn things like exploratory data analysis, preparing and cleaning your data. <a href="https://www.dataquest.io/">DataQuest</a> is a good place to get started with all this.</p><p>Happy learning :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4edec16f5160" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Communication between components in Android — Part 1]]></title>
            <link>https://medium.com/@subodh.malgonde/communication-between-components-in-android-part-1-79eca2fd7895?source=rss-5fc94a696f7e------2</link>
            <guid isPermaLink="false">https://medium.com/p/79eca2fd7895</guid>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Subodh Malgonde]]></dc:creator>
            <pubDate>Mon, 07 Mar 2016 10:07:30 GMT</pubDate>
            <atom:updated>2016-03-07T10:13:05.625Z</atom:updated>
            <content:encoded><![CDATA[<p>This post was originally posted <a href="http://magic.peppertap.com/2015/12/08/communication-between-components-in-android-part-1/">here</a>.</p><p>Passing data between various components in Android is one of the most common and cumbersome requirements in almost all projects. There can exist multiple components in an app that need to update their states based on changes happening elsewhere. At the very least one needs to exchange data between</p><ul><li>Activity &lt;-&gt; Fragment</li><li>Fragment &lt;-&gt; Fragment</li><li>Fragments/Activities &lt;-&gt; Services</li><li>Any Component &lt;-&gt; database</li></ul><p>In this post, I try and illustrate, through an example of a fragment to activity communication system, why the traditional methods of<strong>Interface and listener patterns</strong> and <strong>calls to the containing activity via getActivity()</strong>, are messy, complicated and a downright maintenance nightmare.</p><h3>Strong dependencies</h3><p>Both the traditional methods of Interface and listener patterns and calls to the containing activity via getActivity(), create strong dependencies between components, making it difficult to change one part of the application without affecting another.</p><p>This <a href="https://corner.squareup.com/2012/07/otto.html">blog post by Jake from Square</a> describes the challenges of creating unmanageable dependencies with the current Android framework.</p><h3>Boilerplate</h3><p>The listener pattern introduces boilerplate with its interface and <em>activity implements interface</em> declarations. Here is an illustration of the boilerplate introduced by the interface-listener pattern both in the activity as well as the fragment classes.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1a55a1c6646eee2b07b8b161efb7f0a6/href">https://medium.com/media/1a55a1c6646eee2b07b8b161efb7f0a6/href</a></iframe><p>Activity to fragment communication is butt ugly. One has to first find the fragment using the fragment manager, check if it is being shown or not and then call methods on that fragment.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a36d7137c12e47299d346a52c98ddfa7/href">https://medium.com/media/a36d7137c12e47299d346a52c98ddfa7/href</a></iframe><p>When it comes to passing data between fragments, things get out of hand really quickly. At the very least it involves dealing with the combined complexity of fragment to activity and activity to fragment communication.</p><h3>Asynchronous communication</h3><p>One of the more common development scenarios is the use of a database. In such cases one wants the read/write to happen on a separate thread and updates on the UI to be done when the read/write has been completed. This would involve even more boilerplate if one uses AsyncTask, or worse, ones own thread management to perform the asynchronous operation.</p><h3>The solution</h3><p>Publish/subscribe models, also known as pub-sub models, try to avoid this tight integration by relying on an event bus. An extremely detailed post describing the use of an event bus for communication is available<a href="https://github.com/codepath/android_guides/wiki/Communicating-with-an-Event-Bus">on github</a>.</p><p>Publishers are responsible for posting events in response to an action, while subscribers respond to these events. The event acts as an intermediary for exchanging information, isolating and minimizing the dependencies between each side. In this way, message buses create a communication pipeline that is intended to help make app codebases more maintainable and scalable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/0*zLbI6Pp8pU8plRAh.png" /></figure><p>(Image Source: <a href="https://medium.com/google-developer-experts/event-driven-programming-for-android-part-i-f5ea4a3c4eab#.c6uuzzdld">This Medium post</a>)</p><p>Communication between components in the event bus pattern boils down to these four simple steps.</p><ul><li>Define an event</li><li>Register a subscriber to this event</li><li>Post an event</li><li>Receive the event</li></ul><h3>Example</h3><p>In a typical e-commerce application here’s how one would go about using event bus for the simple case of adding items to cart.</p><ul><li>An event <em>add to cart</em> is defined.</li><li>The fragment that contains the cart items is a subscriber.</li><li>Fragment that displays the catalog posts an <em>add to cart</em> event on user action. The payload for which contains the information about the product to be added to the cart.</li><li>When the <em>cart fragment</em> receives the event, the cart items, payable amount etc get calculated and updated on the view.</li></ul><h3>Which library to use?</h3><p>There are many Android libraries that help you implement the event bus pattern. Some of the popular ones are <a href="https://github.com/greenrobot/EventBus">EventBus</a>, <a href="https://github.com/ReactiveX/RxJava">RxJava</a> and <a href="https://github.com/square/otto">Otto</a>. At PepperTap we use EventBus, which we found the easiest to setup and use. The number of forks and number of people watching its repo on github gave us the confidence to go ahead with it.</p><p>You can read more about EventBus on their <a href="https://greenrobot.github.io/EventBus/">website</a> or <a href="https://github.com/greenrobot/EventBus">github project</a> or this <a href="http://www.slideshare.net/greenrobot/eventbus-for-android-15314813">slideshow</a>.</p><p>In Part 2 of this post, we’ll illustrate the use of EventBus using a real world example from our very own Android app. Stay tuned.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=79eca2fd7895" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>