liveBook · Manning

Max pooling

As explained in Math and Architectures of Deep Learning

Max pooling is an aggregation operation that replaces each local or grouped region with its maximum value, often to downsample a representation.

Max pooling downsamples a feature map by sliding a kernel over local patches and replacing each patch with its largest value. This preserves strong local responses while reducing spatial precision and can make features more robust to small location changes. section 10.7 section 10.8

For each kernel position, the output is max(patch). Output size depends on kernel size and stride: a 2 × 2 kernel with stride 2 produces an output feature map half the input height and width; a 3 × 3 kernel with stride 3 reduces each dimension to one-third. section 10.7

A 2 × 2 pooling pass

Partition a 4 × 4 feature map into 2 × 2 patches with stride 2. Max pooling emits one maximum per patch, creating a 2 × 2 feature map. In PyTorch, create torch.nn.MaxPool2d(kernel_size=2, stride=2) and apply it to an N × C × H × W input tensor. section 10.7

In VGG-style convolutional blocks, convolution and ReLU layers retain spatial resolution, then a max-pool layer halves it. Repeating this across five blocks reduces a 224 × 224 input to a 7 × 7 feature map while channel counts increase. section 11.2.1

Max pooling also supports region-based detection. RoI pooling applies max pooling to regions of different sizes on a shared convolutional feature map, yielding fixed-sized features for classifier and regressor layers. section 11.4.3

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.

This diagram traces each 2 × 2 local patch to one maximum, making the halved spatial dimensions explicit. section 10.7

How Math and Architectures of Deep Learning covers it

How deep it goes
Defines local maximum aggregation and relates kernel size and stride to output resolution, with a PyTorch implementation.
Examples
Uses 2 × 2 stride-2 pooling on a 4 × 4 tensor and max-pool layers at the ends of VGG blocks.
What it assumes
Uses feature maps, kernels, strides, and tensor dimensions while introducing pooling as local-patch summarization.
What you can do after
Apply it via PyTorch MaxPool2d to downsample feature maps and place spatial reductions in convolutional architectures.
How it connects
Connects pooling to convolutional neural networks, average pooling, local translation invariance, VGG, and RoI pooling.

Also explained in

Compare how 10 books explain max 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.