Convolution Neural
Network (CNN)
A . Suraj Kumar
Contents
Introduction to Computer Vision
What is CNN ?
Different Types of CNN and use of
CNN in Computer Vision
Application of Computer Vision
Conclusion
2
Introduction to Computer Vision
● Computer vision is concerned with the automatic extraction, analysis and
understanding of useful information from a single image or a sequence of images.
- The British Machine Vision Association and Society for Pattern Recognition (BMVA)
(or)
● It is an interdisciplinary field that deals with how computers can be made to gain
high-level understanding from digital images or videos.
- Wikipedia
3
What is CNN(Convolution Neural Network)
4
● It is a class of deep learning.
● Convolutional neural network (ConvNet’s or CNNs) is one of the main
categories to do images recognition, images classifications, objects detections,
recognition faces etc.,
● It is similar to the basic neural network. CNN also have learnable parameter
like neural network i.e., weights, biases etc.
● CNN is heavily used in computer vision
● There 3 basic components to define CNN
○ The Convolution Layer
○ The Pooling Layer
○ The Output Layer (or) Fully Connected Layer
Architecture of CNN
5
Convolution Layer
6
● Computers read images as pixels and it is expressed as matrix (NxNx3) —
 (height by width by depth).
● The Convolutional Layer makes use of a set of learnable filters. A filter is used
to detect the presence of specific features or patterns present in the original
image (input).
● It is usually expressed as a matrix (MxMx3), with a smaller dimension but the
same depth as the input file.
● This filter is convolved (slided) across the width and height of the input file,
and a dot product is computed to give an activation map.
Convolution Layer
7
Images source: Analytics Vidhya
Convolution Layer
8
Images source: Analytics Vidhya
Convolution Layer
The concept of stride and padding:
● The weight of a matrix moves 1 pixel at a time is called as stride 1 (as we did in
above case).
What if we increase the stride value?
9
Images source: Analytics Vidhya
Convolution Layer
● As we can see in above image the increase in the stride value decreases the size of the
image (which may cause in losing the features of the image).
● Padding the input image across it solves our problem, we add more than one layer of zeros
around the image in case of higher stride values.
10
Images source: Analytics Vidhya
Convolution Layer
● when the input of 6x6 is padded around with zeros we get the output with same
dimensions of 6x6 this is known as ‘Same Padding’.
● The middle 4x4 pixel remains the same, here we have retained the more information
from borders and also preserved the size of image.
11Images source: Analytics Vidhya
The Pooling Layer
● It can be seen in between the convolution layers in CNN architecture.
● This layer basically reduces the amount of parameters and computation in the network.
● Pooling is done for the sole purpose of reducing the spatial size of the image.
● Pooling is done independently on each depth dimension, therefore the depth of the
image remains unchanged. The most common form of pooling layer generally applied
is the max pooling.
12
Images source: Analytics Vidhya
The Pooling Layer
● Let's try to understand from below image how max pooling has affected our image
below.
13Images source: Analytics Vidhya
The Output Layer
● After multiple layers of convolution and padding, we would need the output in the form
of a class.
● The convolution and pooling layers would only be able to extract features and reduce
the number of parameters from the original images.
● However, to generate the final output we need to apply a fully connected layer to
generate an output equal to the number of classes we need.
● Convolution layers generate 3D activation maps while we just need the output as
whether or not an image belongs to a particular class.
● The output layer will have the loss function like categorical cross-entropy, to compute
the error in prediction.
● Once the forward pass is complete the backpropagation begins to update the weight
and biases for error and loss reduction.
14
CNN
How to decide the number of convolution layers and number of filters in CNN ?
● Deeper networks is always better, at the cost of more data and increased
complexity of learning.
● You should initially use fewer filters and gradually increase and monitor the error
rate to see how it is varying.
● Very small filter sizes will capture very fine details of the image. On the other hand
having a bigger filter size will leave out minute details in the image.
15
Types of CNN
● Based on the problems, we have the different CNN’s which are used in computer
vision.
● The five major computer vision techniques which can be addressed using CNN.
■ Image Classification
■ Object Detection
■ Object Tracking
■ Semantic Segmentation
■ Instance Segmentation
16
Types of CNN
Image Classification:
● In an image classification we can use the traditional CNN models or there also
many architectures designed by developers to decrease the error rate and
increasing the trainable parameters.
■ LeNet (1998)
■ AlexNet (2012)
■ ZFNet (2013)
■ GoogLeNet19 (2014)
■ VGGNet 16 (2014)
■ ResNet(2015)
17
Types of CNN
Object Detection:
● Here the implementation of CNN is different compared to the previous image
classification.
● Here the task is to identify the objects present in the image, therefore
traditional implementation of CNN may not help.
■ R CNN
■ Fast R CNN
■ Faster R CNN
■ YOLO
18
Applications of Computer Vision
● Computer vision, an AI technology that allows computers to understand and
label images, is now used in convenience stores, driverless car testing, daily
medical diagnostics, and in monitoring the health of crops and livestock.
● Different use cases found in the computer vision as follows
■ Retail and Retail Security
■ Automotive
■ Healthcare
■ Banking
■ Agriculture
■ Industrial
19
Conclusion
● Here in this seminar we tried to understand what is Computer
Vision.
● What is CNN and its different layers.
● Different types of CNN and its uses in Computer Vision
techniques.
● Different Applications of Computer Vision.
20
References
● https://www.analyticsvidhya.com/blog/2017/06/architecture-of-convolutional-
neural-networks-simplified-demystified/
● https://towardsdatascience.com/covolutional-neural-network-cb0883dd6529
● https://medium.com/technologymadeeasy/the-best-explanation-of-
convolutional-neural-networks-on-the-internet-fbb8b1ad5df8
● https://adeshpande3.github.io/A-Beginner%27s-Guide-To-Understanding-
Convolutional-Neural-Networks/
● http://www.image-net.org/
21
Thank you!
22

