In a convolutional neural network, pooling layers are applied after the convolutional layer. The main purpose of pooling is to reduce the size of feature maps, which in turn makes computation faster because the number of training parameters is reduced.
The pooling operation summarizes the features present in a region, the size of which is determined by the pooling filter. If a filter has the dimensions of 2x2, then the region that is summarized is also of the size 2x2.
Note: The size of a filter is usually much smaller than the size of the feature map.
The size of the feature map after the pooling layer is:
((l - f + 1) / s) * ((w - f + 1) / s) * c
Here:
l
= length of the feature map
w
= width of the feature map
f
= dimensions of the filter
c
= number of channels of the feature map
s
=
In this type of pooling, the summary of the features in a region is represented by the maximum value in that region. It is mostly used when the image has a dark background since max pooling will select brighter pixels.
Can be implemented using MaxPooling2D in keras.
In this type of pooling, the summary of the features in a region is represented by the minimum value in that region. It is mostly used when the image has a light background since min pooling will select darker pixels.
Can be implemented using MinPooling2D in keras.
In the third type of pooling, the summary of the features in a region are represented by the average value of that region. Average pooling smooths the harsh edges of a picture and is used when such edges are not important.
Can be implemented using AveragePooling2D in keras.
Each channel in the feature map is reduced to just one value. The value depends on the type of global pooling, which can be any one of the
Can be implemented using GlobalMaxPooling2D, GlobalMinPooling2D and GlobalAveragePooling2D in keras.