AI · 8.1
Convolutions: How Machines See Edges and Shapes
Name
Class
Date
Mark / 21
Section A
Circle the letter of the correct answer. One mark each.
- 1Why is a dense layer a poor first layer for photos?1
- AIt only works on black and white images, never colour
- BIt cannot take numbers between 0 and 255 as its inputs
- CIt can only have a single neuron in each of its layers
- DIt needs an enormous number of weights and ignores where pixels are
- 2What does weight sharing in a convolutional layer mean?1
- AEvery neuron has exactly the same bias
- BSeveral networks share the same training data
- CThe same kernel weights are used at every position in the image
- DWeights are copied from one layer to the next
- 3A 3 × 3 patch is all 4s and the kernel is all 1s. What is the output?1
- A4
- B9
- C12
- D36
- 4Which kernel detects vertical edges?1
- A−1 −2 −1 / 0 0 0 / 1 2 1
- B−1 0 1 / −2 0 2 / −1 0 1
- C0 −1 0 / −1 5 −1 / 0 −1 0
- D1/9 in every position
- 5What size is the output of a 3 × 3 kernel on a 6 × 6 image, with no padding and stride 1?1
- A4 × 4
- B6 × 6
- C3 × 3
- D2 × 2
- 6What does padding of 1 do for a 3 × 3 kernel with stride 1?1
- AKeeps the output the same size as the input
- BRemoves the edges of the image
- CHalves the output size
- DDoubles the number of filters
- 7How many weights does one 3 × 3 kernel have when it works on an RGB image?1
- A3
- B9
- C27
- D81
- 8A convolutional layer has 32 filters of size 3 × 3 over 3 input channels. How many parameters does it have?1
- A32
- B288
- C864
- D896
- 9What is a feature map?1
- AThe output grid showing where one kernel's pattern appears
- BThe kernel's own small grid of weights
- CA list of the features a dataset contains
- DA map of the computer's memory
- 10How does a CNN get the weights for its kernels?1
- AThey are chosen at random and never changed
- BIt learns them by backpropagation during training
- CThey are calculated from the image's colours
- DEngineers copy them from photo editing software
Section B
Answer in the space provided. The number of marks tells you how many separate points to make.
- 1ExplainExplain how a convolutional layer processes an image.4
- 2CalculateCalculate the output size of a convolution on a 32 × 32 input with a 5 × 5 kernel, padding 2 and stride 1, and the number of parameters if the input has 3 channels and the layer has 16 filters.4
- 3ExplainExplain why convolutional networks need far fewer parameters than dense networks for images.3
Mark scheme
Section A
Section B
1 Explain how a convolutional layer processes an image. 4
One mark for each of the following, to a maximum of 4.
- A small kernel / filter of weights
- Slides across the image, position by position
- At each position multiplies the patch by the weights and sums
- Producing a feature map showing where the pattern occurs
Model answer. A convolutional layer uses small kernels, grids of weights such as 3 × 3. Each kernel slides across the image, one position at a time according to the stride. At each position it multiplies every weight by the pixel beneath it and adds the products, plus a bias, giving one number. The numbers from all the positions form a feature map, showing how strongly the kernel's pattern, such as a vertical edge, appears at each place in the image. A layer with many kernels produces many feature maps.
2 Calculate the output size of a convolution on a 32 × 32 input with a 5 × 5 kernel, padding 2 and stride 1, and the number of parameters if the input has 3 channels and the layer has 16 filters. 4
One mark for each of the following, to a maximum of 4.
- (32 + 4 − 5) ÷ 1 + 1
- Output is 32 × 32
- (5 × 5 × 3 + 1) = 76 per filter
- × 16 = 1,216 parameters
Model answer. Output size = (n + 2p − k) ÷ s + 1 = (32 + 4 − 5) ÷ 1 + 1 = 32, so the output is 32 × 32. Each filter has 5 × 5 × 3 = 75 weights plus 1 bias, which is 76 parameters, so 16 filters have 76 × 16 = 1,216 parameters.
3 Explain why convolutional networks need far fewer parameters than dense networks for images. 3
One mark for each of the following, to a maximum of 3.
- Each output connects only to a small local patch
- The same kernel weights are shared across every position
- So the count depends on kernel size and filters, not image size
Model answer. In a convolutional layer each output depends only on a small local patch of the image, such as 3 × 3 pixels, rather than on every pixel. The same kernel weights are also shared across every position in the image. So the number of parameters depends only on the kernel size, the number of input channels and the number of filters, not on the size of the image, which keeps it to thousands instead of hundreds of millions.