← Explainer Library

Interactive Explainer

Pooling, Cell by Cell

Pooling is the quiet workhorse of a CNN: it shrinks a feature map by summarising each little window with a single number. Slide the window below and watch the output grid fill in — max keeps the strongest activation in each patch, average smooths it. The output size is no mystery either; one floor formula predicts it exactly.

The Lab

Slide the window, watch the output

A $6\times6$ feature map sits on the left. A pooling window of size $K$ slides across it with stride $S$; each landing produces one number on the right. Step through the positions, or press play. The highlighted patch on the left is the current window; the outlined cell on the right is the number it produces. In max mode the winning input cell is starred.

Window $K$ Pooling
Left: the input feature map with the live pooling window. Right: the output map, filling one cell at a time.
Output size
Cells produced
Current window → value
Set $K=2$, $S=2$. This is the classic pooling layer: it halves each spatial dimension, turning $6\times6$ into $3\times3$ with no overlap. Now switch to Max versus Average on the same window and watch the produced number change — max reports the single strongest response, average reports the mean.
The Payoff

Why pool at all?

$$\text{out} = \left\lfloor \frac{W - K}{S} \right\rfloor + 1 .$$
Read the formula as a count. Starting at position $0$, each step advances the window by $S$; it fits as long as the window's far edge stays inside the map. The number of landings is exactly $\lfloor (W-K)/S \rfloor + 1$ — the same shape formula as convolution, just with padding $P=0$.