CNN Part 1
CNN Part 1
About CNN’s
☯ In 1995, Yann LeCun and Yoshua Bengio introduced the concept of convolutional neural
networks.
☯ CNN is a feed-forward network that can extract topological properties from an image.
☯ Like almost every other neural networks they are trained with a version of the
back-propagation algorithm.
☯ Convolutional Neural Networks are designed to recognize visual patterns directly from
pixel images with minimal preprocessing.
☯ They can recognize patterns with extreme variability (such as handwritten characters).
2
Convolution
• Convolution between two functions in mathematics produces a
third function expressing how the shape of one function is
modified by other
Equivariant Representation
Convolution provides translation equivariance meaning if an
object in an image is at area A and through convolution a
feature is detected at the output at area B, then the same
feature would be detected when the object in the image is
translated to A'.
• Convolution Kernels
• A kernel is a small 2D matrix whose contents are based upon
the operations to be performed.
• A kernel maps on the input image by simple matrix multiplication
and addition, the output obtained is of lower dimensions and
therefore easier to work with.
input matrix has shape 4x4x1 and the kernel is of size 3x3
since the shape of input is larger than the kernel.
1. The kernel gets into position at the top-left corner of the input
matrix.
2. Then it starts moving left to right, calculating the dot product and
saving it to a new matrix until it has reached the last column.
3. Next, kernel resets its position at first column but now it slides
one row to the bottom. Thus following the fashion left-right and
top-bottom.
4. Steps 2 and 3 are repeated till the entire input has been
processed.
• We know it is good to learn a small model.
• From this fully connected model, do we really need all the edges?
Consider learning an image:
• Some patterns are much smaller than the whole
image
“beak” detector
A convolutional layer
A CNN is a neural network with some convolutional layers
(and some other layers). A convolutional layer has a number
of filters that does convolutional operation.
Beak detector
A filter
Convolution These are the network
parameters to be learned.
1 -1 -1
1 0 0 0 0 1 -1 1 -1 Filter 1
0 1 0 0 1 0 -1 -1 1
0 0 1 1 0 0
1 0 0 0 1 0 -1 1 -1
-1 1 -1 Filter 2
0 1 0 0 1 0
0 0 1 0 1 0 -1 1 -1
…
…
6 x 6 image
Each filter detects a
small pattern (3 x 3).
Convolution Operation
• Convolution is a process used for applying general-purpose filter
effects like blurring, sharpening, embossing, edge detection, and
more.
• Take for example the blurring filter.
• In blur filter, set each pixel to the mean of its neighbouring pixels.
• Take a look at the below averaging operation.
• Replaced 227 with 225.
https://colab.research.google.com/drive/1LUr5yg5KEmpZSCi0j09Bati8
_Tq95l6L
Acknowledgement
• Deep learning –Andrew Ng
• Deep learning-Mitesh M.Khapra
• Ian Goodfellow, YoshuaBengio, Aaron Courville , “Deep Learning”, The MIT
Press, 2016
• Hands-on Mathematics for Deep Learning- Jay Dawani
Applications
• Image Thresholding Improves 3-Dimensional Convolutional Neural Network
Diagnosis of Different Acute Brain Hemorrhages on Computed Tomography
Scans
• https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6539746/