Image Processing with Python
Sampriti Chatterjee (Great Learning)
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Agenda
1 What is Image Processing?
7 Convolutional Layer
2 Traditional ML VS Deep learning
8 Relu layer
3 Human brain VS AI
9 Pooling layer
4 How Image Input work in computer?
10 Fully connected layer
5 What is CNN?
11 Demo: Image Processing with Python
6 Layers in CNN
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
What is Image Processing
Image processing is a method to perform some important operations on
an image. In order to get an enhanced high Quality image or to extract the
most useful information from that
It is a one type of signal processing
In this processing input is an image and output may
be image or characteristics/features associated with
that image
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Is It A Cat Or A Dog?
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Is It A Cat Or A Dog?
Traditional Machine Learning Deep Learning
Manual selection from so many This is where traditional machine
features is impossible learning fails and deep learning comes
into picture
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Human Brain VS Neural Network
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Human Brain VS Neural Network
Neuron Artificial Neuron
• Cell Nucleus • Node
• Dendrites • Input: x1, x2
• Synapse • Weights or interconnections
• Axon • f(x) (mapping, activation, learning)
• Terminal Axon • Output: y1
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
How Image Input Works In Computer?
4 21 54 92 48
Converts the image into an array of pixel
values where the dimension of array 2 22 54 36 22
depends on the resolution of the image 3 42 37 86 73
Array of dimension 32 X 32 X 3 (The 3
refers to RGB values)
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
What is CNN?
“A feed forward network to process and recognize image data with the
grid version”
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Fully Connected Network
Combines the extracted features
and represents a new model
Pooling Layer
Reduce the image size
ReLu Layer
Converts negative numbers into zero
Convolution Layer
Converts images into an array
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Layers In CNN
Layers in CNN
Convolutional Layer
“Converts images into an array”
1 Convolutional Layer
2 ReLU First layer of CNN
Stores the pixelated values of image into an array
3 Pooling Layer
Used for extracting the features of the image and reducing
4 Fully Connected Layer its dimensionality
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Working Of Convolutional Layer
4 21 54 92 48 4 21 54 92 48
0 -1
2 22 54 36 22 2 22 54 36 22 * 1 1
3 42 37 86 73 3 42 37 86 73 Filter/Feature detector
Terminology Alert!!
3 22 -2 10
23 25 87 139
Extracted features from the image
Dimension reduced
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Layers In CNN
Activation function: ReLu
Layers in CNN
“Converts negative values into zero”
1 Convolutional Layer ReLU is a half rectifier
f(y) = 0 when y < 0
2 ReLU
f(y) = y when y > = 0
Range of ReLU : [0 to infinity]
3 Pooling Layer
4 Fully Connected Layer
ReLu
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Working Of Relu Layer
4 21 54 92 48
3 22 -2 10
2 22 54 36 22 Applying ReLu layer
23 25 87 139
3 42 37 86 73
3 22 0 10
After removing the negative values
23 25 87 139
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Layers In CNN
Pooling Layer
Layers in CNN
“Reduces the spatial size and the numbers of parameters”
1 Convolutional Layer
Used to reduce dimensionality
Helps to control overfitting
2 ReLU
Filters of size 2x2 are commonly used in it
3 Pooling Layer
4 Fully Connected Layer
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Working Of Pooling Layer
3 22 0 10 Max Pooling 3 22 0 10
2*2 with stride = 1
23 25 87 139 23 25 87 139
Terminology Alert!!
Amount of movement between applications of the filter to the 25
input image is referred as stride
3 22 0 10 3 22 0 10 3 22 0 10
23 25 87 139 23 25 87 139 23 25 87 139
25 87 25 87 139 25 87 139 139
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Flatten The Data
“Converting the Pooled feature map into an array is known as data flattening”
25
87
25 87 139 139 Flatten
139
139
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Layers In CNN
Pooling Layer
Layers in CNN
“Combines all the features together to create a final model”
1 Convolutional Layer
Used to reduce dimensionality
Helps to control overfitting
2 ReLU
Filters of size 2x2 are commonly used in it
3 Pooling Layer
4 Fully Connected Layer
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Working Of Fully Connected Layer
Hidden layers
Input layer
25 Prediction
87 Dog
139 Cat
Output layer
139
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Image Processing with Python
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Thank You
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited