Skip to content
← AI Folks Labs

Nine numbers that can see edges

Convolution sounds like a technical term hiding something difficult. It is nine multiplications and an addition, repeated for every pixel. Everything computer vision does for the first twenty years rests on this one operation.

7 min · Beginner · Playable

First, the idea

Slide a small window over a big picture

Take a 3×3 grid of numbers — the filter. Place it over the top-left corner of a photograph. Multiply each of the nine numbers by the brightness of the pixel underneath, add the nine results together, and that total becomes one pixel in a new image. Slide one pixel right and do it again. That is the entire operation.

The filter is tiny

Nine numbers, reused across every position in the image. That reuse is why this is so much cheaper than connecting every pixel to every other.

The output is a new image

One number per position. Bright where the filter found what it responds to, dark where it did not.

The numbers decide what it finds

Change the nine and the same photograph produces blur, or edges, or embossing. Nothing else changes.

Stage 01

Watch the arithmetic happen

Move your cursor across the “Before” picture. Underneath you will see the nine pixel values you are hovering over, the nine filter numbers, and the single number they produce. Then try each filter and watch the same photograph turn into something else.

Move over the image to see the arithmeticEdges
Before
After

The nine pixels under your cursor

Hover or drag across the “Before” picture. Every output pixel is those nine numbers multiplied by these nine, added together.

Filters

Or type your own

Sum is 0. A sum of zero means flat areas turn black.

Where all nine are similar the result is zero — flat areas go black and only edges survive.

A real convolution, computed on every pixel in your browser. In a trained network nobody types these nine numbers — they start random and are learned.

In plain words

Try Edges and hover over a flat patch of sky. All nine pixels are nearly identical, the positives and negatives cancel out, and the answer is close to zero — which is black. Now hover over the horizon. The nine values disagree, nothing cancels, and the answer is large. That is all “edge detection” means.

Stage 02

Now stop choosing the numbers

Everything above is a filter somebody designed by hand. For decades that was the job — vision researchers invented filters and argued about which ones to use. The shift that created modern computer vision was simple: start with random numbers, and let gradient descent choose them.

Layer one learns edges

Left to itself, the first layer of a trained network reliably learns edge and colour-blob detectors that look very like the filters you just tried. Nobody puts them there.

Layer two learns corners and textures

Combining edge outputs gives corners, curves and repeating patterns. Each layer works on the previous layer’s findings rather than on pixels.

Deeper layers learn parts

Wheels, eyes, doorframes. By this depth a single filter is responding to something you could name, built entirely out of arithmetic on edges.

The last layers learn objects

Cars, faces, cats. The hierarchy was never designed — it is what falls out of stacking this one operation and training the numbers.

What follows from this

What this explains

Why vision models need so little memory per layer

The same nine numbers are reused at every position in the image. A fully connected layer over a megapixel image would need billions of parameters; a convolution needs nine.

Why they cope with things moving

Because the filter is applied everywhere, a cat in the corner triggers the same detectors as a cat in the middle. That property is built into the operation, not learned.

Why they get confused by texture

A network built from texture detectors can be fooled by texture. This is the mechanism behind many adversarial examples — the picture looks unchanged to you and completely different to the filters.

Why the same trick works on audio

Slide a filter along a spectrogram instead of an image and it finds rising tones and transients. Any signal with local structure is fair game.

Next

The numbers are found by gradient descent

Which is the other half of this story — how a pile of random numbers becomes an edge detector without anyone deciding it should.