Interactive demo · Foundations of Deep Learning · Chapter 10

Convolution arithmetic: kernel, padding, stride and dilation

A convolutional layer slides one small filter over the image and records an inner product at each position (10.2). Choose an image, a filter, the zero padding P, the stride S and the dilation D, and click (or tap) any output cell to see which input pixels produced it. The feature map has floor((J + 2P − D(M − 1) − 1)/S) + 1 rows. Switch to transposed to run the operation backwards: each input pixel stamps a scaled copy of the filter into a larger output (Figure 10.30).

Operation

Image (12 × 12)

Filter

Padding P

Stride S

Dilation D

Step through

Try these

Numbers are pixel intensities in [0, 1] (input) and the filter responses (output, red positive, blue negative). Padding cells are drawn darker and hold 0. The book's “convolution” (10.2) is a cross-correlation; the mathematical convolution (10.19) flips the filter first, which here only matters for filters that are not symmetric.

In the lecture notes