Convolutional Neural Networks
Convolutional Neural Networks
Networks
Convolutional Neural Networks
Why CNN?
CNN:
● Sparse connectivity (local connectivity): a hidden unit is only connected to a local patch
(weights connected to the patch are called filter or kernel)
Why CNN?
CNN:
● Growing Receptive Fields: units in the deeper layers may indirectly interact with a larger
portion of the input.
Why CNN?
CNN:
● Shared weights at different spatial locations: Hidden nodes at different locations share the
same weights → reduces the number of parameters
Architecture of CNN
A typical CNN has 4 layers
● Input layer
● Convolution layer
● Pooling layer
● Fully connected layer
Building blocks of convolutional neural networks
Essential components of a CNN:
● the convolutional layers for feature extraction
● the activations to support learning of non-linear interactions
● the downsampling operations (pooling or striding)
● fully connected layers to transform the network output and Softmax layer
Optional components: batch normalization to speed up training and dropout to prevent overfitting
Convolution layer
A convolution matrix is used in image processing for tasks such as edge detection,
blurring, sharpening, etc. → producing feature maps
Convolution filter
A convolution matrix is used in image processing for tasks such as edge detection,
blurring, sharpening, etc. → producing feature maps
Convolution operator parameters
● Filter size
● Padding
● Stride
● Dilation
● Activation function
Filter size
● Nice geometric property of all input pixels being around output pixel
Padding
Image shrinks after applying convolutional operation → after many steps → a very small output.
Pixels on the corners or edges are used much less than pixels in the middle → Loss
information from the edges
Padding
→ Padding the image with additional border(s), set pixel values to 0 on the border
Type of padding:
● Valid Padding: no padding
● Same Padding: add ‘p’ padding layers such that output has the same dimensions as input.
● Padding with “p” layer: add ‘p’ padding layers
3 by 3 filter with padding of 1
Stride
Stride controls how far filter shifts at each step → Increase the stride if we want receptive fields
to have less overlaps and if we want smaller output dimensions → down sampling
3 by 3 filter with stride of 2
Dilation (Dilated Convolution)