Artificial Intelligence and Machine Learning
6CS012 - Week 5 – Introduction to CNN
Introduction � Convolutional Neural Network
Tasks in Computer Vision
3
How do computers see images?
Images are just numbers
Deep Learning task with images
5
Deep Learning Tasks with Images
We need features to Identify the images
Lets Identify the features
Manual Feature Extraction
Manual Feature Extraction
Learning Feature Representations
Fully Connected Neural Network
Disadvantage of FCNN for image classification
Still Too Much Computation!!!!
Why are too many parameters a problem?
Training Deep FCNNs: Vanishing Gradients
Training Deep FCNNs: Vanishing Gradients
Disadvantage of FCNN for image classification
No Spatial Information
Sensitive to the location of the object in an image!!!!
Disadvantage of FCNN for image classification
No Spatial Information
Treats local pixels same as the pixels far apart
Connects all the nodes in the hidden layers to all the nodes in the input layer !
How can we use the spatial features in the input to inform the architecture of the network?
Using Spatial Features (Idea)
Feature Extraction with Convolution
Intuition: Convolution Operation
Convolution Operation (Mathematically)
We slide the filter over the Input image, element wise multiply and add the output!!
Understanding Convolution Operation
Understanding Convolution Operation
The Loopy Pattern Detector can detect that pattern, all across the input image, no matter the position
Remember the Terminologies
Producing Feature Maps
You can change the weight values in filter to represent different filters which can detect different features in the image
Padding
Preserves pixels at image boundaries during convolution
Zero Padding: Adds zeros around image borders
Same Padding: Ensures output dimensions match input (for stride 1)
Valid Padding: No padding, resulting in smaller output
Output Dimension after Convolution Operation
A Bigger Picture (Convolution Layers)
Introducing Non-linearity
Pooling Layer
Week - 5 - Introduction to CNN
30
Pooling
Output Dimensions After Pooling
Story So far!
Convolution Layer
ReLU Activation
Pooling
Representation Learning in Deep CNN
Feature Learning
Classification
CNNs For Classification: Feature Learning
Feature Learning
Classification
CNNs For Classification: Classification
Case Studies-CNN Architecture.
Classic Architecture-LeNet-5:
[Conv, ReLU, Pool]*N,🡪 flatten,[FC, ReLU]*N, FC 🡪 Softmax.
This is the architecture of LeNet-5 created by Yann LeCun in 1998 and was widely used for hand written digits recognition (MNIST).
Layer | Output Size | No Parameters |
Flatten | 5*5*16 = 400 | 0 |
Linear(120🡪84) | 84 | 120*84 + 84 = 10,164 |
38
Training The CNN
Forward Computation @ Convolutional Layer.
40
Same Operation happens at every Layer, the inputs shall change depending on the layer.
Image from Internet: Subject to copyright.
Backward Pass @ Convolution Layer.
41
Backward Pass @ Convolution Layer.
42