Convolutional neural networks

How machines see

A camera hands the computer a million numbers. Somehow it answers “that’s a cat.” This page shows the trick — with pictures you can poke at.

▼ scroll
01 · Pixels

To a computer, an image is just a grid of numbers

There is no “seven” inside your computer. There’s a grid where every pixel is a brightness value — 0 for black, 255 for white. Everything a neural network does starts from this humble spreadsheet.

 

Hover (or tap) a pixel to inspect it. A real photo works the same way, just bigger — a 12-megapixel photo is 36 million of these numbers (three per pixel: red, green, blue).

So the real question is: how do you get from a grid of numbers to “this is a 7”? The answer starts with a surprisingly simple operation.

02 · Convolution

A tiny window slides across the image

Take a small grid of weights — a kernel (also called a filter). Slide it over the image. At every stop, multiply each pixel under the window by the matching weight and add everything up. That single sum becomes one pixel of a new image called a feature map.

That’s it. That’s a convolution. Watch it run:

input · 10×10
kernel · 3×3
press play to start scanning
feature map · 8×8
positive response negative response
The small numbers in the corners of the highlighted window are the kernel weights being applied. Try different kernels — the same image gives completely different feature maps.

Two details worth noticing. The output is slightly smaller (10×10 → 8×8) because the window can’t hang off the edge. And the same nine weights are reused at every position — a kernel has no idea where it is, it only knows what it’s looking at. Hold that thought; it’s the superpower.

03 · Feature detectors

Each kernel is a tiny pattern detector

A kernel lights up wherever the image locally matches its pattern. One kernel fires on vertical edges, another on horizontal ones, another on diagonals. A convolutional layer runs many kernels in parallel, producing a stack of feature maps — one per kernel.

Draw something and watch four detectors respond in real time:

draw here · 28×28
matches the pattern matches its opposite
Draw a plus sign: the vertical-edge map traces its upright stroke, the horizontal-edge map traces the crossbar. In a real CNN these kernels aren’t designed by hand — they’re learned during training, and they end up looking remarkably like these.
04 · Nonlinearity

ReLU: keep the hits, drop the rest

Feature maps come out signed: positive where the pattern matched, negative where its opposite did. After each convolution, the network applies a brutally simple rule to every value — ReLU (rectified linear unit): if it’s negative, make it zero.

output = max(0, input)
before
signed responses
after ReLU
negatives zeroed

The map becomes a clean “heat map” of where the feature was found. This little kink is also what makes deep networks possible: without a nonlinearity between them, stacked convolutions would collapse into one big (and much weaker) linear filter.

05 · Pooling

Zoom out: summarize each neighborhood

Next the network shrinks the map. Max pooling slides a 2×2 window (in steps of 2) and keeps only the strongest value in each block. The map halves in size, but the detections survive.

feature map · 8×8
pooled · 4×4
Hover a cell to see which 2×2 block feeds which output. Pooling buys two things: less data for the next layer to chew on, and a small tolerance to shifts — if the edge moves one pixel, the max of its block usually doesn’t change.
06 · Depth

Stack it: edges → parts → things

Here’s where it becomes a network. The pooled feature maps are themselves images — so convolve them. A second layer of kernels doesn’t see pixels anymore; it sees combinations of first-layer features: a vertical edge meeting a horizontal one is a corner, edges arranged in a ring are a loop.

Layer by layer, the maps get smaller in space but richer in meaning: edges → textures and corners → parts → whole objects. Below is a live two-layer stack running on your drawing:

hover any cell in the later layers…
You can draw directly on the input here too. Hovering a deep-layer cell outlines its receptive field — the patch of the original image that single value can “see”. It grows with every layer: 3×3 after one convolution, 10×10 by the last map here. Deep enough, and one value sees the whole image.

In a real network the pattern is exactly this, just bigger: dozens of layers, hundreds of kernels per layer, millions of images of training. And nobody writes the kernels — training nudges their weights until useful detectors emerge.

07 · The verdict

From feature maps to “it’s a cat”

After the last layer, the spatial maps are tiny but each value means something high-level: “whiskery texture here”, “pointy ear-ish corner there”. The network flattens them into one long list and feeds it to a final, ordinary layer that computes a score for every class. A function called softmax then turns raw scores into probabilities that sum to 100%.

raw class scores (logits)

Drag the scores. Notice softmax is a tug-of-war: raising one class pulls probability away from all the others, and gaps matter exponentially.

after softmax

That’s the whole journey: numbers → edges → parts → scores → probabilities.

08 · Why this design wins

Three ideas do all the work

🔁Weight sharing

One kernel, reused everywhere. Nine numbers scan the whole image instead of every pixel needing its own weight — millions of times fewer parameters, and far less data needed to learn them.

📍Translation tolerance

Because the kernel is the same everywhere, a cat in the corner triggers the same detectors as a cat in the middle. The network learns what, not where — and pooling adds extra wiggle room.

🧱Hierarchy

Simple detectors compose into complex ones, layer by layer. No one programs “ear” or “wheel” — those concepts condense out of edges, the way words condense out of letters.

This recipe — convolve, ReLU, pool, repeat, classify — powered the 2012 AlexNet moment that kicked off the deep-learning era, and it still runs your phone’s face unlock, photo search, medical image screening, and the vision systems in cars. Newer architectures remix the details, but the core idea on this page is still how machines see.

Everything above runs live in your browser — every feature map is a real convolution of whatever you drew. Nothing is prerendered.