Module 10: Convolutional Neural Networks
This module introduces convolutional neural networks (CNNs) for image data. You will learn how convolutions detect local patterns, why pooling provides invariance, and how to build and train CNNs for image classification using Keras.
Learning Objectives
- Explain why fully connected networks are inefficient for images.
- Describe how convolutional layers detect local features.
- Understand the role of filters, stride, and padding.
- Explain pooling layers and their purpose.
- Build and train CNNs using TensorFlow/Keras.
- Apply transfer learning with pre-trained models.
The module in two minutes
An animated overview of the module’s through-line. Watch it before the lecture — it is the map, not the territory.
Lecture shorts
Short lectures and code walkthroughs from the instructor that reinforce this module.
Visual shorts
Short silent animations, one idea each. Press play, or open one full screen. All visual shorts
Orientation audio
Convolutions, pooling, and the two tricks that make small-data vision work.
The through-line
Flatten a 200×200 image into a vector and a dense network needs forty thousand weights per neuron in the first layer — and it forgets that pixel neighbors are neighbors. Convolutions fix both at once, and they are the reason computer vision works.
A convolution slides a small filter — say 3×3 — across the image, computing a dot product at each position. The same nine weights scan every location, so a pattern learned once is found anywhere (translation invariance), and parameters drop from millions to dozens. You will implement the sliding window from scratch and watch handmade filters light up on edges before any learning happens.
Pooling downsamples the resulting feature maps — max pooling keeps the strongest response in each window — buying tolerance to small shifts and cutting computation. Stacking convolution, nonlinearity, and pooling gives the CNN: early layers detect edges, middle layers combine them into textures and parts, late layers into objects. The output-size arithmetic (filter size, stride, padding) is unglamorous and worth doing by hand once, because every shape bug in Keras traces back to it.
The two closing ideas are the ones practitioners lean on daily. Transfer learning: a network trained on millions of images has already learned edges and textures, so start from it and retrain the top for your task with a fraction of the data. Augmentation: flip, crop, and shift your training images so the model sees more variety than you collected. Between them, serious vision work gets done on small datasets.
An 8×8 image containing a vertical bar and a horizontal bar. Pick a 3×3 filter, then step the window across: at each stop, the output is one dot product — the same nine weights, every location.
The vertical-edge filter lights up only where columns change; the horizontal one only where rows change; blur smears everything — handmade filters detecting patterns before any learning happens. A CNN learns the nine numbers instead of taking them from you, but the sliding dot product is identical. Same weights everywhere is why a pattern learned once is found anywhere, with dozens of parameters instead of millions.
Key concepts
- Convolution: Slide filters to detect local patterns
- Filters/Kernels: Learnable feature detectors
- Pooling: Downsample for translation invariance
- Feature Maps: Outputs of convolutional layers
- Transfer Learning: Reuse pre-trained models
The lecture notebook
Six parts, from scratch before any framework. Run every cell; change things and rerun — the notebook is the lecture.
In Colab: File → Save a copy in Drive keeps your work.
Exercise
Attempt the exercise before opening the solution — the attempt is where the learning happens.
Knowledge check
The quiz is self-graded and open-book. If a question surprises you, the corresponding lecture part is the fastest fix.
Reference and discussion
Finish the module
Complete the stages above, then claim the finish here.