Convolutional Neural Networks
TJ Machine Learning
Slide 1
TJ Machine Learning Club
CNNs over Neural Networks
Slide 2
TJ Machine Learning Club
Conceptual Idea of a Convolutional Neural Network
Slide 3
TJ Machine Learning Club
What is the Convolution?
Kernel = dark blue area
Image = light blue area
Feature Map = output
Slide 4
TJ Machine Learning Club
Why use Convolutional Layers?
Slide 5
TJ Machine Learning Club
Why use Convolutional Layers?
Slide 6
TJ Machine Learning Club
Example of Convolution
Image matrix
Kernel matrix
*
=
?
Slide 7
TJ Machine Learning Club
Example of Convolution
*
=
142 | |
| |
This calculation was done using a stride length of one. We will go deeper into this in the next lecture
Yellow Entry = 4x1 + 2x2 + 0x3 + 3x4 + 2x5 + 3x6 + 2x7 + 1x8 + 8x9 = 142
Slide 8
TJ Machine Learning Club
Example of Convolution
*
=
142 | 189 |
225 | 230 |
This calculation was done using a stride length of one. We will go deeper into this in later
Blue Entry = 2x1 + 0x2 + 0x3 + 2x4 + 3x5 + 8x6 + 1x7 + 8x8 + 5x9 = 189
Green Entry = 3x1 + 2x2 + 3x3 + 2x4 + 1x5 + 8x6 + 4x7 + 6x8 + 8x9 = 225
Red Entry = 2x1 + 3x2 + 8x3 + 1x4 + 8x5 + 5x6 + 6x7 + 8x8 + 2x9 = 230
Slide 9
TJ Machine Learning Club
Hand-Designed Kernels
You can also think of kernels identifying areas in image that are most similar to it (i.e. the Sobel kernel being used for edge detection)
This kernel blurs an image by replacing each pixel value with the average value of the pixels around it and itself
Slide 10
TJ Machine Learning Club
Another Example
Slide 11
TJ Machine Learning Club
Kernels in a Convolutional Neural Network
*
=
Slide 12
TJ Machine Learning Club
Convolution over Multiple Channels
3D Image
3D Kernel
1D Feature Map
Slide 13
TJ Machine Learning Club
Full CNN Structure
Slide 14
TJ Machine Learning Club
Activation Function
Slide 15
TJ Machine Learning Club
ReLU
Slide 16
TJ Machine Learning Club
ReLU
Slide 17
TJ Machine Learning Club
Pooling Layers
Slide 18
TJ Machine Learning Club
Fully-Connected Tail
We understand now that convolutional layers produce stacks of feature maps, which, after some additional processing with ReLU and max pooling layers, are fed as inputs to successive convolutional layers
Slide 19
TJ Machine Learning Club
Full CNN Structure
How do we turn a stack of feature maps into a prediction?
Slide 20
TJ Machine Learning Club
Flattening
Slide 21
TJ Machine Learning Club
Softmax
Slide 22
TJ Machine Learning Club
CNN Hyperparameters
Basic parameters to tune a CNN:
Slide 23
TJ Machine Learning Club
Kernel Size
Slide 24
TJ Machine Learning Club
Number of Kernels
Slide 25
TJ Machine Learning Club
Stride Length
Solution: Increase stride length
Slide 26
TJ Machine Learning Club
Stride Length 1:
Stride Length 2:
Slide 27
TJ Machine Learning Club
Zero Padding
Slide 28
TJ Machine Learning Club
Transfer Learning
Slide 29
TJ Machine Learning Club