Receptive field

The input region that can affect one unit. It grows by (k − 1) times the product of earlier strides at every layer, so strides, pooling and dilation grow it fast; but the effective field is a Gaussian-like blob much narrower than the theoretical one.

11 min read989 wordscore0 viewsupdated 2026-10-11

Definition

Receptive field of a unit in a CNN is the region of the input image whose pixels can change that unit's value. For a stack of convolutions and poolings it is a square of side rlr_l (the theoretical receptive field), and its centres on neighbouring units are jlj_l pixels apart (the jump, or cumulative stride).

The term comes from neuroscience. Hubel and Wiesel (1959, 1962) mapped the patch of the visual field that drives a single neuron in the cat's visual cortex, and found that cells further along the pathway have larger fields and respond to more complex patterns. Fukushima's neocognitron (1980) built that layout into a network, and every CNN since has inherited it. A unit in layer 1 sees a 3×33\times3 patch. A unit in the last stage of a ResNet sees, in principle, more than the whole image.

The receptive field decides what a unit can know. A detector whose field is smaller than the object cannot recognise the object as a whole. A segmentation network whose output units see only 100 pixels cannot use the context of a 500-pixel scene. Architecture choices such as strides, pooling, dilation and depth are, among other things, ways of growing rr.

The recursion

rl=rl−1+(k^l−1) jl−1=rl−1+(k^l−1)∏i=1l−1si,jl=jl−1 sl,k^l=dl(kl−1)+1r_l=r_{l-1}+(\hat k_l-1)\,j_{l-1}=r_{l-1}+(\hat k_l-1)\prod_{i=1}^{l-1}s_i,\qquad j_l=j_{l-1}\,s_l,\qquad \hat k_l=d_l(k_l-1)+1
rlr_l
receptive-field side of a unit in layer ll, in input pixels; r0=1r_0=1 (a pixel sees itself)
jlj_l
jump: input-pixel distance between neighbouring units of layer ll; j0=1j_0=1. Also called the output stride
kl, sl, dlk_l,\ s_l,\ d_l
kernel size, stride and dilation of layer l (pooling layers count, with their window and stride)
k^l\hat k_l
effective kernel size: a 3×33\times3 kernel with dilation 2 spans 5 positions

Why it works: a layer-ll unit reads k^l\hat k_l units of layer l−1l-1. Neighbouring units of layer l−1l-1 sit jl−1j_{l-1} input pixels apart, so the k^l\hat k_l of them span (k^l−1)jl−1(\hat k_l-1)j_{l-1} pixels between their centres. Each one also brings its own field of rl−1r_{l-1} pixels, which adds (rl−1−1)/2(r_{l-1}-1)/2 on either side. Summing gives the recursion. Unrolled, rL=1+∑l(k^l−1)∏i<lsir_L=1+\sum_l(\hat k_l-1)\prod_{i<l}s_i: every layer adds (k^−1)(\hat k-1) times the stride accumulated below it. A 3×33\times3 conv after four stride-2 layers adds 32 pixels; the same conv at the start adds 2.

Seen from the gradient, the field is the support of ∂y/∂x\partial y/\partial x. The value of a layer-LL unit yy depends on input pixel xpx_p only if some chain of kernel taps connects them, and ∂y/∂xp\partial y/\partial x_p is a sum over those chains. Pixels outside rLr_L have no chain and an exactly zero gradient.

How each ingredient grows r

