SlideShare a Scribd company logo
1 of 32
Download to read offline
Convolutional Neural Networks (CNN)
November 5, 2019
Amit Praseed Classification November 5, 2019 1 / 31
What do Neural Networks Learn?
Every input to a neural network is a feature.
The neural network outputs whether the data point corresponding to
the input features belongs to class A or B.
In simple terms, a neural network builds a mapping from a non linear
combination of inputs (features) to the outputs (class labels).
In the case of image recognition, the input is an image itself. Usually
every pixel is a separate input to the neural network.
The MLP learns a non linear combination of pixel values to predict a
class label.
Amit Praseed Classification November 5, 2019 2 / 31
Neural Networks and Image Recognition
Amit Praseed Classification November 5, 2019 3 / 31
Neural Networks and Image Recognition
Amit Praseed Classification November 5, 2019 4 / 31
Neural Networks and Image Recognition
Amit Praseed Classification November 5, 2019 5 / 31
Neural Networks and Image Recognition
MLPs perform poorly in recognizing images.
MLPs cannot learn spatial correlations between images.
Prone to overfitting due to an abnormally large number of inputs and
weights.
There is no concept of ”features” because each feature is a pixel value.
How do we specify features in an image?
Amit Praseed Classification November 5, 2019 6 / 31
Neural Networks and Image Recognition
Amit Praseed Classification November 5, 2019 7 / 31
Neural Networks and Image Recognition
Amit Praseed Classification November 5, 2019 8 / 31
Neural Networks and Image Recognition
Amit Praseed Classification November 5, 2019 9 / 31
Neural Networks and Image Recognition
Amit Praseed Classification November 5, 2019 10 / 31
Neural Networks and Image Recognition
It would be marvelous if the network could learn ”features” by itself...
which is what CNN does.
Amit Praseed Classification November 5, 2019 11 / 31
Basic Idea behind CNN
Amit Praseed Classification November 5, 2019 12 / 31
Filters and Convolutions
An image is basically a matrix of pixel values.
So it makes sense to define all operations on images in terms of oper-
ations of a matrix as well.
All operations such as smoothing, sharpening, blurring, edge detection
etc can be defined in terms of operations on a matrix.
For this, an operation is denoted by a smaller matrix called a filter.
The filter is moved over the image from left to right and top to bottom,
and the corresponding elements of the image and the filter are multi-
plied and added. The resultant value is the pixel value of the modified
image.
This operation is called as convolution.
Amit Praseed Classification November 5, 2019 13 / 31
Smoothing using Convolution
Amit Praseed Classification November 5, 2019 14 / 31
Smoothing using Convolution
Amit Praseed Classification November 5, 2019 15 / 31
Edge Detection using Convolution
Amit Praseed Classification November 5, 2019 16 / 31
Edge Detection using Convolution
Amit Praseed Classification November 5, 2019 17 / 31
Edge Detection using Convolution
Amit Praseed Classification November 5, 2019 18 / 31
Learning Low Level Features in CNN
The first step in a CNN is to learn the low level features such as edges
from the input image.
This is done using a Convolutional Layer.
For this, a filter is moved over the entire image as in the case of
convolution.
Are the filter weights static?
NO.
The filter weights are randomly initialized and the weights are updated
using backpropagation till the weights stabilize.
This means we have no idea which feature (horizontal edge, vertical
edge, slanting lines...) a particular filter learns to recognize.
A number of filters are used in a CNN, and each filter learns to recognize
a particular feature.
Each filter is said to output a Feature Map.
Amit Praseed Classification November 5, 2019 19 / 31
Peculiarities of the Convolutional Layer
Local Receptive Fields
Not fully connected as an MLP
Shared Weights
Learn to recognize a feature irrespective of its absolute location
Fewer parameters, hence less prone to overfitting
ReLu activation function
Amit Praseed Classification November 5, 2019 20 / 31
Convolutional Layer
Amit Praseed Classification November 5, 2019 21 / 31
Convolutional Layer
Amit Praseed Classification November 5, 2019 22 / 31
Convolutional Layer
Amit Praseed Classification November 5, 2019 23 / 31
Pooling
The convolutional layers recognize the presence of features in the im-
age.
However, the output of these layers also contain positional information
i.e. where these features were found.
Usually positional information acts as a burden in classification. We
want relative positional information of features, not where the absolute
position of a feature is.
The Pooling Layer removes positional information from the output of
the Convolutional Layers.
Amit Praseed Classification November 5, 2019 24 / 31
Max Pooling
Amit Praseed Classification November 5, 2019 25 / 31
That’s It!!!
A CNN is essentially comprised of multiple convolutional and pooling
layers one after the other.
Each successive layer recognizes more sophisticated features using low
level features detected by the previous layers.
Amit Praseed Classification November 5, 2019 26 / 31
CNN Architecture
Amit Praseed Classification November 5, 2019 27 / 31
A Note on the Output Layer
While all the other layers are only partially connected, the output layer
is fully connected.
The number of nodes in the output layer is usually equally to the
number of classes in the classification problem. For example, if you
want to classify cats, dogs, wolves and foxes, the output layer will have
four nodes.
The nodes in the output layer have a special activation function, called
Softmax Activation Function.
aL
j =
exL
j
k exL
k
Amit Praseed Classification November 5, 2019 28 / 31
Softmax Activation
Softmax Activation forms a probability distribution, and gives the prob-
ability that the given input belongs to class j.
Along with a new log likelihood cost function given by
C = −ln aL
j
the network can counter learning slowdown as well.
Amit Praseed Classification November 5, 2019 29 / 31
A Note on Overfitting
Even though CNN uses much fewer weights than MLP, it can still suffer
from overfitting.
Techniques to counter overfitting, such as regularization, validation,
acquiring new data etc. can still be used here.
Another technique usually used to reduce the effects of overfitting is
the use of Ensemble Classifiers.
Similar to Random Forests, we can use a number of neural networks
(CNN or MLP), train them separately and employ a majority voting to
decide the class during testing.
However, MLP or CNN need a lot more time to train and hence main-
taining multiple models is infeasible.
Rather, there is a technique that tries to use only one physical model,
but train multiple virtual models in it.
Amit Praseed Classification November 5, 2019 30 / 31
Dropout
The idea behind dropout is to
randomly disable or drop 50%
of the neurons during different
stages of training.
This is done so that the neu-
ral network as a whole becomes
more robust.
Virtually, we are training mul-
tiple neural networks for the
same input, which can help in
reducing overfitting.
Amit Praseed Classification November 5, 2019 31 / 31
How does CNN overcome the difficulties in training Deep
Networks?
Learning Slowdown → Softmax Activation function in the output layer
+ Log Likelihood Cost
Vanishing Gradient → ReLu Activation Function in convolutional layers
Overfitting → Shared Weights and Biases, Regularization, Dropout
Amit Praseed Classification November 5, 2019 32 / 31

