CNN explorer

A stage diagram says "Conv 3×3 → ReLU → MaxPool → … → FC". This page shows the arithmetic those boxes stand for, on an input you draw, with every intermediate tensor visible all the way to the class scores. Everything downstream recomputes when you change something upstream.

window the kernel is currently reading (forward) receptive field: hover any cell of any map to see every upstream patch that feeds it, back to the pixels

Input and kernel

16×16×1 image, one 3×3 filter

Paint on the grid (click–drag; right-drag or shift erases). Pixel values are 0–1. The kernel is the set of learned weights in a real network; here you pick or type them.

Kernel slot in use: 1 of 4 (bank in stage 4)
Padding adds a border of zeros so edge pixels get a full window. Stride is how far the window jumps. Dilation spreads the kernel taps apart so the same 9 weights cover a wider area. All three only change where the window lands; the arithmetic at each position is identical.

Convolution, one position at a time

out[i,j] = Σ window ⊙ kernel

Scrub through the output positions. The yellow window on the (padded) input is multiplied elementwise with the kernel and summed into one output cell. That is the whole operation; a conv layer is this repeated at every position and for every kernel.

Padded input, window at output (0, 0)
Feature map (raw) −+
window
⊙
kernel
=
products

Nonlinearity and pooling

ReLU · pool 2×2 / stride 2

ReLU clips negatives to zero: it keeps "evidence for" the pattern and drops "evidence against". Pooling then keeps the strongest (or average) response in each 2×2 block, halving height and width. Hover any cell: its receptive field lights up in green on the earlier maps and on the input. Neither step has learned parameters.

raw conv output
after ReLU
after pool
hover a pooled cell
Without the nonlinearity, two stacked conv layers collapse into one bigger linear filter: nothing new could be computed by going deeper. Try "no activation" and notice the pooled map now carries negative values through.

Many kernels, then a kernel over all channels

layer 1: 4 × (3×3×1) · layer 2: 8 × (3×3×4)

A conv layer has many kernels; each produces its own feature map, and the maps stack into channels. The step that diagrams hide: a kernel in the next layer is not 3×3, it is 3×3×C — one 3×3 slice per input channel. Each slice convolves its channel, and the partial maps are summed into a single output. Shown here for the first of the eight layer-2 kernels. Click a bank slot to make it the kernel used in stages 1–3.

Layer 1 bank — 4 kernels → 4 feature maps (after ReLU + pool)
Layer 2, kernel 1 — four slices, four partial sums, one output map
The output is a detector for a combination of layer-1 patterns at neighbouring positions — this is how edges become corners, and corners become parts.

From feature maps to a prediction

pool 1 → conv 2 + ReLU → pool 2 → global average → FC → softmax

The whole network end to end. After the last pooling, each channel is averaged over space into one number (global average pooling), so the image becomes a vector of 8 "how much of pattern j is present, anywhere". A fully connected (FC) layer maps that vector to 10 class scores: each of the 8 values connects to each of the 10 classes through its own weight, so the FC layer is just an 8×10 grid of numbers plus 10 biases — learned parameters exactly like the kernels, and the only other kind the network has. Softmax turns scores into probabilities. Hover any map cell for its receptive field, a vector entry to see which map it summarises, an FC weight to see which average and class it connects, or a class bar to see how its score is built. Layer-2 and FC weights here are random, so the prediction is arbitrary — training is what moves these weights until the right bar wins. The mechanics are exactly what a trained network does.

Hover a cell anywhere in the page to trace its receptive field.
Receptive field grows at every conv and every pool. The layer-2 pooled cells already see a large patch of the 16×16 input; in a 224×224 network the stage-4 cells of a 7×7 grid each see most of the image. That spatial summarising is what lets a small FC head classify — and it's the thing attention does in one step rather than by stacking.

Terms

dotted words above point here

Everything on this page is built from these. Hover or tap a dotted term anywhere above for the same definition in place.