Notes

Pooling Layer

A pooling layer shrinks a feature map while keeping the information a network considers most useful. Think of it as replacing each small neighbourhood with a compact summary: the network loses precise location details, but gains a simpler, more manageable representation.

How pooling works

After a convolution produces a grid of activations, pooling moves a small window across that grid and emits one value per window. With a 2×2 window and stride 2, a 32×32 feature map becomes 16×16. The two common rules are:

  • Max pooling keeps the largest activation. If a feature detector strongly recognizes a pattern anywhere in its window, that evidence survives.
  • Average pooling outputs the mean activation, preserving the local amount of a feature rather than its strongest occurrence.

Pooling has no learned weights. During backpropagation through max pooling, only the input position that supplied the maximum receives gradient; average pooling distributes gradient across every value in the window.

Why a network uses it

Downsampling reduces the number of activations processed by later layers, cutting compute and memory. It also expands the effective receptive field: a later neuron can combine evidence from a larger region of the original input. Max pooling gives limited tolerance to small shifts—moving a detected edge by a pixel within the same window need not change the pooled output. The cost is irreversible loss of detail. Aggressive pooling early in a network can erase small structures or exact boundaries that later layers need.

Pooling in real architectures

Classic CNNs commonly placed MaxPool2d after convolution blocks. Modern architectures such as ResNet frequently downsample with strided convolutions instead, because they can learn the downsampling operation. Near a classifier head, global average pooling averages each entire feature map into one number per channel. This avoids a huge fully connected layer: a 7×7×2048 tensor becomes a 2048-value vector. Pooling therefore trades spatial precision for efficiency and broader context, and its placement determines how quickly that trade is made.

A pooling layer downsamples a feature map by aggregating values within local spatial windows, commonly using max pooling or average pooling. It reduces spatial resolution and computation while retaining salient local information and increasing tolerance to small input shifts. Pooling helps convolutional networks build more compact, robust representations; without controlled downsampling, later layers can be unnecessarily costly and sensitive to local variation.

Imagine looking at a large photo from a few steps farther away. You lose tiny details, but you can still tell whether it shows a dog, a car, or a face. A pooling layer gives an image-reading AI a similar shortcut.

It regularly shrinks the information the network is working with, keeping the most useful clues from each small patch. For example, it may keep the strongest sign of an edge or texture, while ignoring the exact pixel where it appeared.

This helps the AI focus on bigger patterns, work faster, and recognize an object even when it has moved slightly within the picture.