Stride-1 conv, k×k
adds (k−1)j(k-1)j: linear growth with depth. Ten 3×33\times3 layers: r=21r=21
Stride or pooling
multiplies jj by ss, so every later layer adds ss times more. Exponential growth if repeated
Dilation d
k^=d(k−1)+1\hat k=d(k-1)+1 with no extra weights and no loss of resolution. Doubling dd each layer gives r=2L+1−1r=2^{L+1}-1
1×1 conv
adds nothing (k^−1=0\hat k-1=0), but a strided 1×11\times1 still multiplies jj
Global pooling / attention
the whole input in one step
Padding
does not change rr; it changes where the field sits and how much of it falls outside the image
one top unit and every unit that feeds itinL6effective RF: paths from each input pixel (∝ ∂y/∂x)−606━ theoretical RF 13 px ━ window with 95% of the ERF: 9 pxlayerrjconv 331conv 351conv 371conv 391conv 3111conv 3131depth 6 · r = 13 pxERF σ = 2.0 px95% in 9 px = 69% of r2-D: 9² is 48% of r²r = r′ + (k̂ − 1)·j′j = j′·s, k̂ = d(k − 1) + 1(′ = layer below)
kernel k
fig.Top: the units of every layer that feed one top unit, for a 1-D stack. Bottom: the effective receptive field, the number of paths from each input pixel to the top unit (with uniform weights this is proportional to ∂y/∂x). Six 3×3 layers give r = 13 but the ERF has σ = 2.0 px and 95% of it lies in the central 9 px (69%); at twelve layers r = 25 while the 95% window is 11 px (44%). Stride 2 on every second layer reaches r = 253 at depth 12 (jump 64), and doubling the dilation reaches r = 127 at depth 6 while the ERF still fills 86% of it. The ResNet-50 preset follows torchvision's main path: r = 427, jump 32, σ = 51 px, 95% within 199 px; in 2-D that window is 22% of the theoretical area.

Worked example

