<?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 Daniel Moraite on Medium]]></title>
        <description><![CDATA[Stories by Daniel Moraite on Medium]]></description>
        <link>https://medium.com/@daniel-moraite?source=rss-24027ddfddb2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*9AG5GdNgBFguT4c1ArRRNA.jpeg</url>
            <title>Stories by Daniel Moraite on Medium</title>
            <link>https://medium.com/@daniel-moraite?source=rss-24027ddfddb2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 10:20:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@daniel-moraite/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[Detecting Roads in Low Resolution satellite imagery]]></title>
            <link>https://daniel-moraite.medium.com/detecting-roads-in-low-resolution-satellite-imagery-58e92e23dd88?source=rss-24027ddfddb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/58e92e23dd88</guid>
            <category><![CDATA[segmentation]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[satellite-imagery]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[satellite-technology]]></category>
            <dc:creator><![CDATA[Daniel Moraite]]></dc:creator>
            <pubDate>Tue, 18 May 2021 12:28:28 GMT</pubDate>
            <atom:updated>2021-05-18T12:28:28.223Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fl3LbuAF4_y_7zoyzRCK1w.png" /></figure><p>An important part of EO/GIS is to detect infrastructure, as roads, for different purposes. <br>We have seen in the past years, with the increase of high resolution satellites and deep learning algorithms, an increase in solutions for image labelling based on high resolution datasets. Now, we still have much unexplored low resolution data that it is cheaper and might be more useful in some cases.</p><p>What I propose in this proof of concept project is to use transfer learning by training a model on an already labelled dataset of 1m resolution and then test it on 30m resolution imagery. For fun purposes I have picked the city where one needs to wear a flower in her/his hair when visiting.</p><p>First I have acquired a Landsat 8 image of San Francisco and pansharpened it to make sure I have the best results later.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uAp-c-YQ_fBNoF7f-KO4WQ.png" /><figcaption>1. pansharpened 2. raw true color</figcaption></figure><p>Secondly, I have had a look at several papers and works just to compare the results. First try was not that exciting: an Unet, a fully convolutional network, with 3 cross-connections:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-QqTyHHUth-7QPABOjiQPQ.png" /></figure><p>Second try, another U-net that got some exciting results on validation set(for different training image sizes and resolutions):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6Q_gZCuSaWrLKHQROs_ZCQ.png" /></figure><p>Testing it further on unseen data of different resolution looked also promising:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rgoUT8ctzOtJ-B_zCaXxqA.png" /></figure><p>And finally got the courage to have a shot at the SF image:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*guwa_Khtm80LlnBV_REFtA.png" /></figure><p>I would say quite good results keeping in mind the huge gap in resolution: 30x. And of course one can play further with the mask in many ways:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E0by4N_SC5wjRrfY3j-Y2Q.png" /></figure><p>Conclusion: if we would have trained the model on labeled 30m images then we would have have awesome results — who knows maybe in a year time will find such labelled data sets available.</p><p>I hope you enjoyed this! <br>Thanks! 🙏</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*enfaMKfzEXQ-f2jeGHBDMg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=58e92e23dd88" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Georeferencing satellite images using machine learning]]></title>
            <link>https://daniel-moraite.medium.com/georeferencing-satellite-images-using-machine-learning-8f469f6e614?source=rss-24027ddfddb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f469f6e614</guid>
            <category><![CDATA[gis]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[satellite-imagery]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[cnn]]></category>
            <dc:creator><![CDATA[Daniel Moraite]]></dc:creator>
            <pubDate>Mon, 17 May 2021 17:53:59 GMT</pubDate>
            <atom:updated>2021-05-17T17:53:59.266Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a5BQEkp6eQdz45cWmmTVKg.png" /></figure><p>CNN, DeepLearning, Tensorflow</p><p>Quoting *1: <strong>Georeferencing</strong> is the process of taking a digital image, it could be an airphoto, a scanned geologic map, or a picture of a topographic map, and adding geographic <strong>information</strong> to the image so that GIS or mapping software can ‘place’ the image in its appropriate real world location.</p><p>There are few ways of achieving this, though we can split them in two categories: “<em>manual</em>” and “<em>automated</em>”. When comes to manual — it means that for two images(one is part of another), one has to pick manually the points of intersection(same points found in both images) using a GIS software and then run the georeferencing process based on them. <br>This is how it would look like for images A and B:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2zM7x29tpgB1h3WIo-ZOHg.png" /></figure><p>These particular images are an exception from the norm since they are obtained via two different satellites (EU and Asian), at different resolutions (10m and 5m) which makes the pixel and RGB distribution differ which makes this problem even more complex — though the purpose of this trial is to observe the results of available automated tools. 🧰 If you want to try this on your own, I will suggest you use images from the same source.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rwDLvPLrt8JgfBi6F1D3Pw.png" /></figure><p>and the result obtained with <strong>QGIS</strong>(more or less accurate depending on the accuracy and number of points you picked as matching between the two images):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4r_RV0msvaK9fCp3gYrO9g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W_4QOlMX0fa4k8Zgmy1hfg.png" /></figure><p>Now, let’s consider the automated way of doing this:<br>1. using a <em>computer vision</em> library, and<br>2. using <em>machine learning</em></p><p>First let’s see how the method finds <strong>points of interest</strong> on the both images:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mInnPkLOWAzuM05OGDU7Lw.png" /><figcaption>check the colourful rainbow circles</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g_6NXKbzeWgcxrZusQ2iEw.png" /></figure><p>Now let’s have a look at how points are <strong>matched</strong> between <strong>same</strong> images:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g0i6xoH5JpL4Upsm39ZUpw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dvKmPwU8ZOAnuhNyoYTehg.png" /></figure><p>Now, the points above matched by the lines should be the same, which means there is need for further tuning of parameters, which will leave for other time.</p><p>Finally, we can check how a deep learning algorithm would work:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P3IQj9kdrm_D4V7ogkp7oQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1UK5HDekzvWHYhB3pxoA_A.png" /></figure><p>Keeping in mind that we are using a little bit of transfer learning, which means model was trained on images that have a different pixel distribution, plus our two images differ from one another — we could consider this first attempt quite promising. To verify if this works better on images with same distribution we crop a smaller part from first image and will see better results bellow:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2A3q2NZ6DCxZl_SBlMVXzA.jpeg" /></figure><p>and based on the points and lines/matches detected by the algorithm we can also have a general mosaic preview:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EqWt6c8JBnk0Reb_ofFHbw.png" /></figure><p>We can see that the second image, that needs to be georeferenced was warped accordingly — slightly off — though closer to what we are expecting. Further tuning and image pre-processing could bring you to 💯 match. So far we are happy to discover new deep learning tools that can help GIS.</p><p>The imperfect examples above are just to show a few steps that can be taken when comes about georeferencing satellite imagery of different resolution and origin. Maybe a better example would have helped, though limited time on my hands brings you only a proof of concept.</p><p>I hope you’ve enjoyed it.</p><ul><li>1: <a href="https://serc.carleton.edu/research_education/geopad/georeferencing.html#:~:text=Georeferencing%20is%20the%20process%20of,its%20appropriate%20real%20world%20location.">Georeferencing - SERC/Carleton College https://serc.carleton.edu</a>;</li><li>2: OpenCV: Point Feature Matching;</li><li>3: CNN Papers: “Learning-local-features-from-images”, “A semi-automatic tool to georeference historical landscape images”, “Detecting Ground Control Points via Convolutional Neural Network”;</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*U-vmzzWb4S0Cz_ojRXFhJg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f469f6e614" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Anomaly Detection in SAR imagery]]></title>
            <link>https://medium.com/dataseries/anomaly-detection-in-sar-imagery-91778de5df0c?source=rss-24027ddfddb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/91778de5df0c</guid>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[synthetic-aperture-radar]]></category>
            <category><![CDATA[satellite-imagery]]></category>
            <category><![CDATA[generative-adversarial]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Daniel Moraite]]></dc:creator>
            <pubDate>Mon, 29 Jun 2020 11:35:18 GMT</pubDate>
            <atom:updated>2020-06-29T11:37:02.412Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sUI4DHjwdUousMSkEgWw1A.png" /></figure><p>Synthetic Aperture Radar Satellite Imagery</p><p><em>“SAR is a form of </em><strong><em>radar </em></strong><em>that is used to create two-dimensional images or three-dimensional reconstructions of objects, such as landscapes. </em><strong><em>SAR </em></strong><em>uses the motion of the </em><strong><em>radar </em></strong><em>antenna over a target region to provide finer spatial resolution than conventional beam-scanning </em><strong><em>radars</em></strong><em>.” Wikipedia</em></p><p>Synthetic Aperture Radar can be quite a great tool since it is used to see through clouds, and does not depend on day or night.</p><p>My purpose for this test is to understand if satellite SAR imagery can obtain similar results as with optical images when it comes to detecting anomalies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*dZ0vOtKSF00JIuaLvir_Gg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*LOLDVP3lckcmgJbdwta0zA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*W-CZ7EI_3Hi2GTz1LxdwyQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*Wv-LnzG6gbtItqyqOEMhxA.png" /></figure><p><strong>Conclusions</strong></p><p><strong>SAR through the looking glass</strong></p><p>As you can see, more clearly in the farmland example, the anomaly(around what looks like a gas station-could be vehicles) has a higher score than the rest of the images.</p><p>In order to obtain the results above, I have been using: — Rasterio, Numpy, Keras, Matplotlib, Python.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*BLE5i1M2k60vzi5E2F2LYA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=91778de5df0c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/dataseries/anomaly-detection-in-sar-imagery-91778de5df0c">Anomaly Detection in SAR imagery</a> was originally published in <a href="https://medium.com/dataseries">DataSeries</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Clustering on SAR Satellite Imagery]]></title>
            <link>https://medium.com/dataseries/clustering-on-sar-satellite-imagery-3762fa444a6d?source=rss-24027ddfddb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/3762fa444a6d</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[synthetic-aperture-radar]]></category>
            <category><![CDATA[unsupervised-learning]]></category>
            <category><![CDATA[satellite-imagery]]></category>
            <category><![CDATA[satellite-technology]]></category>
            <dc:creator><![CDATA[Daniel Moraite]]></dc:creator>
            <pubDate>Mon, 29 Jun 2020 11:01:03 GMT</pubDate>
            <atom:updated>2020-06-29T11:36:14.312Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/761/1*qhwNJFL-m-i_m_O_85GLyg.png" /></figure><p>Unsupervised Learning</p><p>Synthetic Aperture Radar can be quite a great tool since it is used to see through clouds, and does not depend on day or night.</p><p><em>“SAR is a form of </em><strong><em>radar </em></strong><em>that is used to create two-dimensional images or three-dimensional reconstructions of objects, such as landscapes. </em><strong><em>SAR </em></strong><em>uses the motion of the </em><strong><em>radar </em></strong><em>antenna over a target region to provide finer spatial resolution than conventional beam-scanning </em><strong><em>radars</em></strong><em>.” Wikipedia</em></p><p>My purpose for this test is to understand if SAR imagery can obtain similar results as optical images when it comes to clustering.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*4cPFRvKqmHhuT847x4E7iw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*cba5plFmPNMUcQn6g8vkAw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*vsB0tJgKeoHEZ1ExhpFj3w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*KAF28qUFEteA7Lb3NhNfFQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*7eumWx39igysT0iSFP33YA.png" /></figure><p><strong>Conclusions</strong></p><p><strong>SAR through the looking glass</strong></p><p>As you can see, more clearly in the river example, the clusters chosen have worked just fine, though in the agricultural land the increasing of clusters deterred it.</p><p>In order to obtain the results above I have been using: <br> — Rasterio, Numpy, Scikit-learn, KMeans, Matplotlib, Python.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*BLE5i1M2k60vzi5E2F2LYA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3762fa444a6d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/dataseries/clustering-on-sar-satellite-imagery-3762fa444a6d">Clustering on SAR Satellite Imagery</a> was originally published in <a href="https://medium.com/dataseries">DataSeries</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Machine Learning for Preventing Deforestation]]></title>
            <link>https://medium.com/dataseries/machine-learning-for-preventing-deforestation-8a4324e81d05?source=rss-24027ddfddb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a4324e81d05</guid>
            <category><![CDATA[deforestation]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[convolutional-network]]></category>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[satellite-imagery]]></category>
            <dc:creator><![CDATA[Daniel Moraite]]></dc:creator>
            <pubDate>Mon, 15 Jun 2020 20:21:27 GMT</pubDate>
            <atom:updated>2020-06-15T20:21:27.737Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/536/1*DsbSTZrAEwjSE12V91R50g.png" /></figure><h4>Convolutional Neural Networks</h4><p>“Forests cover <a href="https://www.nationalgeographic.com/environment/global-warming/deforestation/">30% </a>of the world’s land area.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*l0RGgcmMeT2JDQVkKZI5cA.png" /><figcaption>Daniel Moraite 2020</figcaption></figure><p>“Deforestation is the 50% loss of the world’s tree count. People cut down <a href="http://time.com/4019277/trees-humans-deforestation/">15 billion trees</a> every year. “ Long-term, it worsens climate change.</p><p>“Deforestation costs <a href="https://www.thebalance.com/deforestations-economic-impact-4163723">$4.5 trillion each year</a> through the loss of biodiversity and it has eliminated habitat for millions of species. In fact, 80% of Earth’s land animals and plants live in forests.”</p><p><strong>Solution: </strong>identify deforestation equipment in satellite images and prevent deforestation before it happens.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/454/1*BgKifMx-abRZ8Xvvyp_RKQ.png" /><figcaption>Daniel Moraite 2020</figcaption></figure><p>I have chosen a supervised approach, manually labeling positive and negative classes, and augmenting with the use of Keras.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/447/1*TJPMGqq9WAPd-SfSOh3SYA.png" /><figcaption>Daniel Moraite 2020</figcaption></figure><p>When it comes to data resources, it can be achieved by the use of:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*COAx3yGOpLsipGG5mnAvYg.png" /><figcaption>Daniel Moraite 2020</figcaption></figure><p>After training the neural network model, built with 2D Convolution Layers, the following objects were classified with a very good score:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/423/1*vBSSak8m6X9EI-cG4vG6mQ.png" /><figcaption>Daniel Moraite 2020</figcaption></figure><p>As you can see below, the model has no problem with identifying the needle in the haystack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/423/1*69J9-oEkj7xBOBlkV211ww.png" /><figcaption>Daniel Moraite 2020</figcaption></figure><p>For demo purposes, the test images were collected via the internet(as the watermarks makes it clear).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/1*fxn1slyC6JJjfpusUZ5wqg.png" /><figcaption>Daniel Moraite 2020</figcaption></figure><p>I hope you’ve enjoyed this quick look at what can be possible in the deforestation regards and of course, can be applied to other industries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/1*n3q12qzhXcOsi56_92CAHw.png" /><figcaption>Daniel Moraite 2020</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a4324e81d05" width="1" height="1" alt=""><hr><p><a href="https://medium.com/dataseries/machine-learning-for-preventing-deforestation-8a4324e81d05">Machine Learning for Preventing Deforestation</a> was originally published in <a href="https://medium.com/dataseries">DataSeries</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Anomaly detection in Satellite Imagery]]></title>
            <link>https://medium.com/dataseries/anomaly-detection-in-satellite-imagery-e81fcf08abb8?source=rss-24027ddfddb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/e81fcf08abb8</guid>
            <category><![CDATA[gans]]></category>
            <category><![CDATA[anomaly-detection]]></category>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[generative-adversarial]]></category>
            <dc:creator><![CDATA[Daniel Moraite]]></dc:creator>
            <pubDate>Mon, 15 Jun 2020 20:00:11 GMT</pubDate>
            <atom:updated>2020-06-15T20:21:39.853Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*ikP7vX9pIFnVXw2m5QziJw.png" /></figure><h4>Deep convolutional generative adversarial networks, GANs</h4><p>I have been recently inspired by <a href="https://omdena.com/projects/anomaly-detection-mars/">Omdena</a>’s last summer&#39;s challenge, to detect anomalies on Mars surface, and thought to spot, using GANs, any type of technological signature detected around forests for deforestation purposes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/457/1*vkChJygiFYKMvCF6GumT6A.png" /></figure><p>Why an unsupervised approach? because of the challenges in the data set:<br> a. data collections and no predefined labeled dataset, forest ‘surface’ is very diverse, the same ‘surface’ in different seasons looks very different,<br> b. data imbalance, forest surface has millions of square kilometers and on this surface, we have to spot anomalies measuring not more than a few 10s of feet each. Let us have a quick look at the generator and discriminator models structure:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*u4TN10Q5y_Md7lmCtH6bbg.png" /><figcaption>Daniel Moraite 2020</figcaption></figure><p>I have chosen RGB images and trained using all 3 channels. Though since I don’t want to create too much of a carbon print (would be ironical: saving trees though creating more carbon in the process) I have chosen to train for 20 epochs. Of course, keep in mind this is a demo and it all depends on the data and project purposes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*nXtj1ncPkjjNLb2krfx0zw.png" /><figcaption>Daniel Moraite 2020</figcaption></figure><p>After training the GANs I have a test. As you can see above: I have computed the anomaly score on a sample from the test set, as well on unseen data, and had a quick look at the generated images. Now, time to test on unseen complex images(and I get promising results):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*UULjd9dlE47-5usbWwpvUA.png" /><figcaption>Daniel Moraite 2020</figcaption></figure><p>Observations: natural/forest data has a lover anomaly score, while technological signature data/objects have a higher score:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*Spq8BidnbBi7oYZo4BbPIg.png" /><figcaption>Daniel Moraite 2020</figcaption></figure><p>Conclusions: it can be quite useful and definitely worth a look at.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*lXNSDUZqBc8AVez4_1tXIg.png" /><figcaption>Daniel Moraite 2020</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e81fcf08abb8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/dataseries/anomaly-detection-in-satellite-imagery-e81fcf08abb8">Anomaly detection in Satellite Imagery</a> was originally published in <a href="https://medium.com/dataseries">DataSeries</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unsupervised Learning]]></title>
            <link>https://medium.com/dataseries/unsupervised-learning-cd0b78adbf7c?source=rss-24027ddfddb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/cd0b78adbf7c</guid>
            <category><![CDATA[unsupervised-learning]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[clustering]]></category>
            <category><![CDATA[satellite-technology]]></category>
            <category><![CDATA[satellite-imagery]]></category>
            <dc:creator><![CDATA[Daniel Moraite]]></dc:creator>
            <pubDate>Mon, 01 Jun 2020 08:33:58 GMT</pubDate>
            <atom:updated>2020-06-01T08:33:58.317Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/484/1*mibvkFIu0_u5hbYuRjFN9g.png" /></figure><h4><strong>Clustering for Satellite Imagery</strong></h4><p>As you have seen in my previous work for classifying objects in satellite imagery, deep learning is used, and it does achieve good results, though it has a high dependency on the amount of available data, and more exactly labeled data.</p><p>Remote sensing creates a huge amount of data every day which mostly lacks annotations. The data complexity and the lack of a well-defined typology make it impossible to use supervised tools. And here is where clustering methods come in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1021/1*f7hqKYxP4KKc_dmm_lPykQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1021/1*IiZ0HWpGS9lwJ13Yb92X-g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1021/1*U-Siu0HeOy_XQaOwixEgcw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1021/1*2Ltl-_nCie8BjxKscPZUKw.png" /></figure><p><strong>For better results:</strong></p><p><strong>Using all the bands available</strong></p><p>For example, Sentinel 2 has up to 13 spectral bands available and this extra information can bring more clarity to the algorithm and eliminate noise.</p><p>Bellow, I will use all the 3 bands available for clustering and compare the results with the clustering obtained for using only 1 band.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1021/1*WH2K9mji0ZyD0rFw2DYBmQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1021/1*q_1HHgztd9yDUjWPQeG0GQ.png" /></figure><p><strong>Conclusions</strong></p><p><strong>Using all the bands available</strong></p><p>In order to obtain the results above I have been using: <br> — images from both Planet and Sentinel <br> — Rasterio, Numpy, Scikit-learn, KMeans, Matplotlib, Python.</p><p>One can save the resulted images as a GeoTIFF <br> (either using rasterio or gdal) and it can be imported into a GIS platform for further study and classification.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/1*CmgwcB1JShImrsIwAuyguQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cd0b78adbf7c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/dataseries/unsupervised-learning-cd0b78adbf7c">Unsupervised Learning</a> was originally published in <a href="https://medium.com/dataseries">DataSeries</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Wind Turbines in Satellite Imagery]]></title>
            <link>https://medium.com/dataseries/wind-turbines-in-satellite-imagery-dac1304a473d?source=rss-24027ddfddb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/dac1304a473d</guid>
            <category><![CDATA[wind-energy]]></category>
            <category><![CDATA[renewable-energy]]></category>
            <category><![CDATA[electric-energy-suppliers]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[wind-turbine]]></category>
            <dc:creator><![CDATA[Daniel Moraite]]></dc:creator>
            <pubDate>Tue, 26 May 2020 20:46:07 GMT</pubDate>
            <atom:updated>2020-05-26T20:46:07.985Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/531/1*iXMZlK6dl7a4Vth2mFEMGA.png" /></figure><h3>Classifying Wind Turbines in Satellite Imagery with use of Machine Learning Neural Networks and calculating their Orientation with Computer Vision</h3><p>Modern wind turbines are designed to automatically orient themselves to face the direction of the wind, in order to maximise power generation. A ‘black box’ collects this orientation data and transmits the telemetry back to the wind turbine operators. This telemetry is crucial for revealing faults and whether the turbine requires maintenance. <br> <br>During the course of a wind turbine’s lifetime, these black boxes can fail and prove costly to replace. Sometimes the telemetry is inaccurate, and operators wish to validate the accuracy of these orientation measurements by comparing them to other data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/1*-H6ZcsukTJl5wqm_fQAswQ.png" /></figure><p>This article will have a brief look at how to use Earth observation data in order to measure the turbine pointing direction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*CPoIHtPXiTlRW4e1KADvaA.png" /></figure><p>Will classify turbines in satellite images and calculate the bearing angle, using machine learning and computer vision.</p><p>Data used: about the locations of a few thousand wind turbines in the UK. Images corresponding to some of these turbines.</p><p>Here are a few proposed steps:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*5bfFklyAn90REPj8JGj1vA.png" /></figure><ul><li>Extracting the features from images</li><li>Preparing the input and output data for the model</li><li>Further preparation for building the model</li><li>Building the neural network and training</li><li>Testing the model on a satellite image</li><li>Predicting classes and calculating angles</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/491/1*2cMrbKIPfLLUT3gB25izdg.png" /></figure><p>For this presentation purpose: the test images used are collected via Google.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*UPZw2K19zD8qHynmJ8f9fQ.png" /></figure><p>Depending on the resolution of the images, one searches on, one might consider resizing the training images accordingly.</p><p>For building the MVP it has been useful a direct approach to using python, NumPy, pandas, matplotlib, Keras and cv2.</p><p>The final conclusion is that this approach is achievable for augmenting the energy companies with other types of data that can provide easier and better insights into monitoring a wind turbine farm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u_wbWg7SZFdvfliFRS74pg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CYN5Er4hmUnCbN8DYLJlww.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dac1304a473d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/dataseries/wind-turbines-in-satellite-imagery-dac1304a473d">Wind Turbines in Satellite Imagery</a> was originally published in <a href="https://medium.com/dataseries">DataSeries</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Satellite Imagery Timelapses]]></title>
            <link>https://medium.com/analytics-vidhya/satellite-imagery-timelapses-4e9f5ec412b7?source=rss-24027ddfddb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e9f5ec412b7</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[satellite-technology]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[satellite-imagery]]></category>
            <dc:creator><![CDATA[Daniel Moraite]]></dc:creator>
            <pubDate>Mon, 27 Jan 2020 04:57:29 GMT</pubDate>
            <atom:updated>2020-01-27T04:57:29.501Z</atom:updated>
            <content:encoded><![CDATA[<p>and.. pandas!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/419/1*wOnvmPg39BNVXQqihdE-8Q.gif" /></figure><p>The new year has started and we are all already in the fever of doing things. So I thought I’ll have a fun post for this weekend!</p><p>And it will be, of course, about pandas, solar farms and time-lapses!</p><p>How I came about it, just by keeping an eye on what happens in the renewables area, and I quote from the <a href="https://www.businessinsider.com/china-panda-shaped-solar-energy-farms-project-2018-6">article</a>:</p><blockquote><em>In 2017, the groups built a 248-acre solar power plant in Daton, China, that looks from above like two smiling pandas. Now the UN, Panda Green Energy, and the Chinese government are on a mission to build 99 more similar solar farms across China.</em></blockquote><p>Looking forward to the future solar farms, meanwhile, let’s start the fun:</p><h3>Setup</h3><ul><li>install Sentinel Hub</li><li>install eo-learn</li></ul><p>(please find below, under resources, the links for the above)</p><h4>Data Extraction</h4><p>You’ll find details of how to get your area of interest AOI coordinates in my previous: <a href="https://danielmoraite.github.io/docs/satellite1.html">Satellite Imagery Analysis with Python I</a> post. Just make sure you select from the menu: meta, respectively add bboxes.</p><p>Define ROI BBOX and time interval Request different types of layers and data sources to an eopatch</p><pre>roi_bbox = BBox(bbox=[113.4705, 39.9697, 113.4951, 39.9871], crs=CRS.WGS84)<br> time_interval = (&#39;2017-02-01&#39;, &#39;2017-08-01&#39;)</pre><p>Tasks of the workflow: — download S2 images (all 13 bands) — filter out images with cloud coverage larger than a given threshold (e.g. 0.8, 0.05)</p><pre>layer=&#39;BANDS-S2-L1C&#39;<br>  ​<br>wcs_task = S2L1CWCSInput(layer=layer, <br>                           resx=&#39;5m&#39;,<br>                           resy=&#39;5m&#39;,<br>                           maxcc=.05, time_difference=datetime.timedelta(hours=1))<br>  ​<br>save = SaveToDisk(&#39;timelapse_example&#39;, overwrite_permission=2, compress_level=1)</pre><p>Build and execute timelapse as a chain of transforms</p><p>Feel free to set the max cloud coverage from 0.8 to 0.05 in case the area and timeframes you chose does not have enough 0.8 cc. Otherwise, it will look as bellow(which is kind of trippy):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/506/0*PPAspaG5BGMaX8wx.gif" /></figure><pre>timelapse =LinearWorkflow(wcs_task, save)<br>  ​<br>result = timelapse.execute({<br>   wcs_task: {&#39;bbox&#39;: roi_bbox, &#39;time_interval&#39;: time_interval},<br>                          save: {&#39;eopatch_folder&#39;: &#39;eopatch&#39;}})</pre><p>Get result as an eopatch</p><pre>eopatch = result[save]<br>eopatch</pre><pre>EOPatch(<br>    data: {<br>      BANDS-S2-L1C: numpy.ndarray(shape=(4, 387, 419, 13), dtype=float32)<br>    }<br>    mask: {<br>      IS_DATA: numpy.ndarray(shape=(4, 387, 419, 1), dtype=bool)<br>    }<br>    scalar: {}<br>    label: {}<br>    vector: {}<br>    data_timeless: {}<br>    mask_timeless: {}<br>    scalar_timeless: {}<br>    label_timeless: {}<br>    vector_timeless: {}<br>    meta_info: {<br>      maxcc: 0.05<br>      service_type: &#39;wcs&#39;<br>      size_x: &#39;5m&#39;<br>      size_y: &#39;5m&#39;<br>      time_difference: datetime.timedelta(0, 3600)<br>      time_interval: (&#39;2017-02-01&#39;, &#39;2017-08-01&#39;)<br>    }<br>    bbox: BBox(((113.4705, 39.9697), (113.4951, 39.9871)), crs=EPSG:4326)<br>    timestamp: [datetime.datetime(2017, 4, 1, 3, 18, 46), ..., datetime.datetime(2017, 7, 30, 3, 21, 38)], length=4<br>  )</pre><p>Function to create GIFs</p><pre>import imageio, os<br>  ​<br>def make_gif(eopatch, project_dir, filename, fps):<br>&quot;&quot;&quot;<br>Generates a GIF animation from an EOPatch.<br>&quot;&quot;&quot;<br>with imageio.get_writer(os.path.join(project_dir, filename), mode=&#39;I&#39;, fps=fps) as writer:<br>           for image in eopatch:<br>               writer.append_data(np.array(image[..., [3, 2, 1]], dtype=np.uint8))</pre><p>Write EOPatch to GIF</p><pre>make_gif(eopatch=eopatch.data[&#39;BANDS-S2-L1C&#39;]*2.5*255, project_dir=&#39;.&#39;, filename=&#39;eopatch_timelapse1.gif&#39;, fps=1)</pre><pre>from IPython.display import Image<br>​<br>Image(filename=&quot;eopatch_timelapse.gif&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/0*wPTjndkZ7ktFUoUJ.gif" /></figure><p># <em>London during spring months as seen in the gif above.</em></p><p>Please find the entire code <a href="https://github.com/DanielMoraite/DanielMoraite.github.io/blob/master/assets/panda.ipynb">here</a>.</p><p>Feel free to pick your own coordinates. You might want to play with the time frame as well.</p><h4>Resources:</h4><ul><li><a href="https://eo-learn.readthedocs.io/en/latest/index.html">documentation for eo-learn</a></li><li><a href="https://github.com/sentinel-hub/eo-learn">eo-learn github</a></li><li>would recommend copying the eo-learn github repository on your drive</li><li><a href="https://services.sentinel-hub.com/oauth/subscription?param_redirect_uri=https://apps.sentinel-hub.com/dashboard/oauthCallback.html&amp;param_state=%2Fconfigurations&amp;param_scope=SH&amp;param_client_id=30cf1d69-af7e-4f3a-997d-0643d660a478&amp;origin=">sentinelhub create account</a></li><li><a href="https://www.sentinel-hub.com/faq/where-get-instance-id">sentinelhub instance ID</a></li><li><a href="https://pypi.org/project/sentinelhub/">sentinelhub install</a></li></ul><p>Notes:</p><pre># SentinelHub API Key (instance id) stored as an env variable(if you want to call it from your notebook):        <br>    import os<br>    os.environ[&#39;INSTANCE_ID&#39;]=&#39;your instance ID&#39;<br>    INSTANCE_ID = os.environ.get(&#39;INSTANCE_ID&#39;)</pre><p>Feel free to go PAAAANDAAAS!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e9f5ec412b7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/satellite-imagery-timelapses-4e9f5ec412b7">Satellite Imagery Timelapses</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploy Neural Network with Flask, Docker and AWS Beanstalk]]></title>
            <link>https://medium.com/data-science/deploy-neural-network-with-flask-docker-and-aws-beanstalk-6fd34373497a?source=rss-24027ddfddb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/6fd34373497a</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[flask]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Daniel Moraite]]></dc:creator>
            <pubDate>Mon, 13 Jan 2020 00:16:07 GMT</pubDate>
            <atom:updated>2020-01-24T15:00:34.790Z</atom:updated>
            <content:encoded><![CDATA[<h4>How to deploy a machine learning multi-class classification Keras model for predicting voice sentiment.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/1*dPJ7JGEWHZYw0ULR4cdpAg.png" /></figure><p>Part I: <br>build the NN model, the Flask application and include Html, CSS, js for the voice recorder.</p><p>Part II: <br>how to choose the right configuration for your Docker image.</p><p>Part III: <br>deploy on AWS Elastic Beanstalk and how to adjust the voice recorder.</p><p>All the above contains common troubleshoots as well. Some of them you’ll find on my <a href="https://stackoverflow.com/users/11541027/daniel-moraite">StackOverflow</a>.</p><p><strong>Part I</strong>:<br>Why voice sentiment? Due to exponential growth in technology in the past decade, lifestyle has changed and people demand faster and easier to use services. Many companies do renew contracts and get customer agreement legally valid only through a phone call. Not to mention all the marketing, customer success and sales use. And it became quite necessary to predict what your customer sentiment is from a voice input/phone call.</p><p>Now let’s go through the voice sentiment model.<br>Data sets for training the model: contains different speakers, mostly actors, in a controlled environment and do convey the following sentiments, for both female and male: <strong>angry, disgust, fear, happy, neutral, sad, surprised</strong>. (14 classes — since it’s always wise to train female separate from male voice).</p><p>To extract and transform the data features(Mel frequency cepstral coefficients:<em> MFCC</em>) from the audio I have used <em>LibROSA</em>. Building the <strong>model </strong>using<strong> </strong>Keras: <em>Sequential</em> with <em>Conv1D</em> layers with <em>BatchNormalization</em>, <em>Dropout,</em> and <em>MaxPooling1D</em>. Feel free to have your try on my <a href="https://www.kaggle.com/dannydoeslight/voice-sentiment-a-quick-look">Kaggle kernel</a>.</p><p><strong>Flask application</strong>: requests the data from the user and saves it as a WAV file which is processed and predicted later. <br>A couple of things to keep in mind here:</p><ul><li>make sure the name of your application file is: <em>application.py</em> and application=FLASK(__name__)</li><li>when it comes to Keras and Flask: you will find out that <strong>Keras is not thread-safe</strong> and you will need to usemodel._make_predict_function()<br>Why is this happening and how to solve it, find it on <a href="https://stackoverflow.com/questions/53391618/tensor-tensorpredictions-softmax0-shape-1000-dtype-float32-is-not-an/59238039#59238039">my StackOverflow solution</a> (and here you got so <a href="https://stackoverflow.com/questions/40850089/is-keras-thread-safe/59237758#59237758">pros and cons </a>of using the above).</li></ul><p>Find the Html, CSS, and <strong>js</strong> for <strong>voice recorder</strong> at my <a href="https://github.com/DanielMoraite/NN-Deploy-with-Docker-and-AWS-Beanstalk">Github repo</a>. You can modify the recording time in recapp.js, just remember that 1 second=1000 milliseconds: setTimeout(function(){console.log(&quot;Recording:time up&quot;);stopRecording();},4000);</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/1*H6YV42qwH9N5VZKB2-T0FA.png" /></figure><p><strong>Part II</strong>: <br>I have first deployed the Flask app with AWS Beanstalk and found that the server error log is not that detailed and clear about errors and so I have found Docker error log to be quite useful.</p><p>Of course, Docker comes with many other all in one tool and functions that makes it somehow easier and more compact for building an environment.</p><p>This will help you with making the right choices when comes about building Docker images and dealing with troubleshooting:</p><ul><li>think from the start about the container/image size constraints and pick the right version for your python image. You will set this up in your Dockerfile:FROM python:3.6-slim(note: will avoid Alpine Linux for now due to some misfits: much fewer libraries, a different C library, etc.). <br>The only thing about picking the slimmest version is that you might need to install some libs/dependencies. And it can be quite cumbersome … python dependencies as SoundFile for LibROSA, GCC, etc..</li><li>you might need to install system packages and for that, you will need to install sudo. Side note: don’t forget to use <em>-y</em> for when prompted Y/N, otherwise it aborts the install if no possible input from the keyboard.</li><li>for audio install <em>libsndfile1-dev</em> (this should solve all the problems for Linux and Ubuntu).</li><li>make sure you run everything under a single RUN to avoid the creation of intermediate images:</li></ul><pre>RUN apt-get update &amp;&amp; \<br>      apt-get -y --no-install-recommends install sudo &amp;&amp; \<br>      sudo apt-get -y --no-install-recommends install libsndfile1-dev &amp;&amp; \<br>      pip install --no-cache-dir -r requirements.txt &amp;&amp; \<br>      sudo rm -rf /var/lib/apt/lists/*</pre><ul><li>to make sure packages do not install unsolicited dependencies: <br>- sudo --no-install-recommends orpip instal --no-deps #no dependencies though this can be cumbersome when dealing with Tensorflow and Keras (as Scikit-learn, SciPy, etc.)<br>- pip instal --no-cache-dir can be helpful with that extra cache, <br>- as well for cleaning leftovers: sudo rm -rf /var/lib/apt/lists/*</li><li>other lines in your Dockerfile should cover the rest of the application as:</li></ul><pre>WORKDIR /deploy/   # pick your working directory<br>COPY . .           # useful for copying all folders and subfolders</pre><pre>EXPOSE 5000        # set port 5000 for Flask app<br>CMD [“python”, “application.py”]  #application to be run</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/1*Exk6Yjty09EgkxXAUr0fqA.png" /></figure><p><strong>Part III</strong>:<br>Amazon Web Services and Elastic Beanstalk seemed like a good choice.</p><p>I have followed all the instructions for creating a single container docker environment <a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/single-container-docker.html">here</a>.</p><p>If you use the AWS console then things are quite easy. If you AWS/EB CLI then make sure you set the path after installing EB CLI:</p><pre>echo &#39;export PATH=&quot;/Users/Daniel/.ebcli-virtual-env/executables:$PATH&quot;&#39; &gt;&gt; ~/.bash_profile &amp;&amp; source ~/.bash_profile</pre><p>You create a new application and environment in beanstalk, uploading the archive/zip of your docker app folder contents. From the console you can modify the capacity, the <em>instances</em> you want to use, <em>environment type</em>(load balancing, autoscaling) and so on.</p><p>Now let’s have a look at troubleshoots:</p><ul><li>now that all has been solved and deployed, you access the AWS beanstalk <strong>Http</strong> link that gets you to your app and might find that your voice application works superbly, less the part where, you can ask for access for your user’s microphone, through the web browser. And the answer is simple: make sure you run it on <strong>https</strong>.</li><li>you then <strong>OpenSSL</strong> to register and get the <strong>keys</strong> as well as signing the <strong>RSA</strong> yourself(for development purposes only). And add everything in a YAML or JSON file under docker’s “.ebextensions” folder. (find it on my <a href="https://github.com/DanielMoraite/NN-Deploy-with-Docker-and-AWS-Beanstalk">GitHub</a>)</li><li>if you are Mac owner and you run into a __MACOSX/ error just <a href="https://stackoverflow.com/questions/29051274/configuring-ssl-on-elastic-beanstalk-single-instance/59459665#59459665">do this</a>, to your archive, in the command line: zip -d Archive.zip __MACOSX/\*</li><li>if you get the errors as <em>The configuration file .ebextensions/filename.config in application version… contains invalid YAML or JSON. YAML exception: Invalid Yaml: while parsing a block mapping in “&lt;reader&gt;”, line</em> …etc. : make sure your RSA Keys lines are aligned and YAML compatible.</li><li>Conclusions of configuring AWS Beanstalk Single Instance SSL for HTTPS (for Docker env): after time spent with figuring out YAML and tabs vs space(or no space after keys footer, or or..) in my editor(<em>Atom/Packages/Whitespace</em>), or even convert YAML to JSON(<em>Atom/Packages/YAML_JSON Converter</em>), I have realized that the <strong>initial keys were broken</strong> and had to <strong><em>generate a new set!!!</em></strong></li></ul><p>All the above code and instructions can be found via my <a href="https://stackoverflow.com/questions/29051274/configuring-ssl-on-elastic-beanstalk-single-instance/59459665#59459665">StackOverflow</a> response.</p><p>I hope this helps (and <strong>saves you days of hard hard work</strong>) and now your app is running smoothly and you enjoy the predictions. The model provided on my Github gives a little bit less than <em>50% accuracy</em> — though this can be quite good for a multi-class classification at a first glance.</p><p>Take care and wishing you all a superb <em>2020,</em></p><p>A new exciting decade for exponential growth and innovation!!!</p><p>Daniel</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6fd34373497a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/deploy-neural-network-with-flask-docker-and-aws-beanstalk-6fd34373497a">Deploy Neural Network with Flask, Docker and AWS Beanstalk</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>
    </channel>
</rss>