<?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 Venkatesh Mungara on Medium]]></title>
        <description><![CDATA[Stories by Venkatesh Mungara on Medium]]></description>
        <link>https://medium.com/@venkateshmungara?source=rss-10dff2d7b6d6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*U5k_SECs8ByQ5PMGDenjzQ.jpeg</url>
            <title>Stories by Venkatesh Mungara on Medium</title>
            <link>https://medium.com/@venkateshmungara?source=rss-10dff2d7b6d6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 05:34:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@venkateshmungara/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[“Unveiling the Green Guardians: A Journey into Plant Disease Classification using CNN, Transfer…]]></title>
            <link>https://medium.com/@venkateshmungara/unveiling-the-green-guardians-a-journey-into-plant-disease-classification-using-cnn-transfer-bc12f9d514ca?source=rss-10dff2d7b6d6------2</link>
            <guid isPermaLink="false">https://medium.com/p/bc12f9d514ca</guid>
            <category><![CDATA[cnn-model]]></category>
            <category><![CDATA[transfer-learning]]></category>
            <category><![CDATA[vgg16]]></category>
            <dc:creator><![CDATA[Venkatesh Mungara]]></dc:creator>
            <pubDate>Wed, 21 Jun 2023 13:11:23 GMT</pubDate>
            <atom:updated>2023-06-21T13:11:23.164Z</atom:updated>
            <content:encoded><![CDATA[<h3>“Unveiling the Green Guardians: A Journey into Plant Disease Classification using CNN, Transfer Learning, and VGG”</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/0*vEPtioEmShVBH2K3.jpg" /></figure><p>In a previous blog post, I talked about how CNNs work for image classification. Today, let’s take a closer look at how we can use CNNs to classify plant diseases. It’s an interesting topic that sheds light on how CNNs can help us identify and understand different types of plant ailments. So, join me on this exciting journey as we explore the world of using CNNs for plant disease classification.</p><p>we done this project in two ways one is completely using convolutional neural networks and other is taking help of VGG-16 and Transfer learning. lets know what are VGG_16 and transfer learning. and all these are from Keras.</p><h3>Transfer Learning:</h3><p>Transfer learning is a powerful technique in Deep learning that allows us to leverage knowledge gained from pre-trained models to solve new tasks. Imagine you’ve trained a model to recognize different breeds of dogs with excellent accuracy. Now, instead of starting from scratch, you can use transfer learning to apply this knowledge to a new task, like identifying cats. By taking advantage of the patterns and features learned from the dog classification task, the model can quickly adapt and fine-tune its understanding of cats. This not only saves time and computational resources but also improves performance since the model has already learned relevant representations. Transfer learning is like having a head start in solving new problems, making it a valuable tool in machine learning.</p><h3>VGG-16:</h3><p>VGG16 is a convolutional neural network (CNN) architecture renowned for image recognition. It stands out by having only 16 weight-bearing layers, unlike other models that rely on numerous hyperparameters. The architecture uses consistent 3x3 convolution layers with stride 1 and same padding, coupled with 2x2 maxpool layers with stride 2. It concludes with two fully connected layers and a softmax output. VGG16 comprises approximately 138 million parameters, making it a sizable and powerful network.</p><p>And I ll talk more about these architectures in my next blog post.</p><h3>Plant data set Introduction:</h3><p>This data set was downloaded from Kaggle, which is having total 87000 plus Plant leaf images, and this data is already classified into Train, Valid and test. and there are 38 different classes are available in this data set.</p><p><strong>Exploratory Data Analysis: </strong>for this Data Analysis EDA won&#39;t be necessary however we have done some analysis, so we can learn how much data tah we are working with and etc.. and all these done in Google collab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Esdrb4eMpK-AwgUDhvbEBQ.png" /></figure><p>so we are working with train and valid data sets, so lets have look how much data we are having in these folders.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/1*pVPtvgkbDgwtyH16NESxVg.png" /><figcaption>fig:1 train data dist</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*nSVpl1ZykcL79mdsxcs4sw.png" /><figcaption>fig:2 valid data dist</figcaption></figure><p>Now lets make a plot,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7EB8_n1EOAh3VnRyHVeddA.png" /></figure><p>you can see that “Soya been Health” is having more data than all other classes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dRDo63UxTWkOT3xJV3JInw.png" /></figure><p>and in valid data set you can see that corn_maize scab is having more data.</p><p>and now look at whole data that we are having.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FMG8Ak-hd2a2Huywm9qBPw.png" /><figcaption>fig:3 whole data distribution.</figcaption></figure><h3>CNN:</h3><p>model architecture building:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r6L1JSQsCyP9VpE-ziifBQ.png" /><figcaption>fig:4CNN model architecture</figcaption></figure><p>The code consists of 8 layers in total, including 4 convolutional layers, 3 max pooling layers, and 1 fully connected layer.</p><p>The output layer is the last layer in the model, which is a fully connected layer with 38 units and softmax activation. It performs the final classification into 38 different disease categories.</p><p>Certainly! Here’s a step-by-step explanation of the code:</p><p>1. Model Initialization:<br> The code initializes a sequential model using `model_1 = keras.models.Sequential()`. A sequential model allows you to stack layers on top of each other in a linear manner.</p><p>2. Adding Convolutional Layers:<br> The code adds a 2D convolutional layer to the model using `model_1.add(keras.layers.Conv2D(8, kernel_size=(3,3), padding=’same’, activation=’relu’, input_shape=(150, 150, 3)))`. This layer has 8 filters with a kernel size of 3x3, “same” padding, and ReLU activation. The input shape is set to (150, 150, 3), representing an RGB image with dimensions 150x150 pixels.</p><p>3. Adding MaxPooling Layers:<br> The code adds a max pooling layer to the model using `model_1.add(keras.layers.MaxPooling2D(pool_size=(3, 3)))`. This layer performs max pooling with a pool size of 3x3, reducing the spatial dimensions of the previous layer’s output.</p><p>4. Adding More Convolutional Layers:<br> The code adds additional convolutional layers, each followed by batch normalization and max pooling. These layers help the model learn hierarchical features of increasing complexity.</p><p>5. Flattening:<br> The code adds a flattening layer using `model_1.add(keras.layers.Flatten())`. This layer converts the multi-dimensional output from the previous layer into a one-dimensional vector, preparing it for the fully connected layers.</p><p>6. Adding Fully Connected Layers:<br> The code adds a fully connected layer with 38 units and softmax activation using `model_1.add(keras.layers.Dense(38, activation=’softmax’))`. This layer performs the final classification into 38 different disease categories.</p><p>7. Model Summary:<br> The code prints a summary of the model’s architecture using `print(model_1.summary())`. The summary displays the layer configuration, the number of trainable parameters, and the output shapes at each layer.</p><p>8. Model Compilation:<br> The code compiles the model using `model_1.compile(optimizer=optimizer, loss=’categorical_crossentropy’, metrics=[‘accuracy’])`. It specifies the optimizer (Adam with a learning rate of 0.001), the loss function (categorical cross-entropy), and the evaluation metric (accuracy).</p><p>lets see the output of the above code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/435/1*UP1Qg9AY2xd18lGmjQ0gmA.png" /></figure><p>and now lets compile:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*3ue7_ANKVlEcmkZ0hyq-6w.png" /></figure><p>Here’s a explanation of the code:</p><p>1. Early Stopping:<br> The `EarlyStopping` callback is used to monitor the loss on the validation set during training. If the loss does not improve for a few consecutive epochs (defined by `patience=3`), the training process will be stopped early. This helps prevent overfitting and saves time by not continuing training when there is no further improvement.</p><p>2. Learning Rate Reduction:<br> The `ReduceLROnPlateau` callback adjusts the learning rate during training. If the validation loss does not improve for a certain number of epochs (defined by `patience=2`), the learning rate is reduced by a factor of 0.2 (`factor=0.2`). This helps the model to converge better by fine-tuning the learning rate as training progresses.</p><p>3. Model Training:<br> The `fit` method is used to train the model. It takes the training data generator (`train_gen`) and trains the model for a specified number of epochs (10 in this case). The `verbose=1` argument allows you to see the training progress, such as the loss and accuracy values printed for each epoch.</p><p>4. History Tracking:<br> The `history` variable stores the training history, including the loss and accuracy values for each epoch. This information can be useful for evaluating the model’s performance and visualizing the training progress.</p><p>By using the `EarlyStopping` and `ReduceLROnPlateau` callbacks, you can control the training process and make adjustments based on the model’s performance. Early stopping helps prevent overfitting, and learning rate reduction fine-tunes the model’s learning rate for better convergence. These techniques are beneficial for training models effectively and efficiently.</p><p>Lets have look at the output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/1*2BA93qJciV7S7Pm2CDyYDg.png" /><figcaption>fig:5 epochs</figcaption></figure><p>In the above figure you can see that model has been training, and we have given 10 epochs. the time taken for this model to train is nearly 6 hours. and we can observe that the accuracy we got is 92%.</p><p>and now lets see how this model is performing:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/1*vyT5YD2irk4B5TPWf7yggA.png" /><figcaption>fig6: train model prediction</figcaption></figure><p>so by the above results our model is predicting good, as we got 93% accuracy.</p><h3>Transfer Learning (VGG-16)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/1*x2OJZdspz7bzoO0UzxJClA.png" /></figure><p>The `train_datagen` object in the code is an instance of the `ImageDataGenerator` class from Keras. It is used to perform various image augmentation techniques on the training images during the training process. Here’s a breakdown of the settings used in `train_datagen`:</p><p>1. `rescale=1./255`: This setting rescales the pixel values of the images to a range of 0 to 1. It is a common practice to normalize the pixel values before feeding them into a neural network.</p><p>2. `shear_range=0.2`: This setting applies shear transformations to the images. Shear transformations distort the shape of the image by shifting the pixels along a certain direction.</p><p>3. `zoom_range=0.2`: This setting randomly zooms in or out on the images. It allows the model to learn to recognize objects at different scales and perspectives.</p><p>4. `width_shift_range=0.2` and `height_shift_range=0.2`: These settings randomly shift the width and height dimensions of the images. It helps the model learn to be more invariant to translations and improves its ability to handle objects appearing at different positions.</p><p>5. `fill_mode=’nearest’`: This setting determines how to fill in any newly created pixels that may arise from the aforementioned transformations. ‘Nearest’ filling mode assigns the value of the nearest pixel to the newly created pixel.</p><p>By using these settings in `train_datagen`, the training images are dynamically augmented and varied during each epoch, providing the model with more diverse training examples. This helps in reducing overfitting and improves the model’s ability to generalize to unseen data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*xntOVLZsLARd9aWRePpIVA.png" /><figcaption>fig7: VGG architecture</figcaption></figure><p>The code snippet initializes the VGG16 model from Keras with the following settings: excluding the top layers, using pre-trained weights from ImageNet, and expecting input images of size 224x224 pixels with 3 channels. The base_model.summary() command prints a summary of the model&#39;s architecture, including the shape of each layer&#39;s output and the number of trainable and non-trainable parameters. This summary helps understand the model&#39;s structure and parameter count.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/525/1*HHos3Q5jPk0KvmM0hg4gww.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/383/1*jgHGidHRxVyxPMB74daBWw.png" /></figure><p>The line `base_model.trainable = False` is setting the `trainable` attribute of the `base_model` to `False`. This means that the weights of the pre-trained VGG16 model will be frozen, and they will not be updated during the training process. By setting `trainable` to `False`, we keep the pre-trained weights fixed and only train the additional layers that we add on top of the base model. This is often done in transfer learning to leverage the pre-trained features while customizing the final layers for a specific task.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*6KJesBzBrW8V4yJ-JX-upA.png" /><figcaption>fig8: finetuning</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*YbxQBF0L2pg_MVn0lc9CVA.png" /><figcaption>fig8:vgg model</figcaption></figure><p>so we can observe that we ar getting 94% of accuracy where it increased 1% than CNN.</p><p><strong>Conclusion</strong>:</p><p>1. I explored how CNNs can be used to identify and understand plant diseases. CNNs are powerful tools for recognizing different types of plant ailments from images.</p><p>2. Transfer learning is a technique that allows us to use knowledge from pre-trained models to solve new tasks. It saves time and improves performance by leveraging what the models have already learned.</p><p>3. VGG-16 is a popular CNN architecture known for its accuracy in image recognition. It has 16 layers and a large number of parameters, making it a strong model for plant disease classification.</p><p>4. The dataset used in this project contained over 87,000 plant leaf images divided into 38 categories. It was downloaded from Kaggle.</p><p>5. I analyzed the dataset to understand its characteristics and distribution. This helped me gain insights into the data I was working with.</p><p>6. I created two models: one from scratch using CNNs and another using transfer learning with VGG-16. The transfer learning model performed better, achieving 94% accuracy compared to the CNN model.</p><p>7. I used image augmentation techniques to enhance the training data. This involved making changes to the images like rotation or zooming to create more diverse examples for the model to learn from.</p><p>8. By freezing the pre-trained weights of the VGG-16 model, I kept them fixed while training only the additional layers I added. This allowed me to benefit from the pre-trained features while customizing the model for plant disease classification.</p><p>Overall, using CNNs, transfer learning, and VGG-16, I successfully built models that could classify plant diseases accurately. These techniques are valuable in the field of machine learning and can contribute to understanding and combating plant ailments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bc12f9d514ca" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ConvNeXt: A Family of Pure ConvNet Models]]></title>
            <link>https://medium.com/@venkateshmungara/convnext-a-family-of-pure-convnet-models-aff07d266c29?source=rss-10dff2d7b6d6------2</link>
            <guid isPermaLink="false">https://medium.com/p/aff07d266c29</guid>
            <category><![CDATA[cnn]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[convnext]]></category>
            <dc:creator><![CDATA[Venkatesh Mungara]]></dc:creator>
            <pubDate>Mon, 19 Jun 2023 14:37:45 GMT</pubDate>
            <atom:updated>2023-06-19T14:37:45.181Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/310/0*trFQVxnzdkPkeENY" /></figure><p>In my previous blog I talked about how computers classifying the images and objects, these are done by using a Deep learning Architecture i.e., CNN.</p><p>and to do this image classification there are different architectures are also available namely:</p><ul><li>LeNet-5</li><li>AlexNet</li><li>VGGNet</li><li>GoogLeNet</li><li>ResNet</li></ul><p>These are the Architecture which made more enhancements t in the image classification.</p><p>now lets talk about why convolution and pooling layers are used in front of FC layers (Fully Connected Layer) and how convolution, pooling layers is being calculated in order to filtering essential features in an input image.</p><p><strong>Why convolution layers are used before the fully connected layers?</strong></p><p>Generally, convolution and pooling layers act as giant filters. Imagine an image 224 x 224 x 3 pixels and FC layer as a direct first hidden layer with 100,000 perceptron, the total number of connections will be 224*224*3*100000=15,02,800,000 =&gt;15 billion parameters which is impossible to process. Convolution and max pooling layers can actually help to reduce some features in the image which are may not require to train.</p><p><strong>Convolution Parameters</strong></p><p>In convolution layer, it accepts a volume of size <em>W </em>x<em> H </em>x<em> D </em>and requires four hyper parameters as follows:</p><ul><li>Number of filters → <strong>K</strong></li><li>Spatial Extent → <strong>Fw, Fh </strong><em>(Filter width, Filter height)</em></li><li>Stride → <strong>Sw, Sh </strong><em>(Stride width, Stride height)</em></li><li>Padding → <strong>P</strong></li></ul><p>To calculate receptive field, the formula is as follows,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/378/1*3LmVOymNgaZ1FvKPIjIVDQ.png" /></figure><p>To calculate pooling layer, the formula is as follows,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/299/1*RKEaKSLuaCanqf2XXhb2jQ.png" /></figure><ul><li>OM → Output Matrix</li><li>IM → Input Matrix</li><li>P → Padding</li><li>F → Filter</li><li>S → Stride</li></ul><p>By applying above receptive and pooling calculation formulas, the convolutions, pooling and feature maps outputs are derived. The key operations in a CNN,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/0*YwWIR7DIlrWDj4MF.png" /><figcaption>Figure 1: CNN Key Operation (Source : R.Fergus, Y.LeCun)</figcaption></figure><p>so This is how The CNN’s are classifies the Images. When discussing various models and architectures in CNN, ConvNextBase is an architecture that can be considered.</p><h3>What is ConvNeXt?</h3><p>ConvNeXt is a pure ConvNet model that was proposed in the paper “A ConvNet for the 2020s”. The model is designed to be accurate, efficient, scalable, and simple in design. It is constructed entirely from standard ConvNet modules, and it can be used for image classification, object detection, and segmentation tasks. ConvNeXt is similar to other ConvNet models in the sense that no new design is implemented, but it has better accuracy, performance, and scalability than Vision Transformers.</p><h3>The difference between ConvNet and ConvNextBase:</h3><ol><li><strong>Architecture</strong>: ConvNet (Convolutional Neural Network) refers to the general concept and class of neural network models specifically designed for processing visual data. It includes various architectures, such as LeNet, AlexNet, VGGNet, and ResNet, which have their own unique designs. On the other hand, ConvNeXt is a specific family of ConvNet models that are constructed entirely from standard ConvNet modules.</li><li><strong>Focus</strong>: ConvNeXt models prioritize accuracy, efficiency, scalability, and simplicity in their architectural design. They aim to achieve high accuracy while efficiently processing large amounts of data. ConvNet models, in general, also focus on accuracy and efficiency, but their specific architectures may differ in terms of their emphasis on scalability and simplicity.</li></ol><h3>How does ConvNeXt incorporate concepts from ViTs?</h3><p>ConvNeXt is a type of neural network that is built based on another design called Vision Transformers (ViTs). ViTs are known for their ability to understand images by using self-attention and dividing the image into smaller parts called patches.</p><p>ConvNeXt takes some ideas from ViTs, like using self-attention and working with image patches. However, it does not use the exact same method called transformers that ViTs use.</p><p>Instead, ConvNeXt uses a different technique called depth-wise convolution. It’s like a special way of processing images where the network looks at different parts of the image separately. This technique helps to reduce the amount of calculations needed while still maintaining accuracy.</p><p>The advantage of ConvNeXt is that it can understand images well by using these clever techniques without making the network too complex. So, even though it doesn’t use the same transformers as ViTs, it still performs well and is easier to work with.</p><p>In summary, ConvNeXt is a neural network that learns from the ideas of Vision Transformers. It uses its own method called depth-wise convolution to process images effectively while keeping things simple.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/534/0*OTdogLF1E1yMOmlo.png" /></figure><h3>ConvNeXt Variants</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*N4wLFTOkrbilXTz9J5Xg7w.png" /></figure><ul><li><strong>Different ConvNeXt variants, ConvNeXt-T/S/B/L, are designed</strong> to be of similar complexities to <a href="https://sh-tsang.medium.com/review-swin-transformer-3438ea335585">Swin</a>-T/S/B/L. ConvNeXt-T/B is the end product of the “modernizing” procedure on <a href="https://towardsdatascience.com/review-resnet-winner-of-ilsvrc-2015-image-classification-localization-detection-e39402bfa5d8?source=post_page---------------------------">ResNet</a>-50/200 regime, respectively.</li><li>In addition, <strong>a larger ConvNeXt-XL </strong>is built to further test the scalability of ConvNeXt. The variants <strong>only differ in the number of channels <em>C</em>, and the number of blocks<em> B</em> in each stage.</strong> Following both <a href="https://towardsdatascience.com/review-resnet-winner-of-ilsvrc-2015-image-classification-localization-detection-e39402bfa5d8?source=post_page---------------------------">ResNet</a>s and <a href="https://sh-tsang.medium.com/review-swin-transformer-3438ea335585">Swin Transformer</a>s,<strong> the number of channels doubles at each new stage</strong>.</li></ul><h3>Conclusion:</h3><ol><li>To conclude that This ConvNext model has been popular recently in 2020 where VIT s has been introduced.</li></ol><p>2. where This ConvNext model simply a pure model of Convnet which are Convolutional Neuarl Networks.</p><p>3. ConvNeXt is a pure ConvNet model that incorporates concepts from Vision Transformers (VIT) but does not directly use transformers. It focuses on using depth-wise convolution and the ResNext family of Convolutional Neural Networks for efficient image processing, while VIT relies on transformers and self-attention mechanisms for visual understanding.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aff07d266c29" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unveiling the Visionary: Exploring the Convolutional Neural Networks]]></title>
            <link>https://medium.com/@venkateshmungara/unveiling-the-visionary-exploring-the-convolutional-neural-networks-4140bf5e7075?source=rss-10dff2d7b6d6------2</link>
            <guid isPermaLink="false">https://medium.com/p/4140bf5e7075</guid>
            <category><![CDATA[cnn]]></category>
            <category><![CDATA[image-classification]]></category>
            <dc:creator><![CDATA[Venkatesh Mungara]]></dc:creator>
            <pubDate>Wed, 14 Jun 2023 12:12:09 GMT</pubDate>
            <atom:updated>2023-06-14T13:00:21.362Z</atom:updated>
            <content:encoded><![CDATA[<p>Humans have an amazing ability to see and understand what they look at. We can easily tell what objects or scenes are in front of us. Now, imagine if computers could have that kind of “vision” too. They would be able to sense and make sense of the pictures and videos they encounter. This would allow machines to recognize and understand images, just like we do. It would be a big deal because computers could then navigate the visual world, analyze images, and understand visual clues. This could be useful in things like self-driving cars, medical tests, and security systems that can “see” and understand their surroundings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*fZT4B1qInCnG3Il1" /></figure><p>As we know Artificial Intelligence is the one which is now making things what a human does, so in this AI field CNN is the part where it works with images.</p><p>Convolutional Neural Networks (CNNs) take inspiration from how our brain’s visual system works. Just like our brain can identify different features in what we see, CNNs use special layers to detect edges, patterns, and textures in images. These networks are designed in a hierarchical way, so they learn more complex features as they go deeper. This helps them recognize objects and make sense of visual information. CNNs have become incredibly powerful tools in fields like image recognition and computer vision, allowing machines to “see” and understand the world around them with impressive accuracy.</p><p>as said CNN is a powerful tool for recognizing the images, so let’s know HOW.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/0*DATWzExTQT06_wFm.png" /></figure><p>When a CNN is used for image classification, it takes an input image and processes it to figure out what it shows. The computer sees the image as a grid of pixels, and the size of this grid depends on the resolution of the image. For example, if the image is 6 pixels high, 6 pixels wide, and in color (RGB), the grid will be 6 x 6 x 3. On the other hand, if it’s a grayscale image, it will be 4 x 4 x 1 since grayscale images have one value per pixel. The computer looks at these numbers and uses them to determine if the image is a dog, cat, tiger, lion, or something else.</p><p>well, technically talking about CNN architecture, it takes an input image, and it will pass through the convolutional layers. inside this CN layers it works with Filter/Kernal, Pooling layer, Stride after all this this will connect to Fully connected layers and apply function to classify an object.</p><p><strong>Convolution Layers:</strong></p><p>In a Convolutional Neural Network (CNN), the first layer called convolutional layer extracts important features from the input image. It does this by using a special operation called convolution. Imagine a small window sliding over the image, looking at small chunks at a time. It calculates a combined value for each chunk, capturing patterns like edges and shapes. This helps the network understand what’s in the image and make accurate predictions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/657/0*wuiX7-n1P2AlDvkn.png" /></figure><p>Consider a 5 x 5 whose image pixel values are 0, 1 and filter matrix 3 x 3 as shown in below. (This kernel acts as Weights in CNN)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/413/0*mZUSZbrOR2hHikTR.png" /></figure><p>when we take an image, we apply filter and applying Convolution Operation (means element wise multiplication) it will give us Feature Map which shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/268/0*pxLgdZdn1iTPiebh.gif" /></figure><p><strong>Padding:</strong></p><p>Normally when we do the convolution operation and applying filters our feature map size has been reduce, so to avoid this problem we use padding. the padding will try to add a rows and columns to a matrix, so that our feature map will be same size as input.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*6tmm-v90dLedEz49.jpg" /></figure><p>There are different types of padding available.</p><p>a) Zero Padding</p><p>b) One Padding</p><p>c) Same Padding</p><p><strong>Stride: </strong>Stride is<strong> </strong>the number of pixels by which we slide our filter matrix over the input matrix. When the stride is 1 then we move the filters one pixel at a time. When the stride is 2, then the filters jump 2 pixels at a time as we slide them around. Having a larger stride will produce smaller feature maps. The below figure shows convolution would work with a stride of 2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/695/0*LCYP-YcdoJkEw6u-.png" /></figure><p><strong>ReLU:</strong></p><p>ReLU stands for Rectified Linear Unit for a non-linear operation. The output is <strong><em>ƒ(x) = max(0,x).</em></strong></p><p>Why ReLU is important : ReLU’s purpose is to introduce non-linearity in our ConvNet. Since, the real world data would want our ConvNet to learn would be non-negative linear values.</p><p><strong>Pooling Layer</strong></p><p>Pooling layers section would reduce the number of parameters when the images are too large. Spatial pooling also called subsampling or down sampling which reduces the dimensionality of each map but retains important information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/0*GpmTgJ3r4D5ATqqO.png" /></figure><p>Spatial pooling can be of different types:</p><ul><li>Max Pooling</li><li>Average Pooling</li></ul><p>Max pooling takes the largest element from the rectified feature map. Taking the largest element could also take the average pooling.</p><p>the usage of pooling is totally dependent upon the Problem statement. when our task is not finding the location of an object then we can use pooling. and always the pooling layers applied after convolution layer.</p><p><strong>Fully Connected Layer</strong></p><p>The layer we call as FC layer, we flattened our matrix into vector and feed it into a fully connected layer like a neural network.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/554/0*Isjne5A8olTrjr4Z.png" /></figure><p>In the above diagram, the feature map matrix will be converted as vector (x1, x2, x3, …). With the fully connected layers, we combined these features together to create a model. Finally, we have an activation function such as SoftMax or sigmoid to classify the outputs as cat, dog, car, truck etc.,</p><p><strong>Summary:</strong></p><ul><li>Mainly CNN is used for extracting the Features of an image.</li><li>Here in CNN, there are mainly two things will happen firstly the input image will be dot product by Kernal and on the output of the Feature map we will apply Relu activation function.</li><li>and also, we use padding so that we don’t loose our information.</li><li>And In CNN the Kernal act as Weights, we update kernel as like we update weights in MLPs.</li><li>output the class using an activation function (Logistic Regression with cost functions) and classifies images.</li></ul><p><strong>References:</strong></p><p><a href="https://adeshpande3.github.io/">Adit Deshpande — Engineering at Forward | UCLA CS ’19 (adeshpande3.github.io)</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4140bf5e7075" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Optimizing Machine Learning Models: A Beginner’s Guide to Gradient Descent and Its Variants]]></title>
            <link>https://medium.com/@venkateshmungara/optimizing-machine-learning-models-a-beginners-guide-to-gradient-descent-and-its-variants-245acb29120c?source=rss-10dff2d7b6d6------2</link>
            <guid isPermaLink="false">https://medium.com/p/245acb29120c</guid>
            <dc:creator><![CDATA[Venkatesh Mungara]]></dc:creator>
            <pubDate>Thu, 11 May 2023 06:31:34 GMT</pubDate>
            <atom:updated>2023-05-11T06:31:34.392Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/612/0*s2zyg2etDpV7mZeP" /></figure><p>Introduction:<br>Machine learning models have become powerful tools for solving complex problems and making accurate predictions. Behind their success lies a fundamental technique called optimization. In this blog we will delve into the world of optimization and explore how it works, with a focus on Gradient Descent (GD) and its variants: Stochastic Gradient Descent (SGD) and Mini-Batch SGD.</p><p>— <strong><em>Understanding Optimization:</em></strong><br>Optimization in machine learning aims to fine-tune model parameters to minimize errors and improve performance. Picture yourself as a sculptor refining a clay sculpture. Just as you iteratively shape the sculpture to achieve perfection, optimization iteratively adjusts the model’s parameters to reduce errors and maximize accuracy.</p><p><strong><em>-Gradient Descent (GD): </em></strong><br>Gradient Descent is a popular optimization algorithm that traverses the parameter space of a model to find the optimal values. Imagine being on a mountain and wanting to reach the lowest point. GD follows a similar principle, continuously descending towards the minimum of a loss function. By calculating the gradients of the loss function with respect to the parameters, GD determines the direction and magnitude of parameter updates, gradually reaching the minimum.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/0*ykxJjkAenO3Ga7AJ.png" /></figure><p><strong><em>-Stochastic Gradient Descent (SGD)</em></strong><br>Stochastic Gradient Descent takes a different approach. Instead of using the entire dataset to compute gradients, it randomly samples a single data point at a time. This randomness introduces some noise but speeds up the optimization process. SGD makes frequent and faster parameter updates, dancing around the true minimum, ultimately converging to an approximate solution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*pEsPQX5WyXgS_oJTzlADeg.jpeg" /></figure><p><strong><em>-Mini-Batch SGD:</em> </strong><br>Mini-Batch SGD combines the best of both worlds: the stability of GD and the efficiency of SGD. Rather than processing one data point at a time, Mini-Batch SGD samples a small subset or mini-batch of data. This approach strikes a balance between noise reduction and computational efficiency. Mini-Batch SGD yields smoother convergence and faster optimization, making it a popular choice in practice.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/0*VToxlkxJ8M6NSK-U.png" /></figure><blockquote>However,Optimization methods like Gradient Descent (GD), Stochastic Gradient Descent (SGD), and Mini-Batch SGD have their own challenges. GD can be computationally expensive and may get stuck in local minima. SGD introduces noise and requires careful selection of the learning rate. Mini-Batch SGD involves choosing an optimal batch size and adjusting hyperparameters. These challenges highlight the trade-offs in computational efficiency, convergence speed, and accuracy. It’s important to understand these limitations and choose the appropriate optimization algorithm based on the dataset size, computational resources, and convergence requirements. By considering these factors, we can navigate the optimization process more effectively and train machine learning models that yield better results.</blockquote><p><strong>Conclusion:</strong><br>Optimization lies at the heart of training machine learning models, allowing us to maximize accuracy and improve performance. Gradient Descent and its variants, Stochastic Gradient Descent and Mini-Batch SGD, offer different trade-offs between accuracy and efficiency.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=245acb29120c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>