Pooling is a way to shrink the width and height of data inside a convolutional neural network (CNN). It keeps a summary of nearby values, helping the network work with smaller feature maps.
How pooling works
- A pooling window, such as 2 × 2, moves across a feature map.
- At each position, the layer combines the values inside the window.
- The combined value becomes one value in a smaller output map.
For example, a 2 × 2 window can reduce a 4 × 4 feature map to a 2 × 2 map when it moves in steps of two.
Common types
- Max pooling: keeps the largest value in each window. It highlights whether a strong feature, such as an edge, appears nearby.
- Average pooling: calculates the average value in each window. It gives a smoother summary of nearby features.
Why use pooling?
- It reduces the amount of data and computation in later layers.
- It can make a model less sensitive to small shifts in an image.
- It preserves useful information while making feature maps smaller.
Important: Pooling reduces spatial size, but it does not learn weights in the same way a convolution layer does. Some modern CNNs use strided convolutions or other methods instead of pooling.