Layerksdk̂j beforer afterj after
input11
conv 3×3311311+2⋅1=31+2\cdot1=31
conv 3×3, stride 2321313+2⋅1=53+2\cdot1=52
max-pool 2×2, stride 2221225+1⋅2=75+1\cdot2=74
conv 3×3, dilation 2312547+4⋅4=237+4\cdot4=234
conv 3×33113423+2⋅4=3123+2\cdot4=314
A five-layer stack, computed with the recursion (and checked with the figure's lib)

The dilated layer contributes 16 of the 31 pixels: it has a large effective kernel and it comes after a jump of 4. The last ordinary 3×33\times3 conv adds 8, four times what the first one added. The same recursion gives the well-known VGG-16 values: r=196r=196 at conv5_3 and r=212r=212 after the last pooling layer, with jump 32.

Theoretical receptive field of ResNet-50 (torchvision)

  1. 1Stem: 7×77\times7 conv with stride 2 gives r=7r=7, j=2j=2. The 3×33\times3 max-pool with stride 2 adds 2⋅22\cdot2: r=11r=11, j=4j=4.
  2. 2Only the 3×33\times3 convs grow rr (the 1×11\times1 convs add nothing). Stage 1 has three of them at j=4j=4: r=11+3⋅8=35r=11+3\cdot8=35.
  3. 3torchvision puts each stage's stride on the first 3×33\times3 conv ("ResNet v1.5"). Stage 2: four 3×33\times3 at j=4,8,8,8j=4,8,8,8: r=35+8+3⋅16=91r=35+8+3\cdot16=91, j=8j=8.
  4. 4Stage 3: six 3×33\times3 at j=8,16,…j=8,16,\dots: r=91+16+5⋅32=267r=91+16+5\cdot32=267, j=16j=16. Stage 4: three at j=16,32,32j=16,32,32: r=267+32+2⋅64=427r=267+32+2\cdot64=427, j=32j=32.
  5. 5So a final 7×77\times7 unit has a theoretical field of 427 px on a 224 px image. The original placement (stride on the first 1×11\times1 conv, as in He et al. 2015) multiplies jj one layer earlier and gives 483 px. Either way, much of the field lies in the zero padding.

The effective receptive field is much smaller

Not all pixels in the field matter equally. A central pixel reaches the top unit through many chains of taps, a pixel near the border through only a few. With uniform weights and no nonlinearity, ∂y/∂xp\partial y/\partial x_p is proportional to the number of chains, and that count is the convolution of every layer's tap pattern. By the central limit theorem it approaches a Gaussian.

∂y∂xp  ∝  (u1∗u2∗⋯∗uL)[p]  ≈  N ⁣(0, ∑lσl2),r∝L,σERF∝L\frac{\partial y}{\partial x_p}\;\propto\;\big(u_1*u_2*\dots*u_L\big)[p]\;\approx\;\mathcal N\!\Big(0,\ \sum_{l}\sigma_l^2\Big),\qquad r\propto L,\quad \sigma_{\mathrm{ERF}}\propto\sqrt L
ulu_l
layer ll's taps on the input grid: klk_l equal weights spaced dljl−1d_lj_{l-1} pixels apart
σl2\sigma_l^2
variance of one layer's taps; 2/32/3 for a stride-1 3×33\times3, so six layers give σ=4=2\sigma=\sqrt{4}=2
L\sqrt L
the ERF widens like the square root of depth while rr grows linearly, so the ratio shrinks like 1/L1/\sqrt L

Luo, Li, Urtasun and Zemel (NeurIPS 2016, "Understanding the Effective Receptive Field in Deep Convolutional Neural Networks") made this precise. They showed that the ERF is approximately Gaussian, that it occupies only a fraction of the theoretical field, and that this fraction shrinks as O(1/n)O(1/\sqrt n) with depth nn. Subsampling and dilated convolutions enlarge it quickly, while dropout leaves its Gaussian shape unchanged. With ReLUs it becomes less smooth but stays concentrated near the centre, and training on real data makes it grow. The figure reproduces the uniform-weight case: in 2-D the 95% window of ResNet-50's path count covers only 22% of its theoretical area.

python
1import torch, torch.nn as nn
2
3def receptive_field(layers):
4 """layers: list of (k, s, d). Returns [(r, j)] after each layer."""
5 r, j, out = 1, 1, []
6 for k, s, d in layers:
7 r += d * (k - 1) * j
8 j *= s
9 out.append((r, j))
10 return out
11
12print(receptive_field([(3,1,1), (3,2,1), (2,2,1), (3,1,2), (3,1,1)]))
13# [(3, 1), (5, 2), (7, 4), (23, 4), (31, 4)]
14
15vgg16 = [(3,1,1)]*2 + [(2,2,1)] + [(3,1,1)]*2 + [(2,2,1)] + ([(3,1,1)]*3 + [(2,2,1)])*3
16print(receptive_field(vgg16)[-1]) # (212, 32)
17
18# Effective RF: gradient of one central output unit w.r.t. the input (Luo et al. 2016)
19from torchvision.models import resnet50
20body = nn.Sequential(*list(resnet50(weights=None).children())[:-2]).eval()
21x = torch.randn(1, 3, 448, 448, requires_grad=True) # not zeros: ReLU'(0) = 0
22y = body(x) # (1, 2048, 14, 14)
23y[0, :, 7, 7].sum().backward() # one central location, all channels
24erf = x.grad.abs().sum(1)[0] # (448, 448) map of |dy/dx|
25ys, xs = (erf > 0).nonzero(as_tuple=True)
26print(ys.min().item(), ys.max().item()) # nonzero support: at most 427 rows wide
27# The mass is concentrated near the centre: compare the 95%-energy box with 427.
Compute r and j for a model, and measure the effective receptive field by backprop

Use when

  • +One closed-form recursion gives the field of any conv/pool stack
  • +Tells you whether a unit can see a whole object or the needed context
  • +Explains design choices: strided stems, stacked 3×3 convs (VGG), dilated segmentation backbones
  • +The ERF view predicts that depth alone grows useful context only like √depth

Avoid when

  • −The theoretical field overstates what a unit uses: the effective field is Gaussian and much smaller
  • −Ignores padding: border units have part of their field outside the image
  • −Skip connections create paths of several lengths; the formula gives the longest path's field
  • −Says nothing about which pixels a trained unit actually relies on: measure gradients for that

Check yourself

A stack has a 7×7 conv with stride 2, a 3×3 max-pool with stride 2, then two 3×3 convs with stride 1. What is the receptive field of the last layer?

Check yourself

You stack more 3×3, stride-1 conv layers. How do the theoretical receptive field r and the width of the effective receptive field grow with depth L?

Remember

  • ✓rl=rl−1+(k^l−1) jl−1r_l=r_{l-1}+(\hat k_l-1)\,j_{l-1} and jl=jl−1slj_l=j_{l-1}s_l, with k^=d(k−1)+1\hat k=d(k-1)+1: every layer adds its kernel span times the stride accumulated below it.
  • ✓Stride-1 convs grow r linearly; strides, pooling and doubling dilations grow it exponentially.
  • ✓ResNet-50 (torchvision): r = 427 px with jump 32; VGG-16 pool5: r = 212.
  • ✓The effective receptive field is roughly Gaussian with width ∝depth\propto\sqrt{\text{depth}}, a shrinking fraction of the theoretical field (Luo et al. 2016).
  • ✓Large fields are bought with stride (losing resolution), dilation (risking gridding) or global operations (pooling, attention).
← back to Deep Learning roadmap