liveBook · Manning

Pooling

As explained in Math and Architectures of Deep Learning

A downsampling operation on feature maps that reduces spatial resolution, often by local averaging or max selection.

Pooling downsamples a feature map by sliding a small kernel across local patches and replacing each patch with a summary value. This lowers spatial resolution while retaining important features, making convolutional neural networks less sensitive to small shifts, crops, rotations, and distance changes. section 10.7

For a local patch P, max pooling returns max(P), while average pooling returns the arithmetic mean of P. Kernel size and stride determine how many patches are sampled and therefore the output resolution. A 2 × 2 kernel with stride 2 produces a feature map half the input size; a 3 × 3 kernel with stride 3 produces one-third the size. section 10.7

Common pooling roles include:

  • Max pooling preserves the strongest activation in each local patch. section 10.7
  • Average pooling replaces each patch with its mean, providing local averaging and subsampling. section 10.7 section 11.1
  • Pooling reduces feature-map sensitivity to shifts and distortions and supports robustness in convolutional architectures. section 10.8 section 11.1

A 2 × 2 PyTorch pooling step

Represent a feature map as a four-dimensional tensor, then apply torch.nn.MaxPool2d(kernel_size=2, stride=2) or torch.nn.AvgPool2d(kernel_size=2, stride=2). Each operation produces a 2 × 2 output from the supplied 4 × 4 input, summarizing non-overlapping local patches. section 10.7

Figure 10.19 Max pooling using a 2 × 2 kernel with stride 2. The resulting output feature map is half the size of the input feature map. Each value of the output feature map is a max of the corresponding local patch in the input feature map.

Shows how each 2 × 2 input patch contributes its maximum to the downsampled output feature map. section 10.7

How Math and Architectures of Deep Learning covers it

How deep it goes
Defines max and average pooling, explains kernel and stride effects, and bridges the operations to PyTorch implementation.
Examples
Uses 2 × 2 max- and average-pooling examples, a 4 × 4 tensor, LeNet subsampling, and global average pooling in GoogLeNet.
What you can do after
Apply it via PyTorch using MaxPool2d and AvgPool2d with chosen kernel sizes and strides.
How it connects
Connects pooling with convolutional neural networks, feature maps, downsampling, local translation invariance, LeNet, and Inception.

Also explained in

Compare how 8 books explain pooling →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Math and Architectures of Deep Learning. The section links point to the parts of the book it draws on.