<?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 Anupama Rajkumar on Medium]]></title>
        <description><![CDATA[Stories by Anupama Rajkumar on Medium]]></description>
        <link>https://medium.com/@anupamarajkumar?source=rss-6f18fa3a316------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*vlHyh_Qj_DnKjVS40_uqaA.jpeg</url>
            <title>Stories by Anupama Rajkumar on Medium</title>
            <link>https://medium.com/@anupamarajkumar?source=rss-6f18fa3a316------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 14:37:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@anupamarajkumar/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[What They Never Tell You About Moving Abroad]]></title>
            <link>https://anupamarajkumar.medium.com/what-they-never-tell-you-about-moving-abroad-69647a7efff3?source=rss-6f18fa3a316------2</link>
            <guid isPermaLink="false">https://medium.com/p/69647a7efff3</guid>
            <category><![CDATA[students]]></category>
            <category><![CDATA[visa]]></category>
            <category><![CDATA[europe]]></category>
            <category><![CDATA[moving]]></category>
            <category><![CDATA[expat]]></category>
            <dc:creator><![CDATA[Anupama Rajkumar]]></dc:creator>
            <pubDate>Sun, 26 Dec 2021 21:27:35 GMT</pubDate>
            <atom:updated>2021-12-27T11:51:30.693Z</atom:updated>
            <content:encoded><![CDATA[<p>An expat’s guide to moving to a new country — the bureaucratic struggles that no one talks about</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yCY0S9YBMkzRdN15WZkX7A.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@odiin?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Erik Odiin</a> on <a href="https://unsplash.com/s/photos/traveller?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>As a kid growing up in India, I found the stories of family and friends living abroad rather fascinating. I aspired to experience something similar when I grew up. In my mind, it always felt that moving abroad to a new country should be a very smooth process and would be all smiles and hunky-dory all along. This assumption was further corroborated by the happy pictures I encountered on social media of my friends living abroad. I assumed it would be a hassle free task. Just pick up your bags, carry your passport and you are good to go!</p><p>I have been fortunate enough to realize the dreams I harbored as a child. In the past 8 years, I have lived and worked in five different cities across three different countries. While the experiences have been fulfilling and turned me into a fiercely independent woman, I have had my fair share of days when the struggle was real. Unfortunately, it is only the happy moments that make it to Instagram and the real sweat and tears always get left behind. I realize now that it perhaps was not so easy after all for all the friends and relatives who built a life for themselves in a different city or country. So, now when I look at the pictures of my friends who just moved to a new city or country posing happily in front of a beautiful and exotic backdrop, I know what possibly they might also have gone through and can empathize.</p><p>Do not get me wrong! The final result is every bit worth the struggle and the difficult days and it forms a crucial part of the journey and makes it all the more beautiful. Having said that, it does help to be prepared to the best of your abilities before uprooting yourself from your old life and moving on to something new. I made several mistakes, took things for granted and had quite a few assumptions about the process which were shattered along the process and now when I think back it would have been nice to have a checklist handy. Hence, I thought it would be worth sharing a couple of things that one can keep in mind when making the move and what to expect in the initial couple of months so as to not be caught off-guard.</p><p>Every country has its own set of procedures and laws for expats and students and while it is not possible to cover all of them here, these are a few things that I learnt from my experience of moving from India to Europe (can pretty much apply to any country in the EU with minor changes). So here goes, better late than never!</p><p>P.S : These are tips for people moving abroad for a longer and a more permanent duration. These tips might not be relevant to short duration travelers who are looking to travel for less than 90 days.</p><p><strong>The real prep begins much before you actually “move”</strong>: You probably landed that dream job or got accepted at the university you always wanted to study. What next? The real work begins now. The first thought would be to secure a visa. But there is something which comes even before that. It is securing a <em>visa appointment</em>. Visa appointments are not easy to come by, especially for countries like Germany where the wait is longer when compared to other European countries. It becomes even more important when you are on a deadline — to start the job or the university.</p><p>In India, VFS Global provides visa solutions for several countries but when the duration of stay is longer, ie. more than 90 days (also called D-Type visa), the appointments usually have to be made through the respective embassies in India. So,<em> </em><strong><em>the first step is to write to the embassy seeking an appointment as soon as possible.</em></strong></p><p><strong>Getting the documents in order </strong>: Now that securing a visa appointment is out of the way, next step is to prepare the documents. It is generally a boilerplate list of documents typically available on the embassy website viz. suitable photo, education documents, work contract, university acceptance letters, bank statements, proof of accommodation, travel and medical insurance and the likes.</p><p>I would strongly recommend that you book yourself a flight for your travel that can be re-scheduled so that you can easily change the dates if the visa decision does not arrive in time (it typically takes 5 weeks — 2 months for the decision to arrive). Proof of accommodation needs to be arranged as well while applying for visa. More on that in the later sections.</p><p><strong>Arranging for financial proofs</strong> : Financial proofs are one of the most crucial documents and are also one of the most frequent cause for visa refusal. If you are travelling for a job, the work contract that specifies the promised wage should be enough. You may have to show additional funds or should be able to prove enough salary to support your family if they are traveling with you. Please bear in mind that family means spouse and children. Parents are not included (had to be spelled out, because Indians!!).</p><p>If going as a student, loan documents, scholarship letters and bank account statements with sufficient balance as specified by the embassies should do (approximated to ~8k euros per year). If you are specifying a family member as a sponsor, a legal affidavit needs to be prepared as a proof and submitted along with the bank statements of the person who is acting as the sponsor.</p><p><strong>Getting the accommodation situation abroad sorted</strong> : This according to me is the most tricky part. When moving to big cities (Berlin and Budapest in my case), houses are either unavailable or too expensive. This is not to scare or discourage you. It is definitely not easy, but also not impossible. All that you need is patience and perseverance.</p><p>I start with students because that is comparatively easy. The universities can provide housing and many do provide the option of dormitories. These may or may not be immediately available. If the dorms are available for immediate boarding as soon as you land, the university will provide you with the required documents which you can present as a proof of accommodation to the embassy. If you do not find a dorm immediately, typically you will be put on a waiting list and you may have to wait between 3 months to up to 1 semester to find a university housing. Until that works out, you may have to find an alternate solution which can be a shared apartment, a hotel or an AirBnb. Also, you do not have to necessarily live in a university dorm. It is just cheaper to live there but you can always find another apartment for yourself and declare that as your residence address.</p><p>For a working professional, the option of dorm is out of the way and the only way to go is to find an apartment. Now, searching an apartment remotely from a different country is a near impossible task for mainly two reasons. First, because it always good to see the house for yourself to confirm it’s genuineness before signing a rental contract and second, the house owners prefer it that way themselves. They always like to meet the future tenant in person before signing on the dotted lines and handing over the keys. It makes sense but still doesn’t solve the problem of proof of accommodation. This applies to a student looking for an apartment as well. In such cases — for students and professionals, it is recommended to book an AirBnb or a temporary accommodation between 1–3 months which can be submitted as a proof along with a letter from the university or your employer that they will help find a permanent accommodation after you move abroad.</p><p><strong>Show up for the visa appointment </strong>: Submit all the prepared documents at the embassy on the day of the appointment and then wait! For Europe, unlike the US, the visa decisions are not conveyed immediately. Typically, for a D-type visa, the embassy sends all the documents to Europe where the foreign office of the respective country assesses the documents and conveys the decision accordingly through the embassy in India. If some document is missing, the embassy would contact you and you can simply e-mail it to them (you would not have to go there physically for follow up documents). It usually takes anywhere between 1–2 months for the decision to arrive and so it is important to secure the visa appointment accordingly so you do not miss the start of your university or keep your employer waiting for too long.</p><p>Congratulations! your visa has arrived and you’re all good to go! I would give approximately 3–4 months for the whole process from the day you book your visa appointment to the day you finally travel. I know, it is a long process but it is all worth the wait!</p><p>Yay! you have made it to the foreign land and right now you are mostly on your own. As students, you have more help either through the university itself or other bunch of students who would be starting with you. But, as a professional, you basically manage everything on your own. Your employer may or may not support you with the relocation. It is good to get it clarified in advance.</p><p>At this point, I would like to point out that the D-type visa you get is basically a permit for you to enter Europe. It’s duration can vary anywhere between 3 months to 1 year. Once you have entered, before that visa expires, you must go to the foreign office and collect your residence permit — “Aufenhaltstitel” in Germany or “Tartózkodási Engedély” in Hungary. This card basically acts as your identity proof and declares that you are a resident of that European country and specifies your student or working professional status. But, hold on! Only if it was as easy as walking into the foreign office to collect your permit, I would probably not be writing this article!</p><p>Once you have entered Europe, you must prepare and present the following documents to the officer at the foreign office in order to get your residence permit.</p><p><strong>Residence Address Proof </strong>: Once in Europe, each individual must declare and register their residence address. This can be done for example at the respective Bürgeramt in Germany or the foreign office in Hungary. Each city has it’s own office and you can set up an appointment from their website (phew! there are queues and waiting list there too!). In return you get a document — Anmeldebestätigung in Germany which basically registers your address and this is the address where all your bank documents, tax documents and such would arrive. In case you change your house, you must do the process again and register the new address against your name and de-register the old address (Abmeldung).</p><p>We talked about getting accommodation sorted so as to provide proofs for visa earlier. If you have settled for an AirBnb or a temporary accommodation to furnish the proofs, it can get you the visa but not the residence address registration. This is because to register the address, you must show the contract signed between you and the owner of the house which is not possible for temporary accommodations. The proof of university dorm works but if that is not the case then you will have to find a house where you can get a signed rental agreement between you and the owner.</p><p>This is why I earlier mentioned that sorting accommodation is probably the most tedious and jarring task but once done, all the following steps sort themselves out on their own. For a smooth experience, I would recommend using online platforms even before arriving to the new country to conduct thorough research about some properties that you might like to rent. Drop a message or an e-mail to the owner or the renting agency that is managing the property and set up an appointment to personally visit and check the same as soon as you arrive in the city. I would suggest setting up all the appointments in the first few weeks. Usually 4–5 house visits are enough to finalize a house if you know what you are looking for and have already done your research. Also, do keep in mind that the real estate market is very dynamic and the properties get rented out in matter of days. So, keep that deposit handy and sign the papers as soon as possible!</p><p><strong>Telephone number</strong> : It always helps to get a local phone number. Prepaid or postpaid, it’s up to you but generally prepaid is cheaper. Also, internet in EU is much more expensive than in India, so pick wisely :). You will need your address proof document to get a sim card, so go back to step 1, if not done already!</p><p><strong>Bank account</strong> : What do you do without this? The source of your spending and income, probably the most important thing. But, you cannot open a bank account without having a valid address proof. And hence, registering your address should be the first thing you do as soon as you arrive. Delay in that process can lead to delays in the other formalities that follow!</p><p>Also, let me break it to you that banking system in India is much better than that in Europe. The banks here still charge you for many things that Indian banks stopped years ago. So, do your research about which bank offers you best service and charges you the least.</p><p>With these documents in your hand, along with the typical financial proofs, university documents, offer letter etc, you can go to the foreign office and collect your residence permit and come out to experience the European way of living. Oh yeah, by the way! You also have to book an appointment at the foreign office too. Do that well in advance :)</p><p><strong>A tip for managing finances for initial days </strong>: Once in a foreign land, you do not have the security of home and family to fall back upon if things get too out of hand. Finding a house and registering a house can be a daunting task and can drain you physically and emotionally in your initial days. It happens to the best of us. And hence, I would recommend that when moving, keep some spare money that can get you through the initial 2–3 months (~3k euros). This could be a steep ask but it can come in handy when paying deposit for your new house and for emergencies before your bank account is set up. Also, do remember that while you have an option of wiring money from home, it can be a tremendously expensive process. While friends can help with smaller amounts, it gets tricky in cases of bigger setbacks.</p><p><strong><em>A small note on my experience</em></strong></p><p><em>The entire article above is a mish-mash of my own experiences when moving abroad. I moved to Berlin in Oct 2019 as a student. I did not get a student housing until May 2020. Until then I shared an apartment with a couple of other students which we had already looked up earlier before flying in to Germany and set up an appointment for viewing on the same day as we landed. We liked the apartment, signed the contract and got the address registered within the first week as I set up an appointment with the Bürgeramt in advance from India. Following this, I opened a bank account, got a phone number and eventually my residence permit. Smooth? Because I did most of the research and work while in India and booked the necessary appointments way in advance. It was also easier because we were a good and supportive bunch of friends.</em></p><p><em>Then I moved to Budapest as I took up a new job. The D-type visa for Germany and Hungary works differently. While one can start to work with their visa in Germany and collect their residence permit before it expires, in Hungary, one must collect their permit from the foreign office within 30 days of entering the country. Hence, I was on a deadline here. I had tremendous help from my employer in finding an apartment of my liking, signing the contract, opening bank account and collecting the residence permit. Even then, it took me a month before I could start working because I had to have my residence permit and bank account before I could sign work contract. And that is why I mentioned that it helps to keep extra cash as you cannot always estimate or predict the delays that might result. I was lucky as I had an employer who was supporting me with relocation and also had the option to fall back on some good friends who already live and work in Europe when the need arose. But I realized that the same might not be the case with everyone. While there is enough information online about the bureaucratic process that there is, none really outlines how it happens and in what order. That is what I wanted to convey through this piece. I hope I have done that without deterring the readers (too much!). As I already mentioned, it is tough in the beginning but in the end, all worth it! Do let me know if I missed out anything or if there are some questions left unanswered and I would be happy to address them. Until then, happy reading!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=69647a7efff3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introducing a Very High-Resolution Dataset of Landfills and Waste Dumps]]></title>
            <link>https://medium.com/data-science/introducing-a-very-high-resolution-dataset-of-landfills-and-waste-dumps-196d46d533fc?source=rss-6f18fa3a316------2</link>
            <guid isPermaLink="false">https://medium.com/p/196d46d533fc</guid>
            <category><![CDATA[semantic-segmentation]]></category>
            <category><![CDATA[remote-sensing]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[deep-dives]]></category>
            <category><![CDATA[notes-from-industry]]></category>
            <dc:creator><![CDATA[Anupama Rajkumar]]></dc:creator>
            <pubDate>Sun, 14 Nov 2021 19:23:24 GMT</pubDate>
            <atom:updated>2021-11-15T22:17:35.608Z</atom:updated>
            <content:encoded><![CDATA[<h4><a href="https://towardsdatascience.com/tagged/notes-from-industry">Notes from Industry</a></h4><h3>Introducing a Novel Very High-Resolution Dataset of Landfills and Waste Dumps</h3><h4>A novel dataset consisting of very high resolution multi-spectral satellite images of landfills from Germany, Hungary, Serbia, India and Brazil</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hifmwTI9Rf3nIvjl-PP5bQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@popnzebra">Pop &amp; Zebra</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3><strong>Menace of illegal waste dumps and landfills</strong></h3><p>Waste disposal is a serious problem with most of the world’s waste finding it’s way into the dumps in south-east Asian and African countries. In addition to landfills, waste is illegally disposed off along river banks and beaches. While some of these landfills may be legal and have a proper recycle and safe disposal system in place, it is the large illegal waste dumps that pose a threat not only to the environment in terms of contaminating soil, water and air but also is hazardous to the health of the communities.</p><p>It has been challenging for the governments and municipalities to keep track of these mushrooming landfills so as to keep the menace in check. While these landfills can be monitored through drones, the possibility of using Earth Observation (EO) through satellite imagery can allow us to monitor a larger area at once resulting in a better waste monitoring and management system.</p><h3>Possibility of using earth observation (EO) for detecting landfills</h3><p>Thanks to the presence of a plethora of space satellite sensor programs that are currently running, the amount of satellite sensor data of various resolutions — spatial, temporal and spectral, runs into the order of petabytes. The remote sensing sensors in space can be categorized into imaging and non-imaging sensors. If we only talk about imaging sensors, there are space programs with optical, thermal and radar imaging sensors. The detailed description of each of these sensors is beyond the scope of this article.</p><p>The table below specifies some of the most popular and widely used satellite sensors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/833/1*ZuxDxWr6LjW3v1gL54h4Ew.jpeg" /><figcaption>Table with technical specifications of various satellite missions. All the satellite sensors except RADARSAT and Sentinel are optical sensors. RADARSAT and Sentinel contain Synthetic Aperture Radar (SAR) sensors. Image by author</figcaption></figure><p>Hence, we can see that when it comes to having access to data for EO, we are indeed spoilt for choice and this makes studying the possibility of using EO for detecting landfills a worthwhile exercise. EO has already been for several applications like detecting ships in ocean (remember Ever Given stuck in the Suez Canal?), impact of flooding, de-forestation, illegal mining, railway-track monitoring to name a few.</p><p>While most of the satellite data that is available is open-source and free of cost for research, some commercial programs like WorldView by Maxar Technologies that provide very high resolution satellite images can be purchased for a small fee.</p><h3>Specification of the novel landfill dataset</h3><p>In this section, I talk about the motivation and process behind choosing a certain set of satellite images in order to create the dataset. In addition, I discuss the methods used for creating accurate annotations for the images.</p><h4>Process of creating the dataset</h4><p>The biggest and most crucial challenge of any machine learning pipeline is choosing the right dataset. The availability, size and quality of the dataset chosen goes on the decide the machine learning architecture and the further technicalities and hyper-parameters that would be used to eventually solve the problem at hand.</p><p>For the project, in the absence of any publicly available dataset for landfill detection, I had to create my own. While there are several available datasets like UC Merced Land Use Dataset [1], DeepSat [2], Urban Atlas [3], BigEarthNet [4], these datasets mostly provide an extensive information about general land use classification categories like land, field, forest etc. BigEarthNet does provide a class for dumps but because the dataset is created from low resolution Sentinel satellite images (refer previous table), it does not suffice to detect small landfills that might be sub-meter in size. Hence, this project called for a custom dataset that catered specifically to landfills. It is important to note that in the first phase of the project, I did not classify the landfills based on the type of waste. That is to the say, the landfill sites picked for the dataset creation are waste agnostic. The classification based on the type of waste can be considered as a future enhancement of this project.</p><p>Eventually, I decided to use images from very high resolution (VHR) optical images from WorldView-2 (WV-2), WorldView-3 (WV-3)and GeoEye-1 (GE-1) satellite programs with spatial resolution of 46cm, 30cm and 41 cm respectively. The corresponding spectral resolution for these satellite programs are 8 multi-spectral (MS) bands, 8 MS bands and 4 MS bands respectively in addition to 1 panchromatic band for each of them. In addition, the temporal resolution of these programs range between 1–5 days. These parameters make the dataset created from these images highly suitable for monitoring and detecting landfills from satellite images.</p><p>These VHR images, unlike Sentinel images are not free of cost. However, European Space Agency (ESA) provides free access to a limited repository for research purposes. Once I had finalized the satellite programs that I would be working with, I requested for image tiles from ESA. In order to get access to these image tiles, I identified 13 major known landfill locations across Europe, Asia and South America and sent them to ESA who in-turn gave me access to very high resolution images of these landfills.</p><p>ESA typically provides the images as a set of GeoTIFF files— 1 black and white panchromatic image with very high spatial resolution for example 30cms for WV-3 but low spectral resolution (1 spectral band) and 1 multi-spectral image that has high spectral resolution for example 8 spectral bands for WV-3 but low spatial resolution like 1.24m for WV-3. Pan-sharpening is a technique where panchromatic and multi-spectral images can be fused together to get resulting images that have high spectral as well as high spatial resolution ie. a spatial resolution of 30cms and a spectral resolution of 8 bands for WV-3 images. Hence, pan-sharpening is a way to get the best of the both worlds. Although traditional methods like interpolation are popularly used for pan-sharpening, more recently deep learning has been employed to achieve high resolution multi-spectral images. I perform pan-sharpening on the landfill dataset to get high-resolution multi-spectral dataset. In order to do this, I used Orfeo Toolbox [5] in QGIS [6]. As a result of this, I essentially created 2 landfill datasets — one consisting of only multi-spectral images and the other with pan-sharpened images.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KuSjNOn1ZAdSB3dDOEV_XQ.jpeg" /><figcaption>Landfill at Vinca, Serbia. a.) Multi-spectral image with low spatial resolution but high spectral resolution. b) Panchromatic image with high spatial resolution but low spectral resolution. c) Pan-sharpened image with high spatial and spectral resolutions. Image by author</figcaption></figure><p>The list of these sites and the size of the images provided by ESA, before and after pan-sharpening is provided in the table below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*EOEBcGxYSFNaFdBwKp1VOg.jpeg" /><figcaption>Image by author</figcaption></figure><p>Some image tiles with the landfill areas marked in black:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/442/1*gfGPzNeARZx2Zftiqv9KTA.jpeg" /><figcaption>Landfill locations marked in black in the image tiles provided by ESA in India and Hungary. It can be seen that in the entire image tile, the number of pixels corresponding to the landfills is much smaller than the pixels that do not contain landfill information. Image by author.</figcaption></figure><p>The dimension of the image tiles provided by ESA is very large. To this end, I divide these tiles into smaller patches of 512x512 pixels. The number of patches obtained for each of multi-spectral and pan-sharpened datasets are listed in the table below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/449/1*wAWOeyx4N14fLZqWTF_xAA.jpeg" /><figcaption>Dataset image patch ratio. Image by author</figcaption></figure><p>It can be seen that although the total number of resulting patches is considerably high, the number of patches with landfill pixels is quite low as shown in the plot below. This leads to imbalance in the dataset. As can be deduced from the plotted ratios below, the dataset is imbalanced and patches with landfill pixels are fewer. To this end, to train the models, only those patches with landfill pixels in them are considered. This is due to the fact that even the patches with landfill pixels have more background pixels than landfill pixels.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/565/1*4ieAioOJHDoGc48GXWAdRw.jpeg" /><figcaption>Plots indicating the ratio of the total number of 512x512 patches and patches with landfill pixels for multi-spectral and high resolution pan-sharpened dataset. Image by author</figcaption></figure><p>Consequently, the created dataset consists of 55 multi-spectral and 242 pan-sharpened patches of 512x512 pixels each with landfill information that can be further divided into training, testing and validation sets as desired by the machine learning engineer to train their models.</p><h4>Process of creating highly accurate labels</h4><p>Once image patches were created, the next most important task was to label the landfills accurately so that it could serve as the ground truth data. Since the task at hand was to detect landfills by performing semantic segmentation, I created segmentation mask with the help of QGIS [6].</p><p>Accurate labels are almost as important as the quality of data, if not more. In any machine learning pipeline, garbage in is garbage out. So, if your training data or the corresponding labels is incorrect, there is no way the output would be desirable. Even the best architecture cannot compensate for bad data. Hence, creating accurate labels were crucial for this project. For this, I followed a 2 step strategy — visual inspection and calculation of vegetation indices of the image patches.</p><p>Visual inspection as well as VIs are some of the traditional methods that have already been employed in the literature for landfill detection. But they have proven to be unreliable and at the same time tedious and time consuming which is why we are trying to apply machine learning to find a solution to the problem. But the traditional methods of visual inspection and VIs happen to be a rather useful tool when we try to create ground truth labels. The following sub-sections discuss about how these methods were used to create the labels:</p><h4>Visual inspection</h4><p>This is the simplest method that could be used for labeling. Identifying the area corresponding to landfills by visual inspection served as the first level while creating labels. This method helped in eliminating the regions that did not qualify as landfills because the landfill locations were provided by me and hence I was aware of their exact geo-location.</p><p>Through visual inspection, I could identify the landfill in Erd, Hungary as marked in the black rectangle in the image below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/959/1*ZwmlXtKd0utRNdF6Mo5mxA.jpeg" /><figcaption>Landfill in Erd, Hungary. Image by author</figcaption></figure><h4>Vegetation indices (VI)</h4><p>Although it was possible through known geo-locations to identify the landfill in Erd, Hungary, it would not suffice to create a segmentation label of the entire region. If you look closely in the landfill region marked in Erd in the image above, you can see that some areas within the landfill region is covered by vegetation. Likewise, some other landfill locations had buildings or come other structures contained within them which could not be classified as landfill. Marking or labeling them as landfills would confuse the neural network resulting in incorrect predictions.</p><p>To get a better idea of the landscape within the landfill area and to rule out the possibility of labeling an area of vegetation as landfill, I made the use of VIs to make an analysis which helped me create accurate labels.</p><p>Vegetation indices (VIs) obtained from remote sensing images for canopies are an easy way for evaluating the vegetation cover, health and growth dynamics of canopies. These indices make use of visible light radiation especially green spectra region from visible and non-visible spectra to obtain the quantification of vegetation surface. A mixed combination of soil, weeds and plants of interest makes the calculation of simple VI a very difficult task. There are many VIs that provide useful information about the vegetation cover. Some of these are NDVI, SAVI and MSAVI. I calculated these VIs with the help of QGIS [6] to get an insight of the landfill region. The detailed description and calculation of VIs is the beyond the scope of this article.</p><p>The calculated of NDVI of the landfill at Erd, Hungary is shown below. The NDVI scale represented at the far right of the image represents the NDVI scale which basically signifies that deeper the green in the NDVI (or larger the NDVI value), healthier the vegetation in the landscape and vice-versa. As can be seen in the NDVI map of the landfill region, not the entire area can be marked as landfill as some regions that have been shown in green represent vegetation within the landfill. Labeling these regions as landfill pixels would lead to wrong output from the machine learning model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uog6xHz2zTzPTC2s7Aqu9w.jpeg" /><figcaption>Landfill at Erd, Hungary and the corresponding NDVI values with the scale. Image by author</figcaption></figure><p>Following the visual inspection and calculation and analysis of VIs, I could create segmentation masks that were accurate. Some of these are shown in the image below with landfill patches and their corresponding masks overlapped on them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*wYWd-toJs2EnFwrg778KJw.jpeg" /><figcaption>Landfill patches with overlapping segmentation masks used as the ground truth. Image by author</figcaption></figure><p>The segmentation masks were created with the help of QGIS as already mentioned earlier. In the dataset folder, the masks are stored as a GeoJSON file which consists of a list of the coordinates of each of the edge of polygon that constitutes the mask. Each landfill patch has a corresponding GeoJSON file. The patch name along with the respective GeoJSON mask file has been listed in a .csv file. This .csv file can be used for loading the landfill patches and corresponding masks by the data loader during implementation.</p><h3>Detecting landfills in Hungary — some results</h3><p>On applying supervised deep learning algorithms for semantic segmentation to the validation set from the landfill dataset provided some useful results. The deep learning models are successful in identifying landfills of size in the order of a few meters which is quite useful for monitoring and detecting illegal landfills as they are usually spread over smaller areas. Some of the segmentation results for landfill patches are shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*n2SDUuXY3cHeFbqXW6j_mw.jpeg" /><figcaption>Image by author</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/1*eFCa1y1UnHxgNLPWhoJONg.jpeg" /><figcaption>Image by author</figcaption></figure><p>The specifications of the deep learning architectures that were employed along with associated parameters and results will be shared in the future articles. However a brief technical overview can be found here : <a href="https://www.euspaceimaging.com/combining-vhr-satellite-imagery-and-deep-learning-to-detect-landfills/">https://www.euspaceimaging.com/combining-vhr-satellite-imagery-and-deep-learning-to-detect-landfills/</a></p><h3>Process to request access to the dataset</h3><p>The aim of this article is to present a novel landfill dataset consisting of VHR images with high quality and accurate segmentation masks. In addition, I wanted to discuss and share my experience of the entire process around choosing the appropriate data and the workflow and thought behind creating the annotations or the labels for this data on my own. I hope new machine learning engineers will find this useful.</p><p>In future, I will host the dataset on a server from where it can be downloaded directly. However, at the present moment, in case you want to access the dataset, kindly follow these steps:</p><ol><li>Star the project repo at this location: <a href="https://github.com/AnupamaRajkumar/LandfillDetection_SemanticSegmentation">https://github.com/AnupamaRajkumar/LandfillDetection_SemanticSegmentation</a>. This allows me to keep track of the people who have requested to access the dataset</li><li>Write me an e-mail at anupamar228@gmail.com providing me your e-mail address that is linked to your DropBox and I will provide you access to the repository currently stored in my personal DropBox.</li></ol><h3>Acknowledgements and citation information</h3><p>I would like to thank ESA for providing the VHR images free of cost for research purpose. They have a huge repository of satellite images of all kinds and specifications which has been a boon for research in Earth Observation.</p><p>ESA has kindly obliged to make the dataset open-source for research purpose. However, it is bound by copyright laws. In case the images from the dataset is used, “©DigitalGlobe, Inc. 2021 , Data provided by the European Space Agency” must be included in order to avoid copyright infringement. I have already included this information in LicenseInfo.txt in the dataset folder, be sure to use it.</p><p>If you decide to use the images from this dataset, please do not forget to cite as mentioned in ReadMe.txt in the dataset folder.</p><h4>References</h4><p>[1] Yi Yang and Shawn Newsam, “Bag-Of-Visual-Words and Spatial Extensions for Land-Use Classification,” ACM SIGSPATIAL International Conference on Advances in Geographic Information Systems (ACM GIS), 2010, <a href="http://weegee.vision.ucmerced.edu/datasets/landuse.html">http://weegee.vision.ucmerced.edu/datasets/landuse.html</a></p><p>[2] Saikat Basu, Sangram Ganguly, Supratik Mukhopadhyay, Robert DiBiano, Manohar Karki, and Ramakrishna Nemani. Deepsat — a learning framework for satellite imagery, 2015.</p><p>[3] Urban Atlas. <a href="https://land.copernicus.eu/local/urban-atlas.">https://land.copernicus.eu/local/urban-atlas.</a> Accessed: 2021–11–14.</p><p>[4] Gencer Sumbul, Marcela Charfuelan, Begüm Demir, and Volker Markl. Bigearthnet: A large-scale benchmark archive for remote sensing image understanding. In IGARSS 2019–2019 IEEE International Geoscience andRemote Sensing Symposium, pages 5901–5904, 2019.</p><p>[5] Orfeo Toolbox. <a href="https://www.orfeo-toolbox.org/CookBook/">https://www.orfeo-toolbox.org/CookBook/</a>Applications/app_Pansharpening.html. Accessed: 2021–11–15.</p><p>[6] Developers Guide for QGIS. <a href="https://docs.qgis.org/3.16/en/docs/">https://docs.qgis.org/3.16/en/docs/</a>developers_guide/index.html. Accessed: 2021–11–15.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=196d46d533fc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/introducing-a-very-high-resolution-dataset-of-landfills-and-waste-dumps-196d46d533fc">Introducing a Very High-Resolution Dataset of Landfills and Waste Dumps</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Point Set Registration Methods — Discussion and Implementation]]></title>
            <link>https://medium.com/swlh/point-set-registration-methods-discussion-and-implementation-58efa98d0b68?source=rss-6f18fa3a316------2</link>
            <guid isPermaLink="false">https://medium.com/p/58efa98d0b68</guid>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[robotics]]></category>
            <category><![CDATA[point-cloud]]></category>
            <category><![CDATA[autonomous-cars]]></category>
            <category><![CDATA[editors-pick]]></category>
            <dc:creator><![CDATA[Anupama Rajkumar]]></dc:creator>
            <pubDate>Wed, 03 Feb 2021 23:36:03 GMT</pubDate>
            <atom:updated>2021-02-05T14:19:33.913Z</atom:updated>
            <content:encoded><![CDATA[<h3>Point Set Registration Methods — Discussion and Implementation</h3><p>An Introduction to Point Set Registration using Iterative Closest Point and Trimmed Iterative Closest Point with Implementation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i6cDtSId-rrMceHu0CR7Gw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/2KBMfHpagRM">Ivan Sanford</a> on <a href="https://unsplash.com/">Unsplash</a></figcaption></figure><p><strong>What is Point Set Registration?</strong></p><p>Point set (or cloud) registration¹ is a widely used technique in the field of computer vision, pattern recognition, robotics and image processing. It finds extensive application in many fields like medical image processing, intelligent or autonomous vehicles , robotic manipulation, SLAM, panorama stitching to name a few².</p><p>The main purpose of point set registration is to find correspondences and estimate the transformation (rotation and translation) between two or more point sets. In practice, point set registration is a rather challenging task as the available point clouds always have some noise (like outliers) or deformation².</p><p>There are many point set registration algorithms that can be used to transform point clouds. These algorithms can be largely categorized into: Pairwise and Groupwise registration algorithms².</p><p>Pairwise registration only considers two point sets while groupwise registration performs transformations on more than two point sets simultaneously². In this article, we will discuss about the classic Iterative Closest Point (ICP) and Trimmed Iterative Closest Point (TrICP) methods both of which are pairwise registration method. While there are algorithms that perform affine transformations between clouds (rotation, translation, scaling and skews), in this article we will talk about only rigid transformations i.e. rotation and translation between point clouds.</p><h4><strong>Iterative Closest Point (ICP)</strong></h4><p>Paul J. Besl and Neil D. McKay in 1992 published a paper called “A Method for Registration of 3-D Shapes”³ and this paper forms the foundation of the ICP algorithm as we know it. In this section, I will discuss the methodology that they proposed to perform rigid transformation between two point clouds along with code snippets. In the end, I will show some point clouds to demonstrate the results achieved and some limitations of this method.</p><p>Given a 3-D data point cloud which describes the data shape corresponding to a model shape, the aim of this algorithm is to estimate the optimal rotation and translation that aligns, or registers, the model shape and data shape minimizing the distance between the shapes and thereby allowing the determination of the equivalence of the shapes via a mean-square distance metric³. This method provides a generic solution to the alignment problem.</p><p>The first step of the algorithm is to compute the closest point to a given point. The method proposed in the paper finds Euclidean distance between a point p and a point set A with N points. It picks the point in the point set A with minimum distance to the given point p³. As one can imagine this is a very slow and computationally demanding process and this can pose a challenge when the size of the point cloud is very large. Hence, this approach to finding closest point doesn’t seem very practical.</p><p>As an enhancement, instead of using euclidean distance, k-d trees can be used to find the closest points. I would leave out the details of k-d trees as it is beyond the scope of this article. K-d trees can be easily implemented using the open source library <a href="https://github.com/jlblancoc/nanoflann">Nanoflann</a>⁶. The code snippet to do the same would look like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/21abe7465819204721920b07807ccee0/href">https://medium.com/media/21abe7465819204721920b07807ccee0/href</a></iframe><p>This would create a tree and store all the nearest points, as desired. Once we have corresponding closest point of both the data and point clouds, the next step is to actually calculate the rigid transformations ie. the rotation and translation matrices. This process is called point set registration and there are two ways to do this — using Single Value Decomposition (SVD) as described by Arun, Huang et al. in Least Square Fitting of Two 3-D Point⁴ or using Unit Quaternion as applied in the original paper³. We will discuss the steps and implementation of both the methods:</p><ol><li><strong>Least-Squares Fitting using Single Value Decomposition (SVD)⁴</strong></li></ol><p>In this section, I will describe the steps proposed by Arun, Huang et al. in their paper Least Square Fitting of two 3-D points⁴ using SVD.</p><p>Given two point sets P and Pᶦ are related by :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/146/1*cvwCRcKMGtcIld5YXYY4qQ.gif" /></figure><p>where, R : Rotation matrix, T : Translation matrix and N is a noise vector, then this algorithm presents a way of finding the least-squares solution of R and T based on SVD of a 3 x 3 matrix.</p><p>We want to find R and T to minimize</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/219/1*MGLOgIVen5YK5VY9UgxuEw.gif" /></figure><p>In order to do this, first we find centroid of both the point clouds by finding their respective means. Once we have found the centroid to these point clouds, we subtract these values with the respective point clouds in order to center the mass-point of each cloud.</p><p>If Q and Qᶦ are the centered mass-points of P and Pᶦ respectively we have:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/170/1*ka9ESspHz-bfKk33Mgv4Bg.gif" /></figure><p>Therefore, we reduce the original least-squares problem to two parts:</p><p>a. To find R to minimize the above equation⁴</p><p>b. Find translation, T using:⁴</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/104/1*1YvpDmNStlVj65-Vf2CbHA.gif" /></figure><p>Once we have P, Pᶦ, Q and Qᶦ, we can compute a 3 x 3 covariance matrix matrix as :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/108/1*5ZRqzBhYzmGs3qzuPCKyng.gif" /></figure><p>This can be implemented as follows</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ad2cf5e9f1a1c7e2dfc7c3f10c30ba6e/href">https://medium.com/media/ad2cf5e9f1a1c7e2dfc7c3f10c30ba6e/href</a></iframe><p>Next, we find SVD of H. Since it is out of the scope of this article, I will skip the discussion about the math behind SVD and assume that the reader has background knowledge of SVD. There are functions in C++ that help in calculating the SVD of H which gives matrices U and Vᵗ. Once we have these matrices, we calculate rotation matrix, R as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/71/1*NqKlTF8E8w-bcQ4NekEaNg.gif" /></figure><p>It is important to calculate the determinant of R matrix obtained from the calculation above. If the det(R) is 1, then the rotation matrix is correct and we can proceed with calculation T from the equation given above⁴.</p><p>However, in case det(R) is -1, the algorithm fails and leads to reflection instead of rotation. However, this can be remedied by multiplying the last column of V matrix with -1. This solution works only if two of the three singular values of H are equal⁴.</p><p>In case det(R) is -1 and none of the singular values of H is 0, this method fails. This usually happens when the point clouds have higher outliers and RANSAC is a better approach in such a case as opposed to least-squares fitting⁴.</p><p>That was too much maths but there is a chance that if you work in 3D computer vision or SLAM, SVD is an everyday jargon for you!</p><p>Let’s see how do we implement this!</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a9cee7da06b4a6595266a76b68828086/href">https://medium.com/media/a9cee7da06b4a6595266a76b68828086/href</a></iframe><p>2. <strong>Least- Squares Fitting using Unit Quaternion³</strong></p><p>This was the method followed by Besl and McKay in their paper³ so as to avoid reflections as described in the previous section. However, the advantage of SVD over unit quaternions is that the former generalizes well to n dimensions and would be an ideal approach in case n &gt; 3.³</p><p>The unit quaternion is a four vector</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/118/1*i4MjcXASqDVW1b0lq-T37g.gif" /></figure><p>where</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/208/1*yMB6wPUKh07bC4qTK7vAyw.gif" /></figure><p>To find the transformation matrix, we start by calculating the covariance matrix by following the steps as explained in the previous section.</p><p>After we have the covariance matrix, H, we find the anti-symmetric matrix:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/127/1*FPo4FIs0x7EqvKuyry4oXQ.gif" /></figure><p>From this, we take the cyclic components to compute:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/140/1*03BQMAmZ8DniyByquBewZw.gif" /></figure><p>This vector is then used to form the symmetric 4 x 4 matrix Q(H):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/232/1*6y1b93YDLgEMhBEviT4nZQ.jpeg" /></figure><p>Here, <strong>I </strong>is the 3 x 3 identity matrix. The unit eigenvector corresponding to the maximum of eigenvalue of the matrix Q(H) is selected as the optimal rotation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/118/1*i4MjcXASqDVW1b0lq-T37g.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/1*1D0QoUgM3tl_HXnKiXAB8Q.jpeg" /></figure><p>The translation vector can be determined from R as done in the first method of SVD.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9f8da9f3187bba5152aef4437bf6f782/href">https://medium.com/media/9f8da9f3187bba5152aef4437bf6f782/href</a></iframe><p>Now that the methods for computing the closest point on a geometric shape to a given point and for computing a least squares registration vector has been outlined³, we can get on with aligning the two point clouds.</p><p>We move or register the data shape point cloud P to best align with the model shape point cloud M.</p><p>We repeat the following steps until convergence³:</p><ol><li>Compute the closest point using the method outlined earlier (k-d tree)</li><li>Compute registration (SVD or unit quaternion)</li><li>Apply the computed registration to the data point cloud</li><li>Terminate the process when the mean square error falls below a preset threshold or if the total number of iterations have been exhausted. In that case, the solution fails to converge and find an optimum registration.</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/01efd3df0bfa9792871676b6591e7c5a/href">https://medium.com/media/01efd3df0bfa9792871676b6591e7c5a/href</a></iframe><p>As per the <em>Convergence Theorem</em> of the ICP Algorithm, “it always converges monotonically to a local minimum with respect to the mean-square distance objective function”³.</p><p>Experimentally, it is found that in the initial few iterations the convergence is very fast but slows down as it approaches the local minimum. Even at slow pace, usually the solution is obtained in between 30–50 iterations³. In the implementation shared here for the fountain point cloud, a reasonable solution was obtained in 40 iterations.</p><p>Let us look at some results now. For a fountain model and data points with some pre-registration yields the following result after applying ICP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7m2305abB589iHZr0E5KoQ.png" /><figcaption>Data point cloud. Image by Author</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*of7xcYy3f50AKPohNkHTfg.png" /><figcaption>Model point cloud. Image by Author</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f-mpvIW-mWZLuv9o1daFVA.png" /><figcaption>Fountain after successful ICP registration. Image by Author</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sr_XzRTdXjbINzSp-0tOwg.png" /><figcaption>Fountain after successful ICP registration. Image by Author</figcaption></figure><p>ICP gives good results as long as the data points are outlier free and that data point set is a subset of the model set. ICP is not robust in itself and would require robustification by using techniques like RANSAC or better sampling methods. In addition, although ICP guarantees convergence, it can be relatively slow.</p><h4>Trimmed Iterative Closest Point (TrICP)</h4><p>Trimmed Iterative Closest Point or TrICP addresses the problem of alignment of two roughly pre-registered, partially overlapping 3D point sets in presence of measurement outliers and possibly, shape defects⁵.</p><p>TrICP is an extension of ICP proposed by D. Chetverikov (who also taught me sensor fusion at University!) et al in their paper and addresses the critical issue of robustness as the original algorithm assumes outlier-free data and that the data point cloud, P is a subset of model cloud, M⁵.</p><p>The new algorithm is based on the use of Least Trimmed Squares (LTS) approach in all phases of the operation. LTS means sorting the square errors and minimizing a certain number of smaller values⁵. What this implies is that instead of taking square distance of all the points in the cloud, only first few points which represents appropriate correspondences between data and model sets are taken.</p><p>LMedS is another method that minimizes the median ie. the value in the middle of the sorted sequence. However, we use LTS as it has better convergence rate and a smoother objective function⁵.</p><p>Let’s talk about the algorithm now. Given we have two point clouds, data point cloud P with p points and model point cloud M with m points⁵. Usually p is different from m. This means that a large portion of data points do not find correspondence in model set. Let us assume that the minimum guaranteed rate of data points that can be paired is known and is given by a minimum overlap, <strong>o. </strong>Then the number of data points that can be paired to model point set is given as⁵:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/77/1*AhzrQDpDGykldPEtCQyw9g.gif" /></figure><p>What this means is that after applying overlap parameter, it would be assured that the correspondences between P and M would be ensures and points taken from both the point clouds would be same.</p><p>Note that the value of <strong>o </strong>is unknown and we calculate it’s value using golden section search algorithm⁷ as explained later in the section.</p><p>TrICP assumes at P and M have been roughly <em>pre-registered, </em>either manually or automatically⁵. Pre-registration means that the data and the model set already has some established correspondence or overlap.</p><p>Usually this value is initial relative rotations up to 30 degs. TrICP is similar to ICP with consistent use of LTS in all major aspects of it’s operation which allows it to cope with outliers, shape defects or just partial overlap; to estimate the optimal transformation at each iteration step⁵.</p><p>We repeat the following steps until convergence⁵:</p><ol><li>For each point in data set P, find closest point in M and compute the square of individual distance (refer the code snippet for finding closest point earlier)</li><li>Sort these distances in ascending order and select the <strong>o</strong>N least values and calculate their sum S, where <strong>o</strong> is the overlap parameter</li><li>If the stopping conditions are satisfied, exit. Otherwise, continue.</li><li>Compute the optimal transformations (R, t) that minimizes S</li><li>Transform P according to (R, t) and go to 1</li></ol><p>Stopping conditions used in 3 are⁵:</p><ol><li>Maximum allowed iterations have been reached in which case the solution doesn’t converge</li><li>The trimmed mean square error (MSE) is lower than the threshold</li><li>The relative change of the trimmed MSE is sufficiently small indicating that the solution has reached a minima</li></ol><p>Let’s touch upon how we calculate the overlap parameter parameter <strong>o. </strong>When <strong>o </strong>is unknown, it is set automatically by minimizing the objective function⁵:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/95/1*nWHNx2SI2ap063lq0I06Nw.gif" /></figure><p>Usually:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/44/1*quggFMnofJVfKRUVG6UrVA.gif" /></figure><p>We try to minimize the objective function using golden section search algorithm⁷. The minimum of the objective function is searched in the range 0.4 and 1. Usually this value can be determined in 5–8 iterations. Please note that when <strong>o </strong>is 1, TrICP becomes ICP⁵. The code snippet below shows how I determine the overlap parameter.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/030a5ad5e3a5ce11af743df2c9dcead2/href">https://medium.com/media/030a5ad5e3a5ce11af743df2c9dcead2/href</a></iframe><p>TrICP’s <em>Convergence Theorem</em> states that the algorithm “always converges monotonically to a local minimum with respect to the trimmed MSE objective function”⁵.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/efb8c01ef6ae8418c9f555f608a90c55/href">https://medium.com/media/efb8c01ef6ae8418c9f555f608a90c55/href</a></iframe><p>From the experiments, it can be seen that TrICP converges faster than ICP and has advantages when the model and data point sets have different sizes. The result for the same fountain data and model point clouds as shown earlier with TrICP can be seen here:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M8y5GuhjcaheNa27EyvOVA.png" /><figcaption>Fountain after successful TrICP registration. Image by Author</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WVgFNgKrMNeDeafOY3s08w.png" /><figcaption>Fountain after successful TrICP registration. Image by Author</figcaption></figure><p>Through this article, I wanted to discuss about some basic point set registration algorithms and present a way to implement them. There are open source libraries like PCL which already do this for you but it is always good to know and understand what they do in real.</p><p>In addition, it is worth mentioning that this is the simplest possible implementation of the said algorithms. Point registration remains one of the most challenging tasks and there are innumerable variations to make it efficient, fast and robust. This becomes even crucial when the incoming point clouds are real time and has ample outliers for example in a drone or an autonomous vehicle.</p><p>You can find the entire implementation of the above discussed algorithms along with some other topics in sensor fusion <a href="https://github.com/AnupamaRajkumar/Sensor-Fusion/tree/master/PointRegistration">here </a>. I hope you find this useful and Happy Coding!</p><p><strong>References</strong></p><p>[1] Point set registration, <a href="https://en.wikipedia.org/wiki/Point_set_registration">Wikipedia</a>: <a href="https://en.wikipedia.org/wiki/Point_set_registration">https://en.wikipedia.org/wiki/Point_set_registration</a></p><p>[2] Hao Zhu et al. A Review of Point Set Registration: From Pairwise Registration to Groupwise Registration: <a href="https://www.semanticscholar.org/paper/A-Review-of-Point-Set-Registration%3A-From-Pairwise-Zhu-Guo/c0fff09ebc59fef099d27ea6375acb861b7fe4e9">https://www.semanticscholar.org/paper/A-Review-of-Point-Set-Registration%3A-From-Pairwise-Zhu-Guo/c0fff09ebc59fef099d27ea6375acb861b7fe4e9</a></p><p>[3] Besl and McKay. A method for registration of 3-D shapes: <a href="https://ieeexplore.ieee.org/document/121791">https://ieeexplore.ieee.org/document/121791</a></p><p>[4] Arun, Huang et al. Least Square Fitting of Two 3-D Point Sets:<a href="https://ieeexplore.ieee.org/document/4767965">https://ieeexplore.ieee.org/document/4767965</a></p><p>[5] D. Chetverikov, Svirko et al. The Trimmed Iterative Closest Point Algorithm : <a href="https://ieeexplore.ieee.org/document/1047997">https://ieeexplore.ieee.org/document/1047997</a></p><p>[6] Nanoflann: <a href="https://github.com/jlblancoc/nanoflann">https://github.com/jlblancoc/nanoflann</a></p><p>[7] Golden Section Search Algorithm : <a href="https://en.wikipedia.org/wiki/Golden-section_search">https://en.wikipedia.org/wiki/Golden-section_search</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=58efa98d0b68" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/point-set-registration-methods-discussion-and-implementation-58efa98d0b68">Point Set Registration Methods — Discussion and Implementation</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Autoencoders & their Application in Remote Sensing]]></title>
            <link>https://medium.com/data-science/autoencoders-their-application-in-remote-sensing-95f6e2bc88f?source=rss-6f18fa3a316------2</link>
            <guid isPermaLink="false">https://medium.com/p/95f6e2bc88f</guid>
            <category><![CDATA[autoencoder]]></category>
            <category><![CDATA[editors-pick]]></category>
            <category><![CDATA[remote-sensing]]></category>
            <category><![CDATA[unsupervised-learning]]></category>
            <category><![CDATA[neural-networks]]></category>
            <dc:creator><![CDATA[Anupama Rajkumar]]></dc:creator>
            <pubDate>Tue, 22 Dec 2020 13:15:34 GMT</pubDate>
            <atom:updated>2020-12-22T13:15:34.073Z</atom:updated>
            <content:encoded><![CDATA[<p>Autoencoders are one of the simplest and most popular neural networks. There are many versions of them but the underlining principle and essence of the network remains the same. In this article, we first touch upon a vanilla autoncoder — it’s architecture, equations and implementation. We follow this up with an interesting application of autoencoders in the field of remote sensing for feature extraction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xzDvYF7H94e-x4QHi5JT-g.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@nasa">NASA</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3><strong><em>Understanding Autoencoders</em></strong></h3><p>An autoencoder is a neural network that consists of an input layer, one or more hidden layer(s) and an output layer, pretty much like any other neural network that you may have heard of or worked with.</p><p>But there are some very specific characteristics that an autoencoder possesses which makes it unique and they are:</p><ol><li>The input and output layers of an autoencoder always have the same dimension. The hidden layer can be any dimension(preferably lesser than the input and output layers) but the input and the output dimensions should always match! Why is it so? Read on to find out!</li><li>Another distinct feature of an autoencoder is that unlike other popularly used neural networks, it is <strong>unsupervised. </strong>This means that an autoencoder does not need label information and this makes them particularly useful for some tasks that need to learn features or extract representations</li></ol><p><strong>Architecture of an Autoencoder</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*wwbZ0cqrC_nL5sDFggMZow.png" /><figcaption>A Vanilla Autoencoder. Image by author</figcaption></figure><p>The figure above represents the simplest autoencoder architecture possible. These autoencoders are called vanilla autoencoders and can be used to understand their underlying principles quite well.</p><p>As already mentioned in the characteristics, the network contains an input, a hidden and an output layer and the input and output dimensions are the same ie. 9 in this case. The reason for these dimensions to be strictly same can be justified by understanding how an autoencoder works.</p><p><strong><em>Encoder:</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/545/1*2JUHDyUxlizZmnCR4SbgEg.png" /><figcaption>Encoder in an Autoencoder. Image by author</figcaption></figure><p>The input portion of an autoencoder behaves like an encoder. That is, the use of a non linear activation function can encode the input data which gets stored in the hidden layer.</p><p>In form of equations, these can be represented as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/131/1*0T_kh3Fekb-3bsZFhb985A.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/124/1*XC__Z4tng8Z9aE0UK8ewMw.gif" /></figure><p>where:</p><p>x : input data</p><p>y : encoded values</p><p>b1 : input bias</p><p>W : input-to-hidden layer weights</p><p>f() : non-linear activation function, sigmoid in this case</p><p><strong><em>Decoder:</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/541/1*5jp_2zT5J2Kp-EuxUyCXyQ.png" /><figcaption>Decoder in an Autoencoder. Image by author</figcaption></figure><p>The output portion of autoencoder decodes the information that has been stored in the hidden layer in encoded format. An autoencoder reconstructs the output that is as close as possible to the input (ideally same as input). This is the reason why the output and input dimensions must match.</p><p>In form of equations, these can be represented as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/135/1*XYSlNoMkVhDvuF4Wy3dqFw.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/165/1*RRKGHnVwVa_OqhB_CVMyVQ.gif" /></figure><p>where:</p><p>y : encoded value stored in the hidden layer</p><p>z : output of autoencoder</p><p>b2 : hidden layer bias</p><p>W` : transpose of input-to-hidden layer weights</p><p>f() : non-linear activation function</p><p>E(W,b) : mean square error cost function</p><p>The cost function E(W,b) depicts how different the reconstruction at output is from the input data. The aim of the autoencoder is to minimize the reconstruction error. At the onset, it might seem that autoencoder is a one-on-one operation that just matches output with input. However, it is during this process that the autoencoder might end up learning interesting features or representations from the input data which gets stored in the hidden layer. Choice of an appropriate non linear activation function plays an important role here. Also as the dimension of hidden layer is typically lesser than that of the input layer, it also leads to dimensionality reduction.</p><p>Backpropagation algorithm is used to reduce the cost function and the choice of cost function, whether mean square error or binary cross-entropy depends on the type of data and the application to be implemented. The same applies to the choice of the non linear activation function.</p><p><strong>Implementation Details:</strong></p><p>In this section, I attach some snippets of implementation of an autoencoder. Some important details of implementation of an autoencoder or of any neural network for that matter revolves around the forward and backward propagation respectively.</p><p><strong><em>Dimensions of the vectors:</em></strong></p><p>It is important to note that all the data that is dealt with is always a vector or a matrix. For the autoencoder implemented here, the dimensions of the data is as follows:</p><p>input data = [9x1]</p><p>output data = [9x1]</p><p>hidden layer = [5x1]</p><p>hidden layer bias = [5x1]</p><p>output layer bias = [9x1]</p><p>input-to-hidden layer weights = [5x9]</p><p>hidden-to-output layer weights = [9x5]</p><p>As a first step for implementation, we start by initializing the variables. We initialize the weight matrix and the bias vectors to random initial values.</p><p>To implement the feedforward flow of the autoencoder, ie. the calculation of the encoded weights, we simply multiply the input values with the randomly initialized weight matrix. To this we add the bias vector which too has been randomly initialized.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1460fa4b4b66f49fb000196b916bf23a/href">https://medium.com/media/1460fa4b4b66f49fb000196b916bf23a/href</a></iframe><p>In order to reconstruct the output such that the it is a representation of the input, the error function must be reduced and backpropagation algorithm is used for this purpose. The main gist of the backpropagation algorithm is to adjust weights and biases individually. This is done using gradient descent and it can be represented as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/168/1*ZNAXIBCEPlivEnPuHsxJOQ.gif" /><figcaption>Gradient descent for weight</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/144/1*4FYoXXmnq9UUM80QQFh07Q.gif" /><figcaption>Gradient descent for bias</figcaption></figure><p>where eta is the learning rate and is one of the hyperparameters that is to be determined experimentally.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a7811f6a08318489110af71b0bba6e91/href">https://medium.com/media/a7811f6a08318489110af71b0bba6e91/href</a></iframe><p>The discussion about a neural network cannot be complete without the mention of the hyperparameters. Here our hyperparameters are the dimension of the hidden layers, the learning rate, and momentum (if used). The number of epochs over which the model is trained is also important. These values can be determined experimentally such that the error goes on reducing.</p><p>In the next part of this article I will touch upon the application of this simple autoencoder in the field of remote sensing and discuss the results achieved.</p><p>While there are ample examples listing the use of autoencoders for de-noising or dimensionality reduction, in this article I would like to demonstrate how it can also be used in applications like remote-sensing to extract features from satellite images.</p><p>In this example, I used a vanilla autoencoder defined in the first part of this article to extract features from fully Polarimetric SAR (PolSAR) image taken over Oberpfaffenhofen, Wessling, Germany. The <a href="https://earth.esa.int/web/polsarpro/data-sources/sample-datasets">Oberpfaffenhofen </a>PolSAR image of size 6640 x 1390 pixels has a resolution of 1.5 m per pixel and has been captured by E-SAR sensor (DLR, L-band). The ground truth of the dataset is annotated with five classes namely, City (red), Field (yellow), Forest (dark green), Forest (dark green), Grassland (light green), Streets (blue).</p><p>The false color image and the ground truth images look like the ones shown here:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*j9zpTK_eAqRkoEZ0.png" /><figcaption>False Color Image, Oberpfaffenhofen dataset. Image from opensource <a href="https://earth.esa.int/web/polsarpro/data-sources/sample-datasets">European Space Agency Sample Datasets</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dnPwKPyBZWz3QGkv.png" /><figcaption>Annotated Ground Truth with 5 labels — Field (yellow), Forest (dark green), Grassland (light green), Streets (blue), City (red) and Black (unclassified). Image from opensource <a href="https://earth.esa.int/web/polsarpro/data-sources/sample-datasets">European Space Agency Sample Datasets</a></figcaption></figure><p>Skipping the PolSAR jargon as it is beyond the scope of this article, c<a href="http://www.gipsa-lab.fr/~gabriel.vasile/Cours/cours_SAR_part3.pdf">oherency matrix</a> was used as the input feature vector of nine dimensions. The hidden layer encoded the input data and stored it in it’s 5 neurons. In the process it ended up learning some important features from the input vector. The encoded data was decoded and reconstructed at the output, as is expected from an autoencoder. The result was classified using k-NN algorithm.</p><p>I trained the model using stochastic gradient descent (SGD) for 100 epochs with a learning rate of 0.1 and momentum of 0.9 and used mean square error (MSE) as cost function.</p><p>Each neuron in the hidden layer encodes and learns some features from the input which can be plotted as a feature map.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GC1Ew1Lpm-ITXLr6.png" /><figcaption>Feature Map — Neuron 1. Image by author</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bjqSaY3rJ9b1qO0R.png" /><figcaption>Feature Map — Neuron 2. Image by author</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8D6pxe4o1HySnF-g.png" /><figcaption>Feature Map — Neuron 3. Image by author</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fwLvWwS9nnUalj06.png" /><figcaption>Feature Map — Neuron 4. Image by author</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*f-FQKF2_cKWotylv.png" /><figcaption>Feature Map — Neuron 5. Image by author</figcaption></figure><p>After reconstruction and classification at the output layer, the result obtained looked something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XoTfK9zChfQT-mNZ.png" /><figcaption>Reconstructed features from Autoencoder using k-NN classifier. Image by author</figcaption></figure><p>The vanilla autoencoder implementation achieved an overall accuracy (OA) of 70%. This might not seem very impressive as the model used was very simple but can certainly be improved with a more complex network architecture. Some parallel work has shown that multi-layer autoencoder networks perform better than their vanilla counterparts. Also, it is not enough to just comment on the OA of the whole image but individual accuracy of each class should also be commented on. As is evident from the classification result, field (yellow) and forest (dark green) have the most accurate classifications while grassland (light green), streets (blue) and city (red) have varied classification errors. The possible reason for this is besides the nature of the PolSAR data captured, the fact that the forest and field have highest number of samples to train on, also leads to reduction in the error. In fact, the class wise accuracy results are comparable even when different conventional techniques are applied for feature extraction. On reducing the dimensionality of data using t-sne, the result evidently shows how fields, forest and grassland are classified better than city and streets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*1DtG5Ns6NHeNCD4x.png" /><figcaption>Dimensionality reduction by t-sne. Image by author</figcaption></figure><p>One might also ask, why use autoencoder when you can use CNN and achieve better results? Well, it made sense to use a CNN if the data was much bigger than what was used for training purpose. For such a small dataset, CNN seemed a little overkill and might have led to overfitting. Autoencoder provided a better solution and it is almost certain that with a slightly more complex network, the model would extract features more accurately than it currently does (this also remains as a future enhancement!).</p><p>Autoencoders are not as widely used in real-world application and when used only finds applications in data denoising, dimensionality reduction and variational autoencoders. However, they are very simple and can be used efficiently for feature extraction and the fact that they are unsupervised makes them an attractive choice for applications that do not have high quality labels available, like in remote sensing. It’s time they got their due.</p><p>Until then, feel free to reach out to me if something wasn’t clear enough or needs improvement. And, happy coding!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=95f6e2bc88f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/autoencoders-their-application-in-remote-sensing-95f6e2bc88f">Autoencoders &amp; their Application in Remote Sensing</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part (2/2) : Using Autoencoders for Feature Extraction]]></title>
            <link>https://anupamarajkumar.medium.com/part-2-2-using-autoencoders-for-feature-extraction-e00b1c8d0d2e?source=rss-6f18fa3a316------2</link>
            <guid isPermaLink="false">https://medium.com/p/e00b1c8d0d2e</guid>
            <category><![CDATA[remote-sensing]]></category>
            <category><![CDATA[autoencoder]]></category>
            <category><![CDATA[feature-extraction]]></category>
            <dc:creator><![CDATA[Anupama Rajkumar]]></dc:creator>
            <pubDate>Fri, 30 Oct 2020 23:16:21 GMT</pubDate>
            <atom:updated>2020-12-22T08:37:47.440Z</atom:updated>
            <content:encoded><![CDATA[<h3>Part (2/2) : Using Autoencoders for Feature Extraction from PolSAR Images</h3><p>In <a href="https://medium.com/@anupamarajkumar/part-1-2-what-and-how-of-autoencoders-5b0045a9d480">Part 1 </a>of this series, I explained the whats and hows of Autoencoders. While there are ample examples listing the use of autoencoders for de-noising or dimensionality reduction, in this article I would like to demonstrate how it can also be used in applications like remote-sensing to extract features from satellite images.</p><p>In this example, I used a vanilla autoencoder defined in the first part of this article to extract features from fully Polarimetric SAR (PolSAR) image taken over Oberpfaffenhofen, Wessling, Germany. The <a href="https://earth.esa.int/web/polsarpro/data-sources/sample-datasets">Oberpfaffenhofen </a>PolSAR image of size 6640 x 1390 pixels has a resolution of 1.5 m per pixel and has been captured by E-SAR sensor (DLR, L-band). The ground truth of the dataset is annotated with five classes namely, City (red), Field (yellow), Forest (dark green), Forest (dark green), Grassland (light green), Streets (blue).</p><p>The false color image and the ground truth images look like the ones shown here:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sD1WMbJZdQfLbL59NsNY6w.png" /><figcaption>False Color Image, Oberpfaffenhofen dataset. Image from opensource <a href="https://earth.esa.int/web/polsarpro/data-sources/sample-datasets">European Space Agency Sample Datasets</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LNsRw_FrNLCyePfVeo2omQ.png" /><figcaption>Annotated Ground Truth with 5 labels — Field (yellow), Forest (dark green), Grassland (light green), Streets (blue), City (red) and Black (unclassified). Image from opensource <a href="https://earth.esa.int/web/polsarpro/data-sources/sample-datasets">European Space Agency Sample Datasets</a></figcaption></figure><p>Skipping the PolSAR jargon as it is beyond the scope of this article, c<a href="http://www.gipsa-lab.fr/~gabriel.vasile/Cours/cours_SAR_part3.pdf">oherency matrix</a> was used as the input feature vector of nine dimensions. The hidden layer encoded the input data and stored it in it’s 5 neurons. In the process it ended up learning some important features from the input vector. The encoded data was decoded and reconstructed at the output, as is expected from an autoencoder. The result was classified using k-NN algorithm.</p><p>I trained the model using stochastic gradient descent (SGD) for 100 epochs with a learning rate of 0.1 and momentum of 0.9 and used mean square error (MSE) as cost function.</p><p>Each neuron in the hidden layer encodes and learns some features from the input which can be plotted as a feature map.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bE16J9p2I9SCFA18N-m0jA.png" /><figcaption>Feature Map — Neuron 1. Image by author</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1C0MptfnZqus2FiL847ljg.png" /><figcaption>Feature Map — Neuron 2. Image by author</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uyscz4qpOQCzl03eqZ8FTA.png" /><figcaption>Feature Map — Neuron 3. Image by author</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*18QxrQdWelT03JGeXNAnHw.png" /><figcaption>Feature Map — Neuron 4. Image by author</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o82SaPFvv1G_5vOk3Z2w-Q.png" /><figcaption>Feature Map — Neuron 5. Image by author</figcaption></figure><p>After reconstruction and classification at the output layer, the result obtained looked something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9IBxYeohi8K2luwDWYdY2g.png" /><figcaption>Reconstructed features from Autoencoder using k-NN classifier. Image by author</figcaption></figure><p>The vanilla autoencoder implementation achieved an overall accuracy (OA) of 70%. This might not seem very impressive as the model used was very simple but can certainly be improved with a more complex network architecture. Some parallel work has shown that multi-layer autoencoder networks perform better than their vanilla counterparts. Also, it is not enough to just comment on the OA of the whole image but individual accuracy of each class should also be commented on. As is evident from the classification result, field (yellow) and forest (dark green) have the most accurate classifications while grassland (light green), streets (blue) and city (red) have varied classification errors. The possible reason for this is besides the nature of the PolSAR data captured, the fact that the forest and field have highest number of samples to train on, also leads to reduction in the error. In fact, the class wise accuracy results are comparable even when different conventional techniques are applied for feature extraction. On reducing the dimensionality of data using t-sne, the result evidently shows how fields, forest and grassland are classified better than city and streets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*K8c3bedtC8A2v9IhGejnnw.png" /><figcaption>Dimensionality reduction by t-sne. Image by author</figcaption></figure><p>One might also ask, why use autoencoder when you can use CNN and achieve better results? Well, it makes sense to use a CNN if the data was much bigger than what was used for training purpose. For such a small dataset, a CNN seemed a little overkill and might have led to overfitting. Autoencoder provided a better solution and it is almost certain that with a slightly more complex network, the model would extract features more accurately than it currently does (this also remains as a future enhancement!).</p><p>Autoencoders are not as widely used in real-world application and when used only finds applications in data denoising, dimensionality reduction and variational autoencoders. However, I think they are very simple and can be used efficiently for feature extraction and the fact that they are unsupervised makes them an attractive choice for applications that do not have high quality labels available, like in remote sensing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e00b1c8d0d2e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part(1/2) : What and How of Autoencoders]]></title>
            <link>https://anupamarajkumar.medium.com/part-1-2-what-and-how-of-autoencoders-5b0045a9d480?source=rss-6f18fa3a316------2</link>
            <guid isPermaLink="false">https://medium.com/p/5b0045a9d480</guid>
            <category><![CDATA[unsupervised-learning]]></category>
            <category><![CDATA[autoencoder]]></category>
            <category><![CDATA[implementation]]></category>
            <dc:creator><![CDATA[Anupama Rajkumar]]></dc:creator>
            <pubDate>Mon, 07 Sep 2020 20:21:16 GMT</pubDate>
            <atom:updated>2020-12-22T08:31:50.369Z</atom:updated>
            <content:encoded><![CDATA[<h3>Part(1/2) : What and How of Autoencoders</h3><p>An autoencoder is a neural network that consists of an input layer, one or more hidden layer(s) and an output layer, pretty much like any other neural network that you may have heard of or worked with.</p><p>But there are some very specific characteristics that an autoencoder possesses which makes it unique and they are:</p><ol><li>The input and output layers of an autoencoder always have the same dimension. The hidden layer can be any dimension(preferably lesser than the input and output layers) but the input and the output dimensions should always match! Why is it so? Read on to find out!</li><li>Another distinct feature of an autoencoder is that unlike other popularly used neural networks, it is <strong>unsupervised. </strong>This means that an autoencoder does not need label information and this makes them particularly useful for some tasks that need to learn features or extract representations</li></ol><h3>Architecture of an Autoencoder</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/552/1*wwbZ0cqrC_nL5sDFggMZow.png" /><figcaption>A Vanilla Autoencoder. Image by author</figcaption></figure><p>The figure represents the simplest possible autoencoder architecture possible. Such autoencoders are called vanilla autoencoders and can be used to understand the principle of the network quite well.</p><p>As already mentioned in the characteristics, the network contains an input, a hidden and an output layer and the input and output dimensions are the same ie. 9 in this case. The reason for these dimensions to be strictly same can be justified by understanding how an autoencoder works.</p><p><strong>Encoder:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/545/1*2JUHDyUxlizZmnCR4SbgEg.png" /><figcaption>Encoder in an Autoencoder. Image by author</figcaption></figure><p>The input portion of an autoencoder behaves like an encoder. That is, the use of a non linear activation function can encode the input data which gets stored in the hidden layer.</p><p>In form of equations, these can be represented as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/131/1*0T_kh3Fekb-3bsZFhb985A.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/124/1*XC__Z4tng8Z9aE0UK8ewMw.gif" /></figure><p>where:</p><p>x : input data</p><p>y : encoded values</p><p>b1 : input bias</p><p>W : input-to-hidden layer weights</p><p>f() : non-linear activation function, sigmoid in this case</p><p><strong>Decoder:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/541/1*5jp_2zT5J2Kp-EuxUyCXyQ.png" /><figcaption>Decoder in an Autoencoder. Image by author</figcaption></figure><p>The output portion of autoencoder decodes the information that has been stored in the hidden layer in encoded format. An autoencoder reconstructs the output that is as close as possible to the input (ideally same as input). This is the reason why the output and input dimensions must match.</p><p>In form of equations, these can be represented as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/135/1*XYSlNoMkVhDvuF4Wy3dqFw.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/165/1*RRKGHnVwVa_OqhB_CVMyVQ.gif" /></figure><p>where:</p><p>y : encoded value stored in the hidden layer</p><p>z : output of autoencoder</p><p>b2 : hidden layer bias</p><p>W` : transpose of input-to-hidden layer weights</p><p>f() : non-linear activation function</p><p>E(W,b) : mean square error cost function</p><p>The cost function E(W,b) depicts how different the reconstruction at output is from the input data. The aim of the autoencoder is to minimize the reconstruction error. At the onset, it might seem that autoencoder is a one-on-one operation that just matches output with input. However, it is during this process that the autoencoder might end up learning interesting features or representations from the input data which gets stored in the hidden layer. Choice of an appropriate non linear activation function plays an important role here. Also as the dimension of hidden layer is typically lesser than that of the input layer, it also leads to dimensionality reduction.</p><p>Backpropagation algorithm is used to reduce the cost function and the choice of cost function, whether mean square error or binary cross-entropy depends on the type of data and the application to be implemented. The same applies to the choice of the non linear activation function.</p><h3><strong>Implementation Details</strong></h3><p>In this section, I attach some snippets of implementation of an autoencoder. Some important details of implementation of an autoencoder or of any neural network for that matter revolves around the forward and backward propagation respectively.</p><p><strong>Dimensions of the vectors:</strong></p><p>It is important to note that all the data that is dealt with is always a vector or a matrix. For the autoencoder implemented here, the dimensions of the data is as follows:</p><p>input data = [9x1]</p><p>output data = [9x1]</p><p>hidden layer = [5x1]</p><p>hidden layer bias = [5x1]</p><p>output layer bias = [9x1]</p><p>input-to-hidden layer weights = [5x9]</p><p>hidden-to-output layer weights = [9x5]</p><p>As a first step for implementation, we start by initializing the variables. We initialize the weight matrix and the bias vectors to random initial values.</p><p>To implement the feedforward flow of the autoencoder, ie. the calculation of the encoded weights, we simply multiply the input values with the randomly initialized weight matrix. To this we add the bias vector which too has been randomly initialized.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1460fa4b4b66f49fb000196b916bf23a/href">https://medium.com/media/1460fa4b4b66f49fb000196b916bf23a/href</a></iframe><p>In order to reconstruct the output such that the it is a representation of the input, the error function must be reduced and backpropagation algorithm is used for this purpose. The main gist of the backpropagation algorithm is to adjust weights and biases individually. This is done using gradient descent and it can be represented as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/168/1*ZNAXIBCEPlivEnPuHsxJOQ.gif" /><figcaption>Gradient descent for weight</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/144/1*4FYoXXmnq9UUM80QQFh07Q.gif" /><figcaption>Gradient descent for bias</figcaption></figure><p>where eta is the learning rate and is one of the hyperparameters that is to be determined experimentally.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a7811f6a08318489110af71b0bba6e91/href">https://medium.com/media/a7811f6a08318489110af71b0bba6e91/href</a></iframe><p>The discussion about a neural network cannot be complete without the mention of the hyperparameters. Here our hyperparameters are the dimension of the hidden layers, the learning rate, and momentum (if used). The number of epochs over which the model is trained is also important. These values can be determined experimentally such that the error goes on reducing.</p><p>Autoencoders are one of the simplest and most popular unsupervised models. There are many versions of them but the underlining principle and essence of the neural network always remains the same.</p><p>In the <a href="https://anupamarajkumar.medium.com/part-2-2-using-autoencoders-for-feature-extraction-e00b1c8d0d2e">part 2</a> of this article I will cover the application where I used this autoencoder and will discuss the results achieved.</p><p>Until then, feel free to reach out to me if something wasn’t clear enough or needs improvement. And, happy coding!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5b0045a9d480" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting OpenCV to Work with Visual Studio on Windows]]></title>
            <link>https://anupamarajkumar.medium.com/getting-opencv-to-work-with-visual-studio-on-windows-4af622d420f2?source=rss-6f18fa3a316------2</link>
            <guid isPermaLink="false">https://medium.com/p/4af622d420f2</guid>
            <category><![CDATA[compile]]></category>
            <category><![CDATA[opencv]]></category>
            <category><![CDATA[visual-studio]]></category>
            <category><![CDATA[opencv-in-ubuntu]]></category>
            <dc:creator><![CDATA[Anupama Rajkumar]]></dc:creator>
            <pubDate>Thu, 07 May 2020 22:36:18 GMT</pubDate>
            <atom:updated>2020-05-23T08:50:49.713Z</atom:updated>
            <content:encoded><![CDATA[<p>There’s a chance (almost a certainty) that if you’re working in Robotics, Computer Vision or Machine Learning, you are required to work on Linux. In fact irrespective of the field you’re working in, Linux always plays a very important role in the life of a software developer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*b7IqnHfV--OGlz3H4ifiyQ.png" /></figure><p>There’s always been a tussle between which OS is best but when it comes to engineering and software development, Linux wins hands down and the fact that most engineering tools are based on or developed for Linux OS just proves it further.</p><p>But, having worked on Windows systems all my life, I still haven’t warmed up to Linux and I make best attempts to get my applications working on Windows before finally giving up and switching to Ubuntu. I haven’t had the heart to remove Windows from my laptop and instead operate with a dual boot.</p><p>Yet, with a lot of effort I got OpenCV working with Windows. Configuring it on Visual Studio was still quite a task. It did take a lot of time and effort and after fishing for information on gazillions of online forum, I finally succeeded. Was it worth it the effort, you’d ask? Windows for me is my comfort zone, so definitely, yeah!</p><p>So, here are the steps if you’d want to get OpenCV working with Visual Studio (17 in my case) on Windows.</p><ol><li>Download OpenCV. I use OpenCV 3.0.0. There are plenty of setups available.Pick one :)</li><li>Setting up the environment variable : Add the OpenCV path</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nE7RmrKFu5KXzpAEjWN-JA.png" /><figcaption>Adding OpenCV path to environment variables</figcaption></figure><p>3. On to Visual Studio now!</p><p>4. Start Visual Studio as an “Administrator”. It doesn’t work otherwise. Trust me, I tried!</p><p>5. Then the usual shebang, “Create a Project”</p><p>6. For OpenCV, the configuration manager should be changed to x64 instead of default x86. Irrespective of whether you’re running the code in Debug or Release mode</p><p>7. Expect a million errors now :)</p><p>8. Go to the properties of the “Project”</p><p>i. In C/C++ -&gt; General -&gt; Additional Include Directories, add <strong>C:\opencv\build\include</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lknup20sQiuuTwh_XxOAfw.png" /><figcaption>C/C++ -&gt; General -&gt; Additional Include Directories</figcaption></figure><p>ii. In Linker -&gt; General -&gt; Additional Include Directories, add <strong>C:\opencv\build\x64\vc12\lib</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i4GL3Ymi45rkyz8iZtbhxw.png" /><figcaption>Linker -&gt; General -&gt; Additional Include Directories</figcaption></figure><p>iii. Linker -&gt; Input -&gt; Additional Dependencies, add <strong>opencv_ts300d.lib;opencv_world300d.lib </strong>to the end of the list</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KVxzFk1K6IzyK0EuH_kf4Q.png" /></figure><p>And that’s all you need to get OpenCV up and running with Visual Studio on Windows.</p><p><strong>Pros:</strong></p><p>Visual Studio makes it so much more convenient. It executes cmake automatically.</p><p><strong>Cons:</strong></p><p>Visual Studios compiler is different from other open source C++ compiler versions and hence there were times when I had a successful build on VS but it crashed on those compiler because OpenCV behaves differently.</p><p><strong>P.S</strong> : I hope this read helps you solve your OpenCV problems with Visual Studio on Windows. And if there are subsequent issues that I manage solve, I would keep adding them!</p><p><strong>Edit:</strong></p><p>This is something entirely non-CV related but concerns one of the most basic file operations in C++. There are times when you’re required to iterate over files in a folder. For GNU GCC, there are headers like “dirent.h” but it is not supported by visual C++. The replacement is “filesystem”. Follow these steps to include it:</p><p>#include &lt;filesystem&gt;</p><p>namespace fs = std::filesystem;</p><p>Here’s attaching a small code snippet to show how to iterate across a directory</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tLyAhQ9ah5RwCugZ4jsC7Q.png" /></figure><p>There is a chance, however that namespace filespace will not be identified by the compiler, it can be fixed by making this small change:</p><p>Change the C++ Language Standard to the latest draft standard in C/C++ Language settings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zcztuASz3gb3jNFJebUdXQ.png" /></figure><p>Happy Coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4af622d420f2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Developing an Application of Wireless Sensor Network in Autonomous Systems]]></title>
            <link>https://anupamarajkumar.medium.com/developing-an-application-of-wireless-sensor-network-in-autonomous-systems-c758b95e977b?source=rss-6f18fa3a316------2</link>
            <guid isPermaLink="false">https://medium.com/p/c758b95e977b</guid>
            <category><![CDATA[texas-instruments]]></category>
            <category><![CDATA[open-thread]]></category>
            <category><![CDATA[wsn]]></category>
            <dc:creator><![CDATA[Anupama Rajkumar]]></dc:creator>
            <pubDate>Mon, 13 Apr 2020 20:30:25 GMT</pubDate>
            <atom:updated>2021-02-05T15:02:02.588Z</atom:updated>
            <content:encoded><![CDATA[<p>We are surrounded by Autonomous Systems. Whether it is self-driving cars or home automation system, autonomous systems is the essence of new age technology.</p><p>One of the key factors while developing an autonomous system is the exchange of data between different modules. This data exchange takes place over a sensor network and since these networks are wireless, they form Wireless Sensor Networks (WSN).</p><p>WSN consists of a collection of individual nodes that interact with their environment to sense or control physical parameters and they collaborate with each other to fulfill the task. Single nodes are incapable of performing all the tasks own their own and hence multiple nodes are required to collaborate with each other by using wireless communication.</p><p>As useful WSNs are, they come with their set of challenges. The most important being that of energy efficiency. Long duration of operation is desirable for sensor nodes in a wireless network. Since these devices operate on batteries, energy efficiency becomes even more important. Nonetheless, in the age of autonomous systems, the significance and importance of WSNs cannot be emphasized enough</p><p>There are ample opportunities to build multiple projects or varying scale to demonstrate the application of WSNs in autonomous systems. The availability of a wide variety of development boards make it easy for hobbyists and developers to bring their ideas to reality.</p><p>We developed a simulator to control the an autonomous vehicle simulated in a ROS environment using 6LOWPAN or IPv6 over Low -Power Wireless Personal Area Networks. The aim was to demonstrate the application of sensor, communication and actuation in a wireless fashion.</p><p><strong>Hardware used:</strong></p><ol><li><a href="http://www.ti.com/tool/LAUNCHXL-CC1352R1">SimpleLink™ Multi-Band CC1352R Wireless MCU LaunchPad™ Development Kit</a></li><li><a href="http://www.ti.com/tool/BOOSTXL-ULPSENSE">SimpleLink™ ULP Sense BoosterPack™</a></li></ol><p><strong>Software used:</strong></p><ol><li><a href="http://software-dl.ti.com/ccs/esd/documents/ccs_downloads.html">TI Code Composer Studio</a> (latest version available)</li><li><a href="http://www.ti.com/tool/SIMPLELINK-CC13X2-26X2-SDK">A SimpleLink SDK for the development board being used</a></li></ol><p>PS: These softwares are free for use and versions are available for Windows and Linux OS variants. Unfortunately variants are not available for macOS but we managed by using Virtual Machine with an Ubuntu 18 image on it.</p><p><strong>Hardware Features:</strong></p><ol><li><a href="http://www.ti.com/lit/ds/symlink/cc1352r.pdf"><em>CC1352R</em></a> is priced at 40 USD on the TI website. It is essentially a wireless MCU development kit. It comes with a <a href="https://www.ti.com/store/ti/en/p/product/?p=LAUNCHXL-CC1352R1">32 bit ARM Cortex processor core</a> and contains 2.4 GHz and Sub-1GHz radio for wireless applications. It supports IEEE 802.15.4g, 6LOWPAN (<a href="https://www.threadgroup.org/what-Is-thread">Thread</a>), broad band antenna supports both 868 MHz ISM band for Europe and 915 MHz ISM band for US with a single board. The best feature of this launchpad is the fact that different TI sensorboards like the ULPSense Booster pack can be directly plugged in to the launchpad and with the available TI SPI drivers can be very easily interfaced. Availability of extensive documentation and tutorials are very helpful too. More features of the board can be deciphered from the layout as shown below.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*RWKNEWR2E4XrYdmaSCZCxw.gif" /><figcaption>CC1352R Functional Diagram</figcaption></figure><p>2. Sensor boosterpacks are an easy and convenient way of adding digital sensors to your launchpad. There are multiple variants of sensor boosterpacks that can be used in tandem with CC1352R like <a href="http://www.ti.com/tool/BOOSTXL-ULPSENSE">SimpleLink™ ULP Sense BoosterPack™</a> and <a href="http://www.ti.com/tool/BOOSTXL-SENSORS">BOOSTXL-SENSORS</a> that TI has developed with Bosch-Sensortec. We chose to use ULPSense over BOOSTXL even though BOOSTXL has a gyroscope while ULPSense only has an accelerometer because BOOSTXL interfaces with CC1352R via I2C protocol and because CC1352R doen’t have SCL and SDA needed for I2C, the same needs to be implemented in software via bit banging. On the other hand, ULPSense interfaces with the launchpad via SPI and these pins are available on both boards and hence the interfacing becomes much easy. For our application, simple tweaks in the accelerometer values could give us gyroscope like features (anyways we were not looking for roll or yaw!). That is the reason we chose ULPSense.</p><p>ULPSense comes with following sensors: light sensor, potentiometer, flow meter, capacitive touch sensors, accelerometer, reed switch for use with CC1352R.</p><p><strong>What we did-</strong></p><ol><li>We used 2 CC1352R launchpad and one ULPSense. A combination of launchpad with ULPSense was named “sensor” because it was used to sense the accelermeter value. The other CC1352R was named “collector” because it collected the accelerometer value communicated via 6LOWPAN.</li><li>In this way the “collector” acted as a <a href="https://openthread.io/guides/border-router">border router</a> and we used TCP to communicate or control the autonomous car in the ROS environment.</li><li><a href="https://openthread.io/guides/border-router">OpenThread Border Router (OTBR)</a> was implemented by using OpenThread’s Docker. The sensor and collector connect to each other via thread network and communicate via IPv6. The OTBR running on the system connected to the collector acted as a gateway to allow communication of a thread network with an external network ie. in our case the ROS environment.</li></ol><p><strong>Useful Resources:</strong></p><p>The advantage of using TI boards is the availability of tutorials and various support packages. You need not write the code for entire BLE stack or 6LOWPAN (believe me, it’s not easy!). Code Composer Studio provides many preexisting modules that can be configured as per our requirement and we’re good to go. Debugging is easy as well. The resources and tutorials can be found at these links:</p><p><a href="http://dev.ti.com/tirex/explore/node?node=AAReCngrFGR8I1dYsQ2FKg__pTTHBmu__LATEST">http://dev.ti.com/tirex/explore/node?node=AAReCngrFGR8I1dYsQ2FKg__pTTHBmu__LATEST</a></p><p>P.S: This is a very small application of WSNs and we could implement this in 4 hours (developing, testing and debugging). The development board supports BLE amongst many other features and can be used to interface multiple sensor nodes with each other wirelessly. To give an example, a Google home or an Amazon Alexa can be used to interface and communicate or control various appliances in the house by using WSN — well, just saying!</p><p>Happy Coding!</p><p>The demonstration (with explanation) of this project can be found here:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FDe3b9BfosN8%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DDe3b9BfosN8&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FDe3b9BfosN8%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/4e3888c4577f7a6749b933be340091b8/href">https://medium.com/media/4e3888c4577f7a6749b933be340091b8/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c758b95e977b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>