Convolution Neural Network (CNN)

  • 1.
  • 2.
    Contents Introduction to ComputerVision What is CNN ? Different Types of CNN and use of CNN in Computer Vision Application of Computer Vision Conclusion 2
  • 3.
    Introduction to ComputerVision ● Computer vision is concerned with the automatic extraction, analysis and understanding of useful information from a single image or a sequence of images. - The British Machine Vision Association and Society for Pattern Recognition (BMVA) (or) ● It is an interdisciplinary field that deals with how computers can be made to gain high-level understanding from digital images or videos. - Wikipedia 3
  • 4.
    What is CNN(ConvolutionNeural Network) 4 ● It is a class of deep learning. ● Convolutional neural network (ConvNet’s or CNNs) is one of the main categories to do images recognition, images classifications, objects detections, recognition faces etc., ● It is similar to the basic neural network. CNN also have learnable parameter like neural network i.e., weights, biases etc. ● CNN is heavily used in computer vision ● There 3 basic components to define CNN ○ The Convolution Layer ○ The Pooling Layer ○ The Output Layer (or) Fully Connected Layer
  • 5.
  • 6.
    Convolution Layer 6 ● Computersread images as pixels and it is expressed as matrix (NxNx3) —  (height by width by depth). ● The Convolutional Layer makes use of a set of learnable filters. A filter is used to detect the presence of specific features or patterns present in the original image (input). ● It is usually expressed as a matrix (MxMx3), with a smaller dimension but the same depth as the input file. ● This filter is convolved (slided) across the width and height of the input file, and a dot product is computed to give an activation map.
  • 7.
  • 8.
  • 9.
    Convolution Layer The conceptof stride and padding: ● The weight of a matrix moves 1 pixel at a time is called as stride 1 (as we did in above case). What if we increase the stride value? 9 Images source: Analytics Vidhya
  • 10.
    Convolution Layer ● Aswe can see in above image the increase in the stride value decreases the size of the image (which may cause in losing the features of the image). ● Padding the input image across it solves our problem, we add more than one layer of zeros around the image in case of higher stride values. 10 Images source: Analytics Vidhya
  • 11.
    Convolution Layer ● whenthe input of 6x6 is padded around with zeros we get the output with same dimensions of 6x6 this is known as ‘Same Padding’. ● The middle 4x4 pixel remains the same, here we have retained the more information from borders and also preserved the size of image. 11Images source: Analytics Vidhya
  • 12.
    The Pooling Layer ●It can be seen in between the convolution layers in CNN architecture. ● This layer basically reduces the amount of parameters and computation in the network. ● Pooling is done for the sole purpose of reducing the spatial size of the image. ● Pooling is done independently on each depth dimension, therefore the depth of the image remains unchanged. The most common form of pooling layer generally applied is the max pooling. 12 Images source: Analytics Vidhya
  • 13.
    The Pooling Layer ●Let's try to understand from below image how max pooling has affected our image below. 13Images source: Analytics Vidhya
  • 14.
    The Output Layer ●After multiple layers of convolution and padding, we would need the output in the form of a class. ● The convolution and pooling layers would only be able to extract features and reduce the number of parameters from the original images. ● However, to generate the final output we need to apply a fully connected layer to generate an output equal to the number of classes we need. ● Convolution layers generate 3D activation maps while we just need the output as whether or not an image belongs to a particular class. ● The output layer will have the loss function like categorical cross-entropy, to compute the error in prediction. ● Once the forward pass is complete the backpropagation begins to update the weight and biases for error and loss reduction. 14
  • 15.
    CNN How to decidethe number of convolution layers and number of filters in CNN ? ● Deeper networks is always better, at the cost of more data and increased complexity of learning. ● You should initially use fewer filters and gradually increase and monitor the error rate to see how it is varying. ● Very small filter sizes will capture very fine details of the image. On the other hand having a bigger filter size will leave out minute details in the image. 15
  • 16.
    Types of CNN ●Based on the problems, we have the different CNN’s which are used in computer vision. ● The five major computer vision techniques which can be addressed using CNN. ■ Image Classification ■ Object Detection ■ Object Tracking ■ Semantic Segmentation ■ Instance Segmentation 16
  • 17.
    Types of CNN ImageClassification: ● In an image classification we can use the traditional CNN models or there also many architectures designed by developers to decrease the error rate and increasing the trainable parameters. ■ LeNet (1998) ■ AlexNet (2012) ■ ZFNet (2013) ■ GoogLeNet19 (2014) ■ VGGNet 16 (2014) ■ ResNet(2015) 17
  • 18.
    Types of CNN ObjectDetection: ● Here the implementation of CNN is different compared to the previous image classification. ● Here the task is to identify the objects present in the image, therefore traditional implementation of CNN may not help. ■ R CNN ■ Fast R CNN ■ Faster R CNN ■ YOLO 18
  • 19.
    Applications of ComputerVision ● Computer vision, an AI technology that allows computers to understand and label images, is now used in convenience stores, driverless car testing, daily medical diagnostics, and in monitoring the health of crops and livestock. ● Different use cases found in the computer vision as follows ■ Retail and Retail Security ■ Automotive ■ Healthcare ■ Banking ■ Agriculture ■ Industrial 19
  • 20.
    Conclusion ● Here inthis seminar we tried to understand what is Computer Vision. ● What is CNN and its different layers. ● Different types of CNN and its uses in Computer Vision techniques. ● Different Applications of Computer Vision. 20
  • 21.
    References ● https://www.analyticsvidhya.com/blog/2017/06/architecture-of-convolutional- neural-networks-simplified-demystified/ ● https://towardsdatascience.com/covolutional-neural-network-cb0883dd6529 ●https://medium.com/technologymadeeasy/the-best-explanation-of- convolutional-neural-networks-on-the-internet-fbb8b1ad5df8 ● https://adeshpande3.github.io/A-Beginner%27s-Guide-To-Understanding- Convolutional-Neural-Networks/ ● http://www.image-net.org/ 21
  • 22.

