Dilated Convolutions

Spread the same nine weights further apart and the receptive field grows without any downsampling and without any extra parameters.

Overview

The problem it solves

A network has two ways to grow its receptive field: stack more layers. This Is slow because growth is linear, or downsample, which is fast but throws away detail.

For classification, throwing away detail is fine. The answer is one label. For segmentation it isn't. The output has to be the same size as the input, and detail destroyed by pooling has to be rebuilt by a thing.

Dilated convolution is the third way. It grows the receptive field geometrically, adds no params, and doesn't reduce detail at all.

Dilated Convolutions

This module needs JavaScript: the images are computed in the page rather than downloaded.

Worth knowing

Dilation inserts gaps between the kernel's taps. A 3×3 at dilation 2 spans 5×5 while still holding nine weights.
The parameter count does not change. The receptive field does.
It buys reach without pooling, so the output stays at full resolution — which is what segmentation needs.
Stacking the same rate repeatedly leaves gaps that nothing samples. Vary the rate instead.

Dilated Convolutions

How to see further without downsampling, and the gridding artefact that comes with it.

What dilation does

Take a 3×3 kernel. Instead of reading nine adjacent pixels, read nine pixels spaced d apart, leaving gaps between them. The weights are unchanged; only where they're sampled from moves.

The effective size of a k×k kernel at dilation d is:

effective = k + (k - 1) * (d - 1)

So a 3×3 at dilation 1 spans 3, at dilation 2 spans 5, at dilation 4 spans 9. Drag the dilation control and the readout confirms it: nine weights, spanning what you asked for.

That is the whole trick, and its appeal is that all about the layer's cost is unchanged. Same weights, same number of times, wider view.

Stacking

Drag the layers control up. Two dilated layers reach further than two plain ones, and the growth compounds, because each layer's reach is measured in the already-expanded units of the layer beneath it.

The standard setup uses a rising sequence. Dilation 1, then 2, then 4, then 8 — which gives exponential receptive-field growth at constant detail. A stack of four such layers sees a 33×33 region using 36 weights per channel pair and no pooling at all.

The gridding problem

There's a defect, and it follows right from the gaps.

Stack a few layers all at dilation 2, and some input spots are never sampled by any of them. The kernel taps land on even offsets at each level, so odd spots in between are simply not read. The output develops a checkerboard-like inconsistency, and the network is blind to fine detail that happens to fall in the gaps.

The fix is to vary the rate so that the gaps of one layer are covered by another. Rates like 1, 2, 5 or 1, 2, 3 are chosen so their sampling patterns interlock, and the *hybrid dilated convolution* literature is about picking such sequences. The simple version of the rule: don't repeat the same dilation rate a few times in a row.

Where it is used

DeepLab made dilated convolution central to semantic segmentation, and its ASPP module runs a few rates in parallel and concatenates them, giving the network a few scales at once from one feature map.

WaveNet used dilation in one dim over audio. Here The receptive field has to span thousands of samples and downsampling would destroy the waveform.

Dense guess often — depth estimation, optical flow, any of it whose output is an image. Uses it for the same reason segmentation does.

The reach a dilated stack buys

The whole point is receptive field without downsampling, and the math shows how fast it grows. A dilated k×k kernel spans k + (k-1)(d-1), and stacked layers build up (k-1)·d at each step. Take four 3×3 layers at the standard rising rates 1, 2, 4, 8.

layerdilationreach addedrunning receptive field
1123
2247
34815
481631

Four layers reach a 31-pixel window — in effect 33×33 counting the kernel — using 4 × 9 = 36 weights per channel pair and *no pooling at all*. A stride-1 stack of plain 3×3 layers would need fifteen layers to see as far, because its reach grows by 2 per layer instead of doubling. That exponential growth at constant detail is why DeepLab put dilation at the centre of segmentation. The catch is in those same gaps: repeat one rate and some input spots are never sampled by any layer, making the gridding artefact, which is why the rates are varied (1, 2, 5) so their sampling patterns interlock.

Where dilation earns its place is dense guess — segmentation, depth, optical flow — any of it whose output must be the same size as the input, so detail can't be thrown away by pooling. DeepLab's ASPP module runs a few rates in parallel and concatenates them, giving the network a few scales from one feature map, and WaveNet used the one-dimensional version over audio, where the receptive field has to span thousands of samples. The one cost that isn't free is memory: a network that never downsamples holds full-detail activations at each layer, which is often the binding constraint on a segmentation model, so the params are free but the memory isn't.

The gridding fix is worth stating as a rule of its own: never repeat the same dilation a few times in a row. Rates chosen so their sampling patterns interlock — 1, 2, 5, or 1, 2, 3. Cover the spots any single rate would skip, and the hybrid-dilated-convolution literature is largely about picking such sequences so that each input spot is read by some layer in the stack.

Where it goes wrong with Dilated Convolutions

Repeating one rate. Gridding artefacts, and detail that falls in the gaps is never seen.

Using it where pooling would do. For classification, downsampling is cheaper and reduces work. Dilation keeps the feature map large, and large feature maps cost memory at each layer.

given it's free. The params are free. The memory isn't. A network that never downsamples holds full-detail activations throughout, which is often the binding constraint on segmentation models.

Questions people ask about Dilated Convolutions

What is a dilated convolution? A convolution whose kernel taps are spaced apart by a dilation rate, with gaps in between. A 3x3 kernel at rate 2 covers a 5x5 area using still only nine weights.

Why use dilation instead of a bigger kernel? It enlarges the receptive field without adding parameters or cost. A bigger kernel grows quadratically in both.

What is the gridding problem? Stacking layers with the same dilation rate samples the input on a sparse checkerboard and misses pixels in between. Mixing rates, such as 1, 2 and 5, fills the gaps.

Where are dilated convolutions used? In semantic segmentation such as DeepLab, in WaveNet for audio and in other models that need wide context at full resolution.

How does dilation compare with pooling or striding? Pooling and striding shrink the feature map to reach further, losing resolution. Dilation keeps the resolution, which matters for per-pixel outputs.

What is the effective kernel size for a given dilation? It is k + (k - 1)(d - 1) for kernel size k and dilation d. A 3x3 kernel with d = 4 spans 9x9.

Skipping pixels to see further for the same price

A dilated convolution reads the same number of weights from a wider spread of spots. That one change buys receptive field growth that is exponential rather than linear -- and brings a gridding artefact that the fix for it's named after.

example_01.pyNumPy
Output

Applying a dilated convolution to a signal with one spike shows how the response spreads, and what happens when the same dilation is repeated.

example_02.pyNumPy
Output

Real architectures use dilation wherever downsampling is unacceptable, such as per-pixel labelling or audio waveform generation.

example_03.pyNumPy
Output

Check yourself

0 of 3

Answer without scrolling back up.

  1. How wide does a 3x3 kernel at dilation 3 reach?

  2. What causes gridding artefacts?

  3. Why is dilation preferred over pooling in segmentation?

Cheat sheet

Dilated Convolutions

Expand a kernel's field of view without adding parameters or pooling, and spot the gridding artefact that appears when rates are wrong.

COMPUTER VISION · vizlearn.in/computer_vision/dilated_convolutions.html

About the author

Ashish Jangra builds and maintains VizLearn. Every module here is written and the visualisation behind it hand-built, so the numbers in a readout come from the same code that draws the picture. Corrections are genuinely welcome and get priority over everything else — if a page states something wrong, or an animation misrepresents what the algorithm does, get in touch.