Convolutional Neural Network (CNN)
Filter or Kernel
- If you’ve an n * n matrix and your filter is of size f * f, then the result of the convolution operation is (n-f+1) * (n-f+1).
- f is usually odd (symmetry).
- The corner pixels are only used much less in the output.
- Also, the output keeps shrinking going forward.
- The solution to the above image is to pad the image (n+2p-f+1) * (n+2p-f+1).
- Valid is no padding and Same is padding so that output size is same as input size.
- How many steps to hop over after every operation.
- ((n+2f-f)/s+1) * ((n+2f-f)/s+1)
- For 3d volumes (as opposed to 2d images), we have an RGB image.
- The image is of shape (6 * 6 * 3), 3 is the number of channels.
Filter is of shape (3 * 3 * 3) and the resulting image is of shape (4 * 4).
- Input Shape - (n * n * n_c)
- Filter Shape - (f * f * n_c)
- Output Shape - (n-f+1) * (n-f+1) * n_f) where n_f is the numbber of filters.
Code. Learn. Explore