Guide

A CNN needs to shrink its feature maps as it goes deeper. It also needs to keep its cost under control. Pooling handles the shrinking by summarizing each window. 1×1 and depthwise separable convolutions handle the cost by splitting one large operation into smaller ones.

Max pooling

A 2 × 2 max pool takes the largest value in each non-overlapping window. The grid is halved in each direction, and small shifts within a window no longer change the output.

Take a 4 × 4 map and pool it with a 2 × 2 window:

input:              output:
1 3 | 2 0           4 2
4 2 | 1 1           2 6
----+----
0 1 | 5 2
2 2 | 3 6

Each output is the max of one window: max(1, 3, 4, 2) = 4, max(2, 0, 1, 1) = 2, max(0, 1, 2, 2) = 2 and max(5, 2, 3, 6) = 6.

Average pooling takes the mean instead, which is softer. Modern networks often use strided convolutions for downsampling, but the goal is the same.

Tip

Global average pooling takes the mean of each channel over the whole map. This turns (B, C, H, W) into (B, C), so the classifier head can be a small linear layer. It replaces the large flatten-and-linear head shown on the output shapes page.

1×1 convolutions

A 1 × 1 convolution looks at one position at a time and mixes its channels. It is a cheap, learned channel remix. Bottleneck blocks use it to reduce channels, run a 3 × 3 convolution on the smaller set, then expand again. That lowers the cost of the middle layer.

Depthwise separable convolutions

A standard 3 × 3 convolution mixes space and channels in one step. A depthwise separable convolution splits the work in two:

  1. A depthwise 3 × 3 filter per input channel, which handles space only.
  2. A 1 × 1 pointwise convolution, which mixes channels only.

For C_in = C_out = 64 and a 3 × 3 kernel, compare the weight counts:

standard:            64 × 64 × 3 × 3        = 36,864
depthwise separable: 64 × 3 × 3 + 64 × 64   =  4,672

That is about 7.9 times fewer weights. MobileNet uses this design for phones and edge devices.

Common mistakes

  • Mixing up pool size and stride. A 2 × 2 pool with stride 2 halves the grid. With stride 1 it barely shrinks it.
  • Assuming pooling loses nothing. Pooling discards where a value came from within the window. That is intended for classification, but it hurts tasks that need exact locations, such as detection.
  • Using global average pooling for dense outputs. If the task needs a map, not a single vector per image, keep the spatial dimensions.

Check yourself

  1. What is the output size of 2 × 2 max pooling with stride 2 on a 6 × 6 map? 3 × 3.
  2. Why is depthwise separable convolution cheaper? It separates the spatial filter, applied per channel, from the channel mix, a 1 × 1 convolution, so it avoids the full k² · C_in · C_out cost.

Key takeaways

  • Pooling shrinks the grid by summarizing windows, typically with a max.
  • Global average pooling turns each channel into one number, which keeps the head small.
  • 1 × 1 convolutions mix channels cheaply.
  • Depthwise separable convolutions cut the weights and compute, which matters on small devices.

Further learning

The batch normalization and augmentation details that come with these networks are in the CNN overview.