Essay · Visual studies

A convolutional network has a spatial budget

Connect local image features to receptive fields, sampling, aliasing, and per-layer compute costs.

The first convolution is easy to explain as a small filter sliding over an image. The engineering questions appear when those filters become a network: how much of the input can an output see, what resolution survives, and which layer consumes the compute budget?

The main visualization follows a trained image classifier through convolution, activation, pooling and prediction. Receptive field & cost opens a separate three-layer experiment where those architectural tradeoffs are explicit. Its calculations describe the small analytical network, not the classifier’s learned weights.

A feature is a local calculation across channels #

A convolutional layer applies a bank of kernels. Each output channel sums contributions from all relevant input channels, then typically adds a bias and applies a nonlinearity. Weight sharing means the same filter is reused across spatial positions. It does not mean every position sees the same input or receives the same response.

Inspect a feature in the classifier and trace its local inputs. The usual library operation is cross-correlation—the kernel is not flipped—even though the layer is named convolution. ReLU clips negative preactivations, while pooling or strided convolution changes spatial sampling. None of those operations should be treated as interchangeable boxes labeled “feature extraction.”

Track receptive field and jump together #

For a sequence of layers, initialize receptive-field width r0=1r_0=1 and input-coordinate jump j0=1j_0=1. With kernel width klk_l, dilation dld_l and stride sls_l,

rl=rl−1+(kl−1)dljl−1,jl=sljl−1.r_l=r_{l-1}+(k_l-1)d_lj_{l-1},\qquad j_l=s_lj_{l-1}.

The jump says how far neighboring output positions are apart in the original image. Increasing an early stride magnifies the input reach of every later kernel. Three 3×3 stride-one convolutions have a 7×7 theoretical receptive field. Change the middle stride to two and the final field becomes 9×9, but the output grid is now coarser.

The support plot shows which input coordinates can affect one interior output. Dilation spreads kernel taps without adding weights. Large dilation can leave gaps; a large bounding box is not evidence that every location within it was sampled. Padding changes support near boundaries, and skip paths require checking alignment as well as width.

Reach has a compute price #

For output size Ho×WoH_o\times W_o, kernel width kk, input channels CiC_i and output channels CoC_o, a dense convolution uses approximately

MACs=HoWok2CiCo.\text{MACs}=H_oW_ok^2C_iC_o.

The experiment lists this cost and parameter count for every layer. A 1×1 convolution can mix channels cheaply but does not enlarge spatial support by itself. A stride reduction decreases work in subsequent layers by reducing their spatial dimensions. Dilation changes the receptive field without changing the number of kernel coefficients or MACs at fixed output size.

MAC count is not latency. Memory layout, arithmetic precision, batch size, operator fusion and hardware kernels matter. Depthwise convolution changes the channel connectivity and the cost formula; a low-MAC architecture may still run inefficiently if its operators have poor utilization.

Sampling can erase the feature you needed #

Stride is subsampling. If the feature map contains energy above the new Nyquist limit, downsampling can alias it into lower frequencies. Pooling alone does not guarantee a clean low-pass filter. This is one reason tiny input translations can change a classifier’s result despite convolution’s shared weights.

Compare a wider receptive field obtained through dilation with one obtained through stride. Both increase reach, but only one reduces the spatial grid immediately. Dense prediction tasks need to recover boundaries and small objects, so the difference affects the architecture long before the final classifier is attached.

A theoretical field is not an effective explanation #

The receptive field marks possible dependencies. The learned influence can be concentrated in a much smaller region; gradients, nonlinearities and actual weights determine the effective receptive field for a given input. Likewise, a high softmax class probability does not establish that a network is calibrated or robust to a changed input distribution.

Use the visualizer to find a concrete hypothesis—an edge response, a pooling transition, an unexpectedly dominant feature—and test it with controlled input changes. For a production classifier, evaluate translations, scale changes and relevant corruptions alongside accuracy on the nominal dataset. A layer diagram can make the architecture legible; it cannot supply those missing measurements.

Further reading #

CNN Explainer supplies the trained-network visualization. Distill’s Computing Receptive Fields of Convolutional Neural Networks develops the recurrences and alignment conditions used here. Making Convolutional Networks Shift-Invariant Again connects downsampling to aliasing and shift sensitivity.

Related articles