How a CNN reads a digit.
Small filters slide across the image, pooling keeps what matters, and a final layer weighs the evidence for each digit.
Filters find strokes
Each 3×3 filter slides over the image and responds where its pattern appears: an edge, a corner, a curve. The result is a feature map.
Pooling shrinks the map
Max pooling keeps the strongest response in each 2×2 patch, so the network cares less about exactly where a stroke is.
Dense layers decide
The second convolution combines strokes into shapes. Dense layers then score each digit, and softmax turns the scores into probabilities.
Model and credits
The network was trained for this site on the MNIST database of handwritten digits by Yann LeCun, Corinna Cortes and Christopher J. C. Burges (CC BY-SA 3.0), with rotations, shifts and stroke-width changes so hand-drawn digits work. It runs entirely in your browser; nothing you draw leaves your device. The example digits come from the MNIST test set.