Editor's Notes

  • #4 Start the discussion with the human eye and take them to the computer vision. Explain about computer vision definition and speak about what are the different fields it deals with. Take the topic to machine learning
  • #5 Say why CNN why not Feed forward NN(example MNIST image 28 x 28 x 1(black & white image contains only 1 channel) Total number of neurons in input layer will 28 x 28 = 784, this can be manageable. What if the size of image is 1000 x 1000, which means you need 10⁶ neurons in input layer.
  • #6 Explain the Architecture of CNN
  • #7 Explain image pixels how pixels are expressed in matrix form And what are filters how are the represented.
  • #8 Explain briefly the image
  • #9 Explain the original image and conoluted image
  • #10 What is stride and explain with image Increase in stride value loss of pixels
  • #11 Discuss the same padding concept: when the input of 6x6 is padded around with zeros we get the output with same dimensions of 6x6. And feature are extracted without loss.
  • #12 The output of the Convolution layer is passes through the activation function
  • #14 As you can see I have taken convoluted image and have applied max pooling on it. The max pooled image still retains the information that it’s a car on a street. If you look carefully, the dimensions if the image have been halved. This helps to reduce the parameters to a great extent.
  • #15 Discuss about the flattening of pixels before sending it to the output layer. Explain the flattening process. When weights are updated, they take place on both convolution layers and fully connected layers.
  • #20 Discuss Amazon Go store for retail and security Google cars for Automotive Cheque sign recognition in banks