Trusted answers to developer questions
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
=
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
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.
RELATED TAGS
CONTRIBUTOR
Fatima Hasan
Keep Exploring
Related Courses
TRENDING TOPICS
Copyright ©2024 Educative, Inc. All rights reserved.
Did you find this helpful?