Pooling Layer
Pooling is an operation that is commonly added to a CNN to reduce the dimensionality of an image by reducing the number of pixels in the output from the convolutional layer it follows. Pooling layers shrink the input image to increase computational efficiency and reduce the number of parameters to limit the risk of overfitting.
A pooling layer immediately follows a convolution layer and is considered another important part of the CNN structure. This section will focus on two types of pooling:
- Max pooling
- Average pooling
Max Pooling
With max pooling, a filter or kernel only retains the largest pixel value from an input matrix. To get a clearer idea of what is happening, consider the following example. Say you have a 4x4
input. This first step in max pooling would be to divide the 4x4
matrix into four quadrants. Each quadrant will be of the size 2x2
. Apply a filter of size 2
. This means that your filter will look exactly like a 2x2
matrix.