<?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 Lucas Solano on Medium]]></title>
        <description><![CDATA[Stories by Lucas Solano on Medium]]></description>
        <link>https://medium.com/@lucassolanoc?source=rss-cc68e740d0e6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*_HfvX79HBuTJpBdK</url>
            <title>Stories by Lucas Solano on Medium</title>
            <link>https://medium.com/@lucassolanoc?source=rss-cc68e740d0e6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 06:07:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@lucassolanoc/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[Classifying Soy Plagues using Convolutional Neural Networks]]></title>
            <link>https://medium.com/@lucassolanoc/classifying-soy-plagues-using-convolutional-neural-networks-ab14f9f463b5?source=rss-cc68e740d0e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab14f9f463b5</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[classification-algorithms]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[convolutional-network]]></category>
            <category><![CDATA[image-processing]]></category>
            <dc:creator><![CDATA[Lucas Solano]]></dc:creator>
            <pubDate>Sat, 19 Dec 2020 01:52:54 GMT</pubDate>
            <atom:updated>2020-12-19T01:52:54.774Z</atom:updated>
            <content:encoded><![CDATA[<p>Throughout the year 2020, Latin American IBM hosted a coding marathon that included challenges using some of the most disruptive technologies in the market, such as cloud computing, machine learning, IoT, containers, Natural Language Processing (NLP), data science, among others.</p><p><a href="https://maratona.dev/pt">Home | Maratona Behind the Code</a></p><p>These challenges were based on real problems faced by the sponsors of the competition. The one <a href="https://medium.com/u/22379a3109d1">Camila Barbosa</a> and I are going to talk about in this article consists of a challenge proposed by Cocamar, an agro-industrial cooperative company.</p><p>Plague control is still a great challenge to agro-industrial companies until this day. Knowing how to rapidly identify which agent is taking advantage of the cultivation is vital in order to take the most adequate action without compromising a large portion of the harvest.</p><p>That being said, the Cocamar proposed a challenge that consists of identifying whichever insects there were in their soy plantations so they could choose the best strategy available for the insect type present in the leaves.</p><p>At the time, the challenge was done using an IBM Cloud tool known as Visual Recognition, due to that, even people that did not have much knowledge in artificial intelligence could do it easily.</p><p>Past the competition, we wanted to do this challenge using Deep Learning techniques such as Convolutional Neural Networks and that is what we are going to talk about in this article.</p><h4>The Data</h4><p>The dataset consisted of images acquired through scrapping methods in Google images and in insect-specialized websites. The following types of insects were our class labels:</p><ul><li>Southern Green Stink Bug (<em>Nezara viridula</em>)</li><li>Neotropical Brown Stink Bug (<em>Euschistus heros</em>)</li><li>Velvetbean Caterpillar (<em>Anticarsia gemmatalis</em>)</li><li>Red-banded Stink Bug (<em>Piezodorus guildinii</em>)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*LkRsemr05qdTVIQoOKxfVg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/168/1*j1YSudNR2lZAucr1pB6dSQ.jpeg" /><figcaption>Velvetbean Caterpillar (left) and Red-banded Stink Bug (right)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iiRM722lOvfbB9eGAAPKjQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*8WYl4DGevUNmlrGWoZ2M1A.jpeg" /><figcaption>Neotropical Brown Stink Bug (left) and Southern Green Stink Bug (right)</figcaption></figure><p>To improve our model, we also include in our dataset some negative images. That is, some images that are not part of the labeled classes. These pictures were mainly of other insect species that could have been easily mistaken as the ones in our class labels. Our dataset was not that large, but we made sure to choose high-quality images.</p><ul><li>For the Southern Green Stink Bug, 36 images were selected.</li><li>Neotropical Brown Stink Bug, 56 images.</li><li>29 images were selected for the Velvetbean Caterpillar.</li><li>Red-banded Stink Bug had 24 images.</li><li>There were 125 negative images.</li></ul><h4>Pre-processing</h4><p>Firstly, all images were resized using Imutils’ resize function. The bigger dimension on width or height was chosen and resized to the size of the smaller dimension of the two. For example, if the width is smaller than the height, then the height would be resized to the size of the width.</p><p>Secondly, a data normalization technique was applied, a mean pre-processor. In this stage, we computed the average Red, Green, and Blue pixel intensities between all images in the training dataset. with these averages, we performed a pixel-wise subtraction of these values from our input images.</p><p>The next step was, in order to reduce overfitting, we had to regularize the data. For that matter, we randomly sampled regions of some images during the training process. This strategy was only applied when the spatial dimensions of the input images were larger than what the CNN expected.</p><p>After that, we applied an oversampling method, on which we cropped the corners of the input image plus the center region, and then we flipped it horizontally, for a total of ten samples per input image. This method usually increases classification accuracy.</p><h4>CNN Model</h4><p>Convolutional Neural Networks, or CNNs, are a class of deep neural networks used most commonly in image processing. It takes some aspects of the image and differentiates them from one another. If you want to take a closer look at CNNs, there is a simple guide on the following website:</p><p><a href="https://towardsdatascience.com/a-comprehensive-guide-to-convolutional-neural-networks-the-eli5-way-3bd2b1164a53">A Comprehensive Guide to Convolutional Neural Networks — the ELI5 way</a></p><p>In our problem, we choose to implement an architecture based on AlexNet architecture. AlexNet is a leading architecture for any object-detection task and may have huge applications in the computer vision sector of artificial intelligence problems.</p><p><a href="https://towardsdatascience.com/alexnet-the-architecture-that-challenged-cnns-e406d5297951">AlexNet: The Architecture that Challenged CNNs</a></p><p>Our architecture can be separated into five blocks. Three of them with convolutional layers combined with linear rectifier activation functions, batch normalizations, overlapping poolings, and dropouts. And the latter two with fully connected layers.</p><p>For the implementation, we used an API called Keras that is a high-level API of TensorFlow for creating and training deep learning models more easily.</p><p><a href="https://www.tensorflow.org/guide/keras/sequential_model?hl=en">The Sequential model | TensorFlow Core</a></p><p>The neural network ran through a hundred epochs, and we had the following results:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*-8Qzi2zP3fh8fpt00yGxkw.png" /><figcaption>Loss/Accuracy for each epoch for both the training and validation sets</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/506/1*FfQjNPVTju3BzmIaXtwX8Q.png" /><figcaption>Metrics for the classification of each class label</figcaption></figure><p>As we can see, for all classes we had a pretty good performance overall in the classification problem. For some classes, the algorithm could predict almost all of the test samples correctly. The final accuracy on the test set was 68.57%.</p><p>It is valid to point that most of the insects treated in this classification problem are considerably similar. Three of them are of the same family of insects, which could make the classification problem considerably harder. Another point to consider is that if the dataset was bigger, probably we could have higher final accuracy.</p><h4>Conclusion and some remarks</h4><p>With this deep learning application, we could practice the pipeline for an image classification problem and also solve a real-world problem that could be implemented for the sponsor company in order to assist in plague control for soy plantations.</p><p>The algorithm could classify with good performance between the labeled classes, which could help greatly in the choice of the method of plague control that can be used in a soy plantation based on the specimen of insect found there.</p><p>The code exemplified in this article is available at:</p><p><a href="https://github.com/camilabga/cocamar-bugs">https://github.com/camilabga/cocamar-bugs</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab14f9f463b5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>