What are some deep details about pooling layers in CNN?

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 = stridenumber of steps to move the filter

Max Pooling

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.

Min Pooling

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.

Average Pooling

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.

Global pooling

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 previously explained typesMax, Min, or Average. Global pooling is almost like applying a filter of the exact dimensions of the feature map. \

Can be implemented using GlobalMaxPooling2D, GlobalMinPooling2D and GlobalAveragePooling2D in keras.

Benefits

  • Faster computation due to reduced parameters
  • Robust to variations in the features’ positions such that if the feature exists in a different position than it did in the training data, it can still be accurately classified
  • Reduce overfitting

Drawbacks

  • Some spatial information may be lost, especially if the filter size is too big
  • If max pooling is used in an image where the background is light, it may eliminate the foreground features and only return the background (since white has a pixel value of 255 and black 0). Same goes for dark background and min pooling.

Free Resources