More Related Content

Similar to Convolutional Neural Networks

Deep Learning
Deep LearningDeep Learning
Deep Learning
Pierre de Lacaze
 

Similar to Convolutional Neural Networks (20)

IMAGE CLASSIFICATION USING DIFFERENT CLASSICAL APPROACHES
IMAGE CLASSIFICATION USING DIFFERENT CLASSICAL APPROACHESIMAGE CLASSIFICATION USING DIFFERENT CLASSICAL APPROACHES
IMAGE CLASSIFICATION USING DIFFERENT CLASSICAL APPROACHES
 
Dimensionality Reduction
Dimensionality ReductionDimensionality Reduction
Dimensionality Reduction
 
Movie Sentiment Analysis using Deep Learning RNN
Movie Sentiment Analysis using Deep Learning RNNMovie Sentiment Analysis using Deep Learning RNN
Movie Sentiment Analysis using Deep Learning RNN
 
Machine learning session 6
Machine learning   session 6Machine learning   session 6
Machine learning session 6
 
IRJET- Machine Learning based Object Identification System using Python
IRJET- Machine Learning based Object Identification System using PythonIRJET- Machine Learning based Object Identification System using Python
IRJET- Machine Learning based Object Identification System using Python
 
Convolutional Neural Network and Its Applications
Convolutional Neural Network and Its ApplicationsConvolutional Neural Network and Its Applications
Convolutional Neural Network and Its Applications
 
DL.pdf
DL.pdfDL.pdf
DL.pdf
 
Machine learning in science and industry — day 4
Machine learning in science and industry — day 4Machine learning in science and industry — day 4
Machine learning in science and industry — day 4
 
Deep Learning
Deep LearningDeep Learning
Deep Learning
 
IRJET- Segmentation of Nucleus and Cytoplasm from Unit Papanicolaou Smear Ima...
IRJET- Segmentation of Nucleus and Cytoplasm from Unit Papanicolaou Smear Ima...IRJET- Segmentation of Nucleus and Cytoplasm from Unit Papanicolaou Smear Ima...
IRJET- Segmentation of Nucleus and Cytoplasm from Unit Papanicolaou Smear Ima...
 
Dynamic routing between capsules - A brief presentation
Dynamic routing between capsules - A brief presentationDynamic routing between capsules - A brief presentation
Dynamic routing between capsules - A brief presentation
 
