Visual explainer
Convolutional Neural Networks
How stacked convolution and pooling shrink a 28x28 image to 784 features and vote for 10 classes.
Flatten a 4 by 4 patch and two touching pixels land in slots 1 and 5. They were neighbours; now three strangers sit between them. Your network must relearn geometry you just threw away.
Patches Stay Neighbours
Scan instead of flattening. One window maps to one feature cell, so neighbours in stay neighbours out. With padding 1 a 4 by 4 image yields a 4 by 4 map holding features, not raw colors.
Shrink Space, Grow Meaning
Follow one image: 28 by 28 by 1, convolve to 8 channels, pool to 14, convolve to 16, pool to 7 by 7 by 16. Seven times seven times sixteen is 784, voting for 10 classes. Space shrinks; meaning deepens.
Keep The Max
A 2 by 2 pool keeps the top signal and drops the rest: from 1, 5, 2 and 4 only the 5 survives. A 4 by 4 map becomes 2 by 2. You trade position for shift tolerance.
Eighty Beats Twenty-Five Thousand
Count it: eight 3 by 3 kernels plus biases total 80 parameters. A dense layer of 32 units on the same 784 inputs costs 25,120. Sharing cuts the bill 314 to 1 for the same input.
Blur Or Keep Place
Max pooling is free but forgets where things sat. Strided convolution learns its own shrink at the price of weights. Classifying photos means pool hard; painting per-pixel maps means keep place and stride gently.
Where It Breaks
Pool an 8-pixel map four times and you get 4, 2, 1, then gone. No map means no vote. Small inputs need fewer pools, so you fit the depth to the image instead of copying a big-network recipe.
The Quick Version
- Flattening tears touching pixels 4 apart.
- Patches map one to one, geometry survives.
- Pipeline ends at 7 by 7 by 16.
- Max pool keeps 5, drops the rest.
- Eight kernels cost 80, not 25,120.
- Pool for labels, stride for maps.
- Four pools eat eight pixels whole.