pooling -- max / average pooling, downsampling

After a filter has swept an image, the result is as large as the picture, which is more detail than the next stage needs. Pooling shrinks it: cover the grid with small non-overlapping squares and replace each one with a single number — either the largest value in it or the average of it. A two-by-two window stepping by two lands on half the width and half the height when the side length is even, so three quarters of the numbers are gone and everything downstream is four times cheaper. An odd side keeps only the windows that fit, which is under half. It also makes the network less fussy about exact placement, since a feature that shifts by a pixel usually lands in the same square. The cost is that you have thrown away where inside the square it was.

Interactive page: spatial pooling -- a window slides over the input reduces each window to one number (its max or its average), shrinking the feature map. The cheap, parameter-free downsampler in a CNN. Anchor: F (CNN / vision); Family F, companion to convolution.

What it shows

A k×k window steps over the n×n input with stride s (usually s = k, so the windows tile the input without overlap). Each window becomes one output cell:

Output size = ⌊(n − k)/s⌋ + 1, so a 2×2 pool with stride 2 halves each spatial dimension (downsampling). No weights -- pooling just summarises. The current window is outlined on the input (with the max cell marked for max-pool); the smaller output grid fills as the window slides (auto-plays + loops).

Drag any input cell to change its value and watch the pooled output recompute (for max-pool, the output only moves if you change the window's max); hover any input or output cell. Toggle max ↔ avg to compare.

Render tier

T1 (Canvas2D: the input grid + sliding window, the downsampled output grid, the per-window reduction).

Wiring

layout.mount + controls (n, k, stride, pool, seed) + an output-position Transport (slide the window) + onPointer input-cell drag hover. ?step / ?n / ?k / ?stride / ?pool / ?drag / ?hover hooks. Source: page.js.