Convolutional Neural Network (CNN)

A neural network architecture especially useful for images and other grid-like data.

What does a shared filter find along a strip?

Suppose a one-dimensional strip has brightness values 1, 1, 4, 4. Slide a two-cell filter across it, one position at a time. At each position subtract the first value from the second. This is a small version of the local operation used by many CNN libraries.

WindowCalculationResponse
1, 11 − 10
1, 44 − 13
4, 44 − 40

Why reuse the same weights?

The positive response identifies a local rise regardless of which window contains it. A two-dimensional convolutional layer learns filters over patches of an image and applies each filter at many locations. Stacking layers combines local responses into features with a wider field of view.

A two-window stencil frames neighboring image swatches.
Moving the same local filter reuses its weights at successive positions.

What changes at the boundary?

This example uses no padding, so four inputs and a width-two filter give three outputs. Padding, stride and pooling affect where outputs are available and which details survive. Moving or cropping an object can still change the prediction of the full network.

Follow the idea

Computer Vision · See where spatial features support recognition.

Object Detection · See how a vision model locates objects in an image.

Source · Dive into Deep Learning on image cross-correlation and convolutional layers

Return to Convolutional Neural Network (CNN) in the A–Z glossary