Foundations to Frontier
Tests
E. Deep Learning › E7 CNN Building Blocks

Receptive Field Calculation

The receptive field of a unit is the region of the input that can affect it. It grows with each convolution by (k − 1) times the product of earlier strides, times the dilation, so strides and dilations make it grow fast. But not all of it matters equally: the effective receptive field, where gradients actually concentrate, is roughly Gaussian and much smaller. This page covers the recursive formula, how stride and dilation change it, how to design networks to see enough context, and the effective receptive field. In the exercises you check the formula against the set of input positions that can reach one output, then show in deep random networks that the region holding 95% of the gradient grows roughly like √L rather than linearly: a third of the theoretical field at 32 layers.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

How much of the image can one neuron see?

A neuron in the first convolutional layer sees only a 3 × 3 patch. A neuron in the second layer sees 3 × 3 first-layer neurons, which together cover 5 × 5 pixels. Each layer widens the view; strides and dilations widen it faster. To recognise a large object, the neurons that decide must see all of it. But the pixels near the middle of that view influence the neuron far more than those at the edges.

CNN building blocks
input pixels that affect the centre output (25 × 25 window shown)
receptive field of one output: 7 × 7 input pixels · total stride 1
Deep-learning "convolution" slides a small learned kernel over the input (no flip). Stride shrinks the output, padding preserves borders, dilation spreads the kernel to see further without more weights. Pooling summarises windows. Stacking layers grows the receptive field. Depthwise-separable and grouped convolutions cut cost by not connecting every input channel to every output channel. Transposed convolution upsamples, but uneven kernel overlap leaves checkerboard patterns. Squeeze-and-excitation rescales whole channels by gates computed from their global averages; CBAM adds a per-pixel spatial gate. (Here the gates are fixed functions of the averages so you can see their effect; in a network the excitation is learned.)
Why engineers care

If the receptive field is too small, a detector cannot see whole objects or enough context (a runway needs its surroundings); if strides are used carelessly, fine detail is lost. Computing receptive fields is a routine design check for detection, segmentation and audio networks.

📝 Quick check (Level 0)
0/3 answered
  1. 1. The receptive field is…
  2. 2. Each stacked convolution…
  3. 3. Within the receptive field, influence is…

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

By hand

  • Recursion: r₀ = 1, j₀ = 1; for each layer, r ← r + (k − 1)·d·j, then j ← j·s, where j is the total stride so far.
  • Examples:
    • three 3 × 3 convolutions, stride 1: r = 7;
    • three 3 × 3, stride 2 each: r = 1 + 2 + 4 + 8 = 15, total stride 8;
    • 3 × 3 with dilations 1, 2, 4: r = 1 + 2 + 4 + 8 = 15;
    • 7 × 7 stride 2, then 3 × 3 stride 2, then 3 × 3 stride 1: r = 1 + 6 + 4 + 8 = 19.
  • Layers needed at stride 1 with k = 3 to reach r: ⌈(r − 1)/2⌉, so 112 layers for 224 pixels; striding cuts this drastically.
  • Total stride: five stride-2 stages give 32 (a typical backbone’s output stride).
📝 Quick check (Level 1)
0/3 answered
  1. 1. Receptive field of five stride-1 3 × 3 convolutions:
  2. 2. Receptive field of 3 × 3 convolutions with dilations 1, 2, 4, 8:
  3. 3. Total stride of five stride-2 stages:

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 20 minUndergraduate students and practising engineers.

Receptive fields in code

Exercise 1. For four layer configurations, the recursion’s receptive field (7, 15, 15 and 19) matched the span of input positions found by walking back from one output through the layers.

Practice.

  • Check that the final features’ receptive field covers the largest objects you need to recognise, with margin for context.
  • Use striding and pooling early to grow the field cheaply; use dilation or attention when resolution must be kept.
  • Remember that the effective field is smaller (exercise 2): global pooling, attention or very deep stacks are needed for truly global context.
  • Tools such as torchscan or a short script applying the recursion compute fields for real architectures.
r, j = 1, 1
for k, s, d in layers: r += (k - 1) * d * j; j *= s
🐍 Exercise 1: computing receptive fields
Implement the receptive-field recursion and check it against the set of input positions that can reach one output.
📝 Quick check (Level 2)
0/3 answered
  1. 1. To keep resolution while widening the field, use…
  2. 2. The effective receptive field is…
  3. 3. Truly global context needs…

Level 3: Advanced

★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.

Theory

Effective receptive field. Luo et al. (2016) measured how much each input pixel affects a unit, via the gradient. For linear stacks of uniform kernels, the impulse response after L layers is the L-fold convolution of the kernel, which by the central limit theorem is approximately Gaussian with standard deviation proportional to √L. So the effective field grows like √L while the theoretical one grows like L; the ratio shrinks like 1/√L.

Nonlinearities and training. ReLUs gate the gradient paths but do not change this picture qualitatively; Luo et al. found training enlarges the effective field somewhat, and that skip connections and dilations can enlarge it.

Design implications. Deep networks with small kernels therefore see much less context in practice than their nominal field suggests. Large kernels (ConvNeXt, RepLKNet), dilations and attention all address this.

📝 Quick check (Level 3)
0/3 answered
  1. 1. The effective field grows like…
  2. 2. The ratio effective/theoretical shrinks like…
  3. 3. Approaches to larger effective fields include…

Level 4: Expert

★★★★★ Expert⏱ 25 minResearchers: original papers and open problems.

Theoretical versus effective receptive field

History.

  • D. Hubel and T. Wiesel (1959–1962) described receptive fields of visual neurons.
  • W. Luo, Y. Li, R. Urtasun and R. Zemel (2016) introduced the effective receptive field.
  • A. Araujo, W. Norris and J. Sim (2019) gave practical receptive-field computations for CNNs.
  • X. Ding et al. (2022, RepLKNet) revisited very large kernels to enlarge effective fields.

Exercise 2. 1-D stacks of L random 3-tap convolutions (8 channels, ReLU). The gradient of the centre output with respect to the input is averaged over 20 random networks and inputs; the table gives the width of the smallest central window holding 95% of it.

layers theoretical field width holding 95% ratio width/√L
2 5 5 1.00 3.5
4 9 9 1.00 4.5
8 17 13 0.76 4.6
16 33 19 0.58 4.8
32 65 21 0.32 3.7
  • For shallow stacks the whole field matters; for deep ones most of it does not: at 32 layers 95% of the influence lay within a third of the theoretical field.
  • The effective width grew roughly like √L (width/√L stayed between about 3.5 and 4.8).
🐍 Exercise 2 (research): theoretical versus effective receptive field
Backpropagate from one output through deep random convolution stacks and measure the width that holds 95% of the gradient.

Receptive fields in AI, robotics and aerospace

  • Object detection at long range: small distant objects need high resolution, large nearby ones need large fields; feature pyramids (E9-5) serve both.
  • Semantic segmentation of terrain needs context (is this patch road or rooftop?), hence dilated or attention-based backbones.
  • Audio and vibration: receptive fields in time set how far back a model can look, as in WaveNet’s dilated convolutions (E11-13).

References

  1. W. Luo, Y. Li, R. Urtasun, R. Zemel (2016). “Understanding the effective receptive field in deep convolutional neural networks.” Advances in NeurIPS.
  2. A. Araujo, W. Norris, J. Sim (2019). “Computing receptive fields of convolutional neural networks.” Distill.
  3. X. Ding, X. Zhang, J. Han, G. Ding (2022). “Scaling up your kernels to 31 × 31: revisiting large kernel design in CNNs.” Proc. CVPR.