Back

The convolutional neural network

A filter that slides, a map of clues, a hierarchy of shapes. How networks learned to see, explained in two minutes.

0:00 0:00

Pixels in, structure out.

A photo is a grid of numbers: millions of pixels, each one a brightness value. Feed them raw into the neuron from the previous episode and it sees noise, not shapes. It cannot tell where the cat ends and the wall begins. A convolutional neural network fixes this by looking at the image the way you do: not pixel by pixel, but patch by patch, searching for patterns that repeat.

A filter that slides.

The tool is a small grid of weights called a kernel, say 3 by 3. You place it on a corner of the image, multiply each pixel by the matching weight, and sum: one number out, one clue. Then you slide it one step right and repeat, over and over, until the whole image is covered. The result is a new grid called a feature map: bright where the pattern is present, dark where it is absent.

Edges, then parts, then objects.

One kernel can only hunt one pattern. The first layer learns kernels for edges: vertical, horizontal, diagonal. The next layer reads those feature maps and combines edges into textures and corners. Deeper still, parts appear: a wheel, an ear, a leaf. The last layers assemble parts into objects. Each stage inherits the work of the previous one, which is why a CNN reads an image like a sentence, clue after clue.

The math, plainly.

Everything a convolution computes fits in three lines: a local weighted sum, the same sum repeated at every position, and a subsampling that keeps only the strongest clues.

y(i,j) = Σₘ Σₙ x(i+m, j+n) · k(m,n) + b

feature map = y over every (i,j)

max pool: keep max of each patch

One kernel, everywhere.

The trick that makes it work: the same kernel slides across the entire image, so its few weights are reused at every position. A cat’s ear in the top left scores exactly like a cat’s ear in the bottom right. That is translation invariance, and it is also why CNNs are cheap: a 3 by 3 kernel has nine weights, whether the image holds a thousand pixels or a billion. Training only has to learn those little grids, layer after layer.

Keep learning.