Skip to content
AI360Xpert
Beta
Core ML

Visual explainer

Convolutional Neural Networks

How stacked convolution and pooling shrink a 28x28 image to 784 features and vote for 10 classes.

Flattening a 4 by 4 patch tears vertical neighbours 4 slots apart in the vector.
Flattening a 4 by 4 patch tears vertical neighbours 4 slots apart in the vector.

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

Each patch maps to one feature cell, so neighbours in stay neighbours out.
Each patch maps to one feature cell, so neighbours in stay neighbours out.

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

28 by 28 by 1 becomes 7 by 7 by 16, which flattens to 784 votes for 10 classes.
28 by 28 by 1 becomes 7 by 7 by 16, which flattens to 784 votes for 10 classes.

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

Max pooling keeps only the 5 from 1, 5, 2 and 4, halving each side.
Max pooling keeps only the 5 from 1, 5, 2 and 4, halving each side.

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

Eight small kernels cost 80 parameters where a dense layer of 32 costs 25,120.
Eight small kernels cost 80 parameters where a dense layer of 32 costs 25,120.

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

Pool when position can blur, and stride or less pooling when exact place matters.
Pool when position can blur, and stride or less pooling when exact place matters.

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

Pooling an 8 pixel map four times leaves nothing to classify, so depth must fit input size.
Pooling an 8 pixel map four times leaves nothing to classify, so depth must fit input size.

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.