Syllabus Lesson 114 of 246 · Module 10: Networks that see (CNNs)
Module 10: Networks that see (CNNs)

How much of the image one unit sees

Why it matters A unit deep in a CNN can only recognise something that fits inside the patch of the image it can see. Knowing that patch size tells you what a network can and cannot notice.

See it

Play the animation. One unit in layer 1 sees 3 by 3 pixels. A unit in layer 2 sees 3 by 3 layer-1 units, and each of those sees 3 by 3 pixels, overlapping: together 5 by 5. Each 3 by 3 layer adds 2. A stride of 2 doubles how much every later layer adds, which is why strides and pooling let deep units see far.

The rule

r, jump = 1, 1
for k, s in layers:
    r += (k - 1) * jump
    jump *= s

Three 3 by 3 layers, stride 1: r = 1 + 2 + 2 + 2 = 7.

Receptive field: the patch of the input that can affect one unit.

Words and symbols in this lesson
padding (p), stride (s)
zeros added around the edge; how many pixels the filter moves each step
pooling
shrinking a map by keeping the max or average of each block
receptive field
the patch of the input that can affect one unit
Your turn

Write receptive_field(layers), where layers is a list of (kernel, stride) pairs, first layer first.

Spotted a problem in this lesson? Report it · Ask about this lesson

This exercise opens soon

Finish the lesson before it and this one unlocks. The whole course is free, no account needed, and you can read this lesson right now.