Convolutional filters: receptive fields, kernels and feature maps
10 questions on receptive fields, kernels, feature maps, shared weights, edge detection, cross-correlation and the benefits of convolution.
- 10 questions
- Stopwatch
- Instant feedback
Sample questions
Play now ↑Answers stay hidden. Start the quiz to play them.
Sample 1
A one-dimensional input has 8 values, and a kernel of width 3 is applied at every possible position. How many independent weights does the layer have, ignoring the bias?
- 3
- 18
- 24
How it works
- One question per screen. An answer is final once sent.
- You see right away whether you were right, with a short explanation.
- The stopwatch runs: on equal scores, the faster player ranks first.
- Only your best attempt counts, so replaying is never risky.
About this quiz
Picture a small rubber stamp that, when pressed against a patch of a photograph, lights up if the patch looks like a short vertical edge. Now picture sliding that same stamp across the whole picture, pressing at every position and recording how strongly it lights up. The recorded values form a new image, a map of where vertical edges occur. That is what a convolutional filter does, and the stamp is the heart of every convolutional network. The idea is simple, but it solves several problems of image modelling at once.
This quiz takes the filter apart. You will see what a single unit sees, the patch of pixels that is its receptive field, and what its weights look like when drawn as a tiny picture, a kernel. You will see which patch makes the unit respond most strongly, and what the activation function turns that response into. Then comes the crucial step: copying the same weights to every position, which produces a feature map whose entries all share one set of parameters. The consequences, translation equivariance, sparse connections and a tiny number of independent parameters, are the subject of several questions.
The quiz also uses hand-made edge detectors to make the idea concrete: how a filter responds on one side of an edge and on the other, and how horizontal and vertical versions relate. And it asks about a few conventions and details that often puzzle newcomers, such as why the operation is called convolution though a purist would call it something else, and how normalisation inside a convolutional network treats the positions of a feature map.
Typical misunderstandings are worth knowing. People think each position in a feature map has its own weights, when the whole point is that it does not. They imagine that a larger image requires a larger set of weights, whereas only the size of the feature map changes. And they assume that the stamp must be designed by hand, when in a trained network the kernel is learned. It is worth pausing on how much work this one operation does. A stack of such filters turns raw pixels into maps of edges, then of textures and shapes, then of parts and whole objects, which is why the filter is the unit from which so much of modern computer vision is assembled. The same operation, with a different number of dimensions, also appears in networks for audio, text and time series, so the intuition built here carries over well beyond pictures. Practising it on tiny examples is the quickest way to make the idea automatic.
The quiz suits learners who are meeting convolutional networks for the first time, and practitioners who want a firm grasp of the basic operation. It needs only counting and simple pictures. There are 10 questions, each with an explanation, and it takes about four minutes.
Questions and answers
›How long does the quiz take?
About 3 to 4 minutes for 10 questions, at roughly 20 seconds each. An explanation follows every answer, including a short worked count where a question uses numbers.
›Do I need any maths?
No. You will count weights and think about patches, and the questions give you every rule you need. Knowing that a unit adds up weighted inputs and passes the sum through an activation function is enough background. If you have taken the quiz on image data and the case for convolution, you already have the motivation, and this quiz supplies the mechanism that answers it.
›What is a receptive field?
It is the small region of the input that a particular unit looks at. A unit in the first layer of a convolutional network might receive only the pixel values in a three-by-three patch of the image. The idea captures locality: most useful low-level features, such as an edge, can be detected from a small neighbourhood.
›What are a filter and a kernel?
The two words mean the same thing here. Each unit has one weight per input pixel, so the weights of a unit with a small square receptive field form a small grid of numbers. That grid can be displayed as an image, and it is called a filter or kernel. The unit responds most strongly when the patch it sees resembles this image.
›What is a feature map?
It is the output you get when the same filter is applied at every position of the input. Every unit in the map shares the same weights, so if a pattern produces a response at one place, the same pattern at another place produces the same response at the corresponding place in the map. The map shows where the feature was detected and how strongly.
›What does it mean that the connections are sparse and shared?
Sparse means that each unit is connected to only a small part of the input, so most possible connections are absent. Shared means that the connections of different units use the same weight values. Together they make the number of independent parameters tiny compared with a fully connected layer, whatever the size of the image. A further advantage is that convolutions map well onto the parallel hardware of graphics processors, so they run very efficiently.
›How are edges detected with a convolution?
A vertical edge is a place where intensity changes as you move across the image horizontally. A filter whose columns are negative on one side and positive on the other measures exactly that change. Its response is positive for one direction of change and negative for the other, and the transposed filter detects horizontal edges in the same way.
›Is it really a convolution?
Strictly speaking the operation is a cross-correlation, which differs slightly from the mathematical definition of convolution. Machine learning literature follows common practice and uses the word convolution for it anyway. Since the kernel is learned, the difference has no practical consequence.