Convolution

A fully connected layer treats an image as a shuffled bag of numbers. Convolution builds in two facts about pictures — nearby pixels belong together, and a pattern means the same thing wherever it appears — and pays for them with a tiny, shared kernel.

50 min

After this lesson you can

  • Explain why a fully connected layer is wasteful on images, with actual parameter counts
  • Compute a 2-D convolution (really a cross-correlation) by hand and in NumPy
  • Use the output-size formula for padding and stride, and count a conv layer's parameters with channels
  • State translation equivariance precisely and say what pooling adds
  • Compute how a receptive field grows with depth and stride

In this lesson

  1. What goes wrong with a fully connected layer
  2. The picture: a kernel sliding over an image
  3. The formula
  4. Equivariance: move the input, the output moves too
  5. Stride, padding and the size of the output
  6. Channels: kernels are really three-dimensional
  7. Receptive fields: how far can a unit see?
  8. The code

This lesson is part of Descent Pro

Descent Pro unlocks every lesson on the route, from base camp to the summit. Every plan starts with a free trial.

Descent Pro

Start your free trial to keep reading

This lesson, and every other lesson on the route, is part of Descent Pro. Every plan starts with a free trial, and students with a .edu email get longer. Cancel before the trial ends and you pay nothing.