Computer Science
Grade 11
20 min
Convolutional Networks
Convolutional Networks
Tutorial Preview
1
Introduction & Learning Objectives
Learning Objectives
Explain the role of a kernel (filter) in feature detection.
Manually perform a convolution operation on a 2D matrix.
Calculate the output dimensions of a convolutional layer using a given formula.
Describe the purpose and function of padding and stride.
Apply a max pooling operation to a feature map.
Differentiate between a convolutional layer and a fully connected layer in a neural network.
How does your phone's camera app instantly recognize faces or your social media feed tag friends in photos? 📸 The answer lies in a special type of neural network inspired by the human visual cortex.
This tutorial introduces Convolutional Networks (CNNs), the powerhouse behind modern computer vision. You will learn the core operations that allow computers to �...
2
Key Concepts & Vocabulary
TermDefinitionExample
ConvolutionThe core mathematical operation of a CNN. It involves sliding a small matrix, called a kernel, over an input matrix (like an image) to produce a feature map.Imagine a 3x3 'edge detector' kernel sliding over a 10x10 image matrix. At each position, the kernel's values are multiplied with the corresponding image pixel values, and the results are summed up to create a single pixel in the output feature map.
Kernel (or Filter)A small matrix of weights that is used to detect specific features like edges, corners, or textures in an input image.A simple kernel like [[-1, -1, -1], [0, 0, 0], [1, 1, 1]] is designed to detect horizontal edges in an image.
Feature MapThe output of a convolution operation. It represents the presence of the specific featu...
3
Core Syntax & Patterns
Convolution Operation
Output Pixel = Sum of (Input Pixel * Kernel Weight) for all overlapping cells.
This is the fundamental calculation performed at each position as the kernel slides over the input. It's an element-wise multiplication followed by a summation.
Output Dimension Formula
Output_Size = ( (Input_Size - Kernel_Size + 2 * Padding) / Stride ) + 1
Use this formula to calculate the width or height of the output feature map. 'Input_Size' is the height/width of the input, 'Kernel_Size' is the height/width of the kernel, 'Padding' is the number of pixels added to one side, and 'Stride' is the step size.
Max Pooling Operation
Output_Pixel = max(values in the pooling window)
For a given pooling window (e.g., 2x2), find...
4 more steps in this tutorial
Sign up free to access the complete tutorial with worked examples and practice.
Sign Up Free to ContinueSample Practice Questions
Challenging
Based on the tutorial's worked example, a 3x3 input is processed with a 3x3 kernel (S=1, P=1), and the result is down-sampled with 2x2 max pooling (S=2). The tutorial claims the final output is 2x2. What is the critical flaw in this example's parameters?
A.3x3 kernel cannot be used on a 3x3 input.
B.Padding cannot be equal to the stride.
C.The output of the convolution is a 3x3 feature map, which cannot be perfectly tiled by a 2x2 pooling window with a stride of 2.
D.Max pooling cannot have a stride greater than 1.
Challenging
An input matrix [[6, 2], [10, 2]] is convolved (S=1, P=0) to produce the feature map [[4, 0], [8, 0]]. Which of the following 2x2 kernels was used?
A.[[1, -1], [1, -1]]
B.[[1, 1], [0, 0]]
C.[[0, 1], [0, 1]]
D.[[1, 0], [1, 0]]
Challenging
A student designing a CNN for 28x28 images uses a 3x3 kernel with a stride of 5 in the first layer. Why is this a potentially poor design choice for initial feature detection?
A.The stride is larger than the kernel size, which is not allowed.
B.stride of 5 will cause the output dimensions to be larger than the input.
C.This configuration will result in an error because the dimensions are incompatible.
D.Such a large stride will skip over large portions of the image, potentially missing important small-scale features entirely.
Want to practice and check your answers?
Sign up to access all questions with instant feedback, explanations, and progress tracking.
Start Practicing Free