IRJET-Multiclass Classification Method Based On Deep Learning For Leaf Identi...
IRJET-Multiclass Classification Method Based On Deep Learning For Leaf Identi...IRJET-Multiclass Classification Method Based On Deep Learning For Leaf Identi...
IRJET-Multiclass Classification Method Based On Deep Learning For Leaf Identi...
 
Graph Based Machine Learning with Applications to Media Analytics
Graph Based Machine Learning with Applications to Media AnalyticsGraph Based Machine Learning with Applications to Media Analytics
Graph Based Machine Learning with Applications to Media Analytics
 
Review-image-segmentation-by-deep-learning
Review-image-segmentation-by-deep-learningReview-image-segmentation-by-deep-learning
Review-image-segmentation-by-deep-learning
 
cnn ppt.pptx
cnn ppt.pptxcnn ppt.pptx
cnn ppt.pptx
 
D05222528
D05222528D05222528
D05222528
 
Dssg talk CNN intro
Dssg talk CNN introDssg talk CNN intro
Dssg talk CNN intro
 
deep CNN vs conventional ML
deep CNN vs conventional MLdeep CNN vs conventional ML
deep CNN vs conventional ML
 
[Revised] Intro to CNN
[Revised] Intro to CNN[Revised] Intro to CNN
[Revised] Intro to CNN
 
IRJET- Deep Convolutional Neural Network for Natural Image Matting using Init...
IRJET- Deep Convolutional Neural Network for Natural Image Matting using Init...IRJET- Deep Convolutional Neural Network for Natural Image Matting using Init...
IRJET- Deep Convolutional Neural Network for Natural Image Matting using Init...
 

More from amitpraseed (6)

Decision Trees
Decision TreesDecision Trees
Decision Trees
 
Support Vector Machines (SVM)
Support Vector Machines (SVM)Support Vector Machines (SVM)
Support Vector Machines (SVM)
 
Principal Component Analysis
Principal Component AnalysisPrincipal Component Analysis
Principal Component Analysis
 
Perceptron Learning
Perceptron LearningPerceptron Learning
Perceptron Learning
 
Introduction to Classification
Introduction to ClassificationIntroduction to Classification
Introduction to Classification
 
Bayesianclassifiers
BayesianclassifiersBayesianclassifiers
Bayesianclassifiers
 

Recently uploaded

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Recently uploaded (20)

On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 

