Chapter 2: Deep learning

Convolutions, residual blocks and conv arithmetic

You will be able to compute a conv layer's output shape, parameter count and FLOPs by hand. You will also be able to explain why a block that adds its input back lets very deep nets train. Interviewers ask for these numbers by hand, and shape bugs appear in almost every vision and transformer model.

20 minInteractive lessonChapter 2: Deep learningLesson 10 of 20

What you will learn

  • Compute conv output shapes, parameters and FLOPs
  • Explain parameter sharing and receptive fields
  • Explain why residual connections make deep nets trainable

Key terms

filter
a small grid of weights that scores one patch of the image
channel
a number kept for each pixel: a colour, or later one filter's scores
stride
how many cells the filter jumps at each move
padding
zero cells added at the edge of the image
shortcut
a path that carries the input of a block past its layers

Prerequisites

Take Batch size: gradient noise and scaling the learning rate first. It comes right before this lesson in the course.

Where this lesson picks up: In the last lessons you saw how batch size sets the gradient noise, and that a bigger model can generalize better than a smaller one. But a dense layer on a small photo needs millions of weights, so how can vision nets grow deep at a low cost?

What comes next

When a conv net draws boxes around objects, how do you tell a good box from a bad one?

Next lesson: Detection metrics: IoU, NMS and mAP

More lessons in this part

Take the lesson

Short cards, one idea at a time, with quick checks as you go.