Pooling

What It Does

Pooling compresses a feature map by replacing each spatial region with a summary value. It reduces the height and width while keeping the channel count unchanged.

This gives later layers less data to process and lets each output location summarize a larger area of the original image.

Core Idea

A pooling window moves across each channel independently. At every position, a fixed rule turns the values inside the window into one output value.

For a window Ri,jR_{i,j}, max and average pooling compute:

yi,j=max⁡(u,v)∈Ri,jxu,voryi,j=1∣Ri,j∣∑(u,v)∈Ri,jxu,vy_{i,j} = \max_{(u,v) \in R_{i,j}} x_{u,v} \qquad\text{or}\qquad y_{i,j} = \frac{1}{|R_{i,j}|}\sum_{(u,v) \in R_{i,j}} x_{u,v}

How It Works

Local Max Pooling

Max pooling keeps the strongest activation in each window. A common configuration uses a 2×22 \times 2 window with stride 2, halving both spatial dimensions.

It emphasizes whether a feature appeared somewhere in the window, but discards its exact strength and position along with all non-maximum values.

Local Average Pooling

Average pooling keeps the mean activation. It preserves overall response level rather than a single peak, producing a smoother but still lossy result.

Property Max pooling Average pooling
Summary Largest value Mean value
Emphasis Strong responses Overall response
Main loss Non-max values and position Local variation and peaks
Typical role Intermediate downsampling Smoothing or aggregation

Global Average Pooling

Global average pooling takes the mean over the full height and width of each channel. It maps an H×W×CH \times W \times C feature map to a vector with CC values.

Classification networks often place it before the final linear layer. Unlike a large fully connected spatial head, it adds no learned parameters and can support varying input sizes.

Stride Controls the Reduction

Window size determines what each output summarizes; stride determines how far the window moves. Overlapping windows use a stride smaller than the window. Stride 2 is common for downsampling.

Why It Matters

  • Lower cost: Smaller feature maps reduce memory use and computation in later layers.
  • Wider effective context: Each later activation corresponds to a larger region of the input.
  • Local stability: Small shifts may leave a pooled result unchanged, although pooling does not guarantee full translation invariance.
  • Parameter-free reduction: Max and average pooling impose a useful fixed operation without learned weights.

Design Trade-offs

Pooling exchanges spatial detail for efficiency. Repeated reduction can erase small objects and precise boundaries, which is especially harmful for detection and segmentation.

A stride-2 convolution can learn how to downsample, but it adds parameters and may learn aliasing-prone filters. Fixed pooling is simpler and remains useful when a learned reduction is unnecessary.

Architecture Typical strategy
VGGNet 2×22 \times 2 max pooling between blocks
ResNet Strided convolution for reduction; global average pooling at the head
U-Net Max pooling in the encoder; upsampling in the decoder
EfficientNet Strided depthwise convolution; global average pooling at the head
Vision Transformer Patch embedding and token aggregation rather than classic local pooling

Choose the reduction schedule around the task. Classification tolerates aggressive compression more readily than dense prediction, where high-resolution features and skip connections preserve location.

Related