Ch 6 ▸ Receptive fields ▸ Module 3/4
Stride and pooling.
🔒 This module is locked
It builds on Stacking layers. Pass that module’s knowledge check to unlock it, or skip ahead if you already know the material.
Stacking 3×3 convolutions grows the field by only 2 per layer. Real networks see much more of the image than that, because they also shrink their maps with pooling or stride, and a smaller map changes how much each later layer adds.
The jump
After 2×2 max pooling at stride 2, neighboring units of the pooled map summarize windows that start 2 pixels apart. Step one unit to the right in that map, and its field moves 2 pixels to the right in the image.
The jump of a map, written , is that distance: how many input pixels apart the fields of two neighboring units sit. The input has jump 1, since neighboring pixels are 1 pixel apart. Every layer multiplies the jump by its stride, so after two pools at stride 2 the jump is 4.
Now put a 3×3 convolution on the pooled map. Its three taps read neighboring units, and neighboring units now sit 2 input pixels apart. Its outer taps reach 2 pixels past the center on each side, not 1, so the layer adds to the field instead of 2.
The rule
For each layer with kernel size and stride , reading a map with field size and jump :
Start at the input with and , and apply the rule one layer at a time. With dilation, use the effective size in place of . For the stack in figure 6.3:
| Layer | r | j |
|---|---|---|
| input | 1 | 1 |
| 3×3 conv, stride 1 | 1 + (3 − 1) × 1 = 3 | 1 |
| 2×2 max pool, stride 2 | 3 + (2 − 1) × 1 = 4 | 2 |
| 3×3 conv, stride 1 | 4 + (3 − 1) × 2 = 8 | 2 |
Add another pool and another convolution, and the field reaches 18. The jump column in the listing tracks for every layer.
From aboveDrag to turn the stack. Click any square to trace it.
From the sideThe row inside the dashed sheet. Point at any unit.
▸ L3 UNIT (7, 7) · r = 8 · JUMP 2 · SEES 8×8 = 64 INPUT PIXELS
In the view from above, each pooled map has fewer, larger squares, and each square sits over the block of pixels its unit summarizes. The view from the side shows the same thing as spacing: after a pool, the units in a row sit further apart, and the lines from the next layer fan out wider.
A strided convolution works the same way as a pool. Set the middle layer of a three-convolution stack to stride 2: goes 3, then , then . The stride takes effect on the layer after it, through the jump.
If a layer’s stride is larger than the field below it, neighboring fields stop overlapping, and gaps open between them. A 1×1 convolution at stride 3 followed by a 3×3 convolution reads pixels 3 apart, with two unread pixels between each pair.
VGG-16
Load the VGG-16 stack. Its 13 convolutions are all 3×3 at stride 1, arranged in five blocks, and each block ends in 2×2 max pooling at stride 2. VGG-16 was built for 224×224 images, and on those the rule gives the last pooled map a field size of 212, with jump 32. Each unit of that 7×7 map has a field nearly as large as the whole image.
On the 32×32 duck, five pools shrink the map to 1×1, and the one unit at the top has the same . Its field covers the whole duck, and the dashed square reaches far into the padding on every side. The field size depends only on the layers, not on the size of the image.
Knowledge check ▸ 5 questions
Before you move on.
Answer every question correctly to unlock the next module. A wrong answer gets a hint, and you can try again as many times as you like.
1What is the jump of a map?
2A 3×3 convolution at stride 1, then 2×2 max pooling at stride 2, then another 2×2 max pooling at stride 2. What is the jump of the last map?
3A 3×3 convolution, then 2×2 max pooling at stride 2, then a 3×3 convolution, all convolutions at stride 1. What is r for the last layer?
4Three 3×3 convolutions, where only the middle one has stride 2. What is r for the last layer?
5A 3×3 convolution reads a map whose jump is 4. How much does it add to r?