Wednesday 29 July 2020

CNN-Convolution Neural Network

0 comments

CNN-Convolution Neural Networks

Topics to be covered:

In this topic we going to get a brief idea about CNN-
            1.1 what is CNN?
            1.2 Different types of Layers in CNN.

1.1 What is CNN-Convolution Neural Network ?

A Convolution Neural Network is a Deep Learning Algorithm which takes input as an image and extracts all the features and produces the result. The CNN is mainly used for Image Classification, Object Detection, Feature Extraction, .....Etc.

Fig: Architecture of CNN

1.2 Different types of Layers in CNN

In every network we have different types of layers, similarly in CNN we have 3 main layers
                                      1.2.1 Input Layer
                                      1.2.2 Hidden Layer
                                                        1.2.2.1 Convolution Layer
                                                        1.2.2.2 Pooling Layer
                                                        1.2.2.3 Fully-Connected Layer
                                      1.2.3 Output Layer

    1.2.1 Input Layer:

                    In this layer input is given as an image. In the images we have different color backgrounds such as RGB, HSV, Gray Scale,....etc.In this model we have taken an image of RGB which consists of Red, Green, Blue channels.


Fig: Input Layer

   1.2.2 Hidden Layer:

                    It is the layer which is placed between Input layer and Output Layer. In Neural Network there can be 'n'  no of hidden layers. In CNN we have three sub layers in hidden layer, they are Convolution Layer, Pooling  Layer, Fully-Connected Layer

        1.2.2.1 Convolution Layer:

                    This is the first layer where we extract features from the input image. Here, input image is transformed into matrix based on the color backgrounds and we have different channels. With the help of matrix we generate the convolved feature  by applying matrix multiplication or dot product and ReLU Activation function. Example if an image if of RGB we have three different channels they are Red, Green, Blue. 
                                                    Image Dimensions = width * Height * Dimension
                                                    Width = width of an image
                                                    Height = height of an image
                                                    Dimension = It means no of channels if RGB then 3 channels
Example:
        If the matrix is of  5*5*1 the we generate a convolved feature of matrix 3*3*1

Fig: Convolution Layer

         ReLU Activation Function:

            ReLU is stands for Rectilinear Activation Function which is a non-linear function. The main purpose of this function is it removes the negative part of our function and this is an very expensive function.
                                                                                
Fig: ReLU Activation Function

        1.2.2.2 Pooling Layer:

                This is the second layer here we take input as convolved feature i.e (output of the convolution layer) as input and further generates the matrix by reducing its dimensions. There are different types of pooling layer they are 

            • Max Pooling
            • Average Pooling
            • Min Pooling
  • Max Pooling:

                 Max Pooling is a pooling operation which takes maximum element in the feature map.
Fig: Max Pooling

  • Average Pooling:

                 Average Pooling is a pooling operation which takes average of all element from the feature map.

Fig: Average Pooling

  • Min Pooling:
                Min Pooling is a pooling operation which takes minimum element from the feature map.
Fig: Min Pooling


       1.2.2.3 Fully Connected Layer:

                This is the third layer here we take output of the pooling layer as its input for this layer and "flattens" them and then turn it into the single input vector.

Fig: Fully Connected Layer

       1.2.3 Output Layer:

                In this layer we generates the output based on probabilities generated by using softmax function. 

Fig: Output Layer









No comments:

Post a Comment

If you have any doubts, please let me now