Convolutional Neural Networks

  • 1. Convolutional Neural Networks (CNN) November 5, 2019 Amit Praseed Classification November 5, 2019 1 / 31
  • 2. What do Neural Networks Learn? Every input to a neural network is a feature. The neural network outputs whether the data point corresponding to the input features belongs to class A or B. In simple terms, a neural network builds a mapping from a non linear combination of inputs (features) to the outputs (class labels). In the case of image recognition, the input is an image itself. Usually every pixel is a separate input to the neural network. The MLP learns a non linear combination of pixel values to predict a class label. Amit Praseed Classification November 5, 2019 2 / 31
  • 3. Neural Networks and Image Recognition Amit Praseed Classification November 5, 2019 3 / 31
  • 4. Neural Networks and Image Recognition Amit Praseed Classification November 5, 2019 4 / 31
  • 5. Neural Networks and Image Recognition Amit Praseed Classification November 5, 2019 5 / 31
  • 6. Neural Networks and Image Recognition MLPs perform poorly in recognizing images. MLPs cannot learn spatial correlations between images. Prone to overfitting due to an abnormally large number of inputs and weights. There is no concept of ”features” because each feature is a pixel value. How do we specify features in an image? Amit Praseed Classification November 5, 2019 6 / 31
  • 7. Neural Networks and Image Recognition Amit Praseed Classification November 5, 2019 7 / 31
  • 8. Neural Networks and Image Recognition Amit Praseed Classification November 5, 2019 8 / 31
  • 9. Neural Networks and Image Recognition Amit Praseed Classification November 5, 2019 9 / 31
  • 10. Neural Networks and Image Recognition Amit Praseed Classification November 5, 2019 10 / 31
  • 11. Neural Networks and Image Recognition It would be marvelous if the network could learn ”features” by itself... which is what CNN does. Amit Praseed Classification November 5, 2019 11 / 31
  • 12. Basic Idea behind CNN Amit Praseed Classification November 5, 2019 12 / 31
  • 13. Filters and Convolutions An image is basically a matrix of pixel values. So it makes sense to define all operations on images in terms of oper- ations of a matrix as well. All operations such as smoothing, sharpening, blurring, edge detection etc can be defined in terms of operations on a matrix. For this, an operation is denoted by a smaller matrix called a filter. The filter is moved over the image from left to right and top to bottom, and the corresponding elements of the image and the filter are multi- plied and added. The resultant value is the pixel value of the modified image. This operation is called as convolution. Amit Praseed Classification November 5, 2019 13 / 31
  • 14. Smoothing using Convolution Amit Praseed Classification November 5, 2019 14 / 31
  • 15. Smoothing using Convolution Amit Praseed Classification November 5, 2019 15 / 31
  • 16. Edge Detection using Convolution Amit Praseed Classification November 5, 2019 16 / 31
  • 17. Edge Detection using Convolution Amit Praseed Classification November 5, 2019 17 / 31
  • 18. Edge Detection using Convolution Amit Praseed Classification November 5, 2019 18 / 31
  • 19. Learning Low Level Features in CNN The first step in a CNN is to learn the low level features such as edges from the input image. This is done using a Convolutional Layer. For this, a filter is moved over the entire image as in the case of convolution. Are the filter weights static? NO. The filter weights are randomly initialized and the weights are updated using backpropagation till the weights stabilize. This means we have no idea which feature (horizontal edge, vertical edge, slanting lines...) a particular filter learns to recognize. A number of filters are used in a CNN, and each filter learns to recognize a particular feature. Each filter is said to output a Feature Map. Amit Praseed Classification November 5, 2019 19 / 31
  • 20. Peculiarities of the Convolutional Layer Local Receptive Fields Not fully connected as an MLP Shared Weights Learn to recognize a feature irrespective of its absolute location Fewer parameters, hence less prone to overfitting ReLu activation function Amit Praseed Classification November 5, 2019 20 / 31
  • 21. Convolutional Layer Amit Praseed Classification November 5, 2019 21 / 31
  • 22. Convolutional Layer Amit Praseed Classification November 5, 2019 22 / 31
  • 23. Convolutional Layer Amit Praseed Classification November 5, 2019 23 / 31
  • 24. Pooling The convolutional layers recognize the presence of features in the im- age. However, the output of these layers also contain positional information i.e. where these features were found. Usually positional information acts as a burden in classification. We want relative positional information of features, not where the absolute position of a feature is. The Pooling Layer removes positional information from the output of the Convolutional Layers. Amit Praseed Classification November 5, 2019 24 / 31
  • 25. Max Pooling Amit Praseed Classification November 5, 2019 25 / 31
  • 26. That’s It!!! A CNN is essentially comprised of multiple convolutional and pooling layers one after the other. Each successive layer recognizes more sophisticated features using low level features detected by the previous layers. Amit Praseed Classification November 5, 2019 26 / 31
  • 27. CNN Architecture Amit Praseed Classification November 5, 2019 27 / 31
  • 28. A Note on the Output Layer While all the other layers are only partially connected, the output layer is fully connected. The number of nodes in the output layer is usually equally to the number of classes in the classification problem. For example, if you want to classify cats, dogs, wolves and foxes, the output layer will have four nodes. The nodes in the output layer have a special activation function, called Softmax Activation Function. aL j = exL j k exL k Amit Praseed Classification November 5, 2019 28 / 31
  • 29. Softmax Activation Softmax Activation forms a probability distribution, and gives the prob- ability that the given input belongs to class j. Along with a new log likelihood cost function given by C = −ln aL j the network can counter learning slowdown as well. Amit Praseed Classification November 5, 2019 29 / 31
  • 30. A Note on Overfitting Even though CNN uses much fewer weights than MLP, it can still suffer from overfitting. Techniques to counter overfitting, such as regularization, validation, acquiring new data etc. can still be used here. Another technique usually used to reduce the effects of overfitting is the use of Ensemble Classifiers. Similar to Random Forests, we can use a number of neural networks (CNN or MLP), train them separately and employ a majority voting to decide the class during testing. However, MLP or CNN need a lot more time to train and hence main- taining multiple models is infeasible. Rather, there is a technique that tries to use only one physical model, but train multiple virtual models in it. Amit Praseed Classification November 5, 2019 30 / 31
  • 31. Dropout The idea behind dropout is to randomly disable or drop 50% of the neurons during different stages of training. This is done so that the neu- ral network as a whole becomes more robust. Virtually, we are training mul- tiple neural networks for the same input, which can help in reducing overfitting. Amit Praseed Classification November 5, 2019 31 / 31
  • 32. How does CNN overcome the difficulties in training Deep Networks? Learning Slowdown → Softmax Activation function in the output layer + Log Likelihood Cost Vanishing Gradient → ReLu Activation Function in convolutional layers Overfitting → Shared Weights and Biases, Regularization, Dropout Amit Praseed Classification November 5, 2019 32 / 31