Convolutional Neural Networks
Convolutional Neural Networks — A convolutional neural network (CNN) stacks convolution and pooling layers to turn raw pixels into a hierarchy of features — edges, then strokes, then whole shapes — and a final dense layer classifies the result. It is the architecture that made image recognition work.
Draw a digit and watch a real CNN take it apart: convolution layers light up as edge and stroke detectors, pooling shrinks the picture, and a final layer votes on which digit it is. Then rotate your digit and watch its confidence collapse — CNNs see patterns, not orientations.
The idea in plain words
A convolutional neural network stacks the convolution operation into layers. Early layers learn simple kernels — edges and strokes; later layers combine those into whole shapes. Between them, pooling shrinks each feature map by keeping only the strongest response in each little neighborhood, which throws away exact position and keeps the “was this feature here?” signal.
Draw a digit and watch it happen: the eight feature maps are the network’s real layer-1 activations, and a final layer reads the pooled features to vote on which digit it is — the same idea as an MLP, but fed by learned image features instead of raw pixels. Then rotate your digit: pooling buys a little tolerance to shifts, but convolution shares weights across space, not orientation — so a rotated digit looks like a pattern the network never learned, and its confidence collapses.
Now, the math
The network is a short pipeline of convolution, nonlinearity, pooling, and a dense classifier:
- the convolution layer — a bank of learned kernels applied to the input.
- the nonlinearity (see activation functions) that keeps only positive responses.
- downsampling that keeps the strongest activation in each 2×2 window.
- the final dense layer that turns pooled features into 10 class scores.
▸ Show the derivation
The whole network is trained end to end with backpropagation: the same chain rule flows gradients back through the dense layer, the pooling (which routes the gradient only to the winning unit), and the shared convolution weights. Weight sharing means one kernel’s gradient is summed over every position it was applied — which is exactly why it learns a feature that generalizes across the image, and equally why it never learns to be invariant to rotation.
Now Break It
Try this: Rotate the drawn digit 90° and the network misclassifies it — convolution shares weights across space, not orientation.
Control: Distort control (rotate the digit)
What happens: CNNs aren’t rotation-invariant! Convolution shares weights across space, not orientation — so a rotated digit looks like a different pattern entirely.
Where convolutional neural networks is used
Convolutional neural networks are the reason computers can see. They power face unlock on phones, medical diagnosis from X-rays and retina scans, quality inspection on factory lines, handwriting and license-plate recognition, and the perception stack of self-driving cars. The same architecture, scaled up, underpins the image encoders inside modern multimodal AI systems. The digit classifier here is a miniature of exactly this pipeline: stacked convolutions and pooling turn raw pixels into features, and a dense layer reads them out.
The most common misconception is that a CNN “understands” an image the way a person does. It doesn’t — it detects a hierarchy of statistical patterns, which is why a digit rotated 90° or a photo with unfamiliar lighting can fool it even though it looks obvious to you. A second trap is assuming pooling makes the network fully invariant: pooling grants only small tolerance to shifts, not to rotation or scale. Finally, more filters and layers are not automatically better — without enough training data a bigger CNN simply overfits, memorizing the training images instead of learning general features.
Frequently asked questions
What is a feature map in a CNN?
What does the pooling layer do?
Why is a CNN better than a plain neural network for images?
Why does rotating a digit break the CNN?
Does this run a real neural network in my browser?
Written & reviewed by the ML Visualization team · Last updated .