Intermediate level · Module 7: Feature Visualization · Lesson 1 of 3
Filters and Activation Maps
Learners plot first-layer filters and capture intermediate feature maps with forward hooks to see how representations change through the network.
In this lesson you will
- Visualise learned filters
- Capture and display activation maps
Key concepts
first-layer weightsregister_forward_hookactivation mapslow-level vs high-level featureschannel selection
The lesson
The first convolution layer's weights can be plotted as small images: they often look like edge and colour detectors, similar to the hand-made filters from the Beginner level.
A forward hook (layer.register_forward_hook(fn)) records a layer's output during a forward pass. Plotting a few channels of early and late layers shows the change from simple edges to more abstract patterns.
These views build intuition, but deep-layer activations are hard to interpret one by one. The next lesson focuses on explanations for specific predictions.
Step by step
- Plot the first-layer filters of the trained CNN and of a pretrained torchvision model.
- Register hooks on an early and a late layer.
- Display eight channels from each for one image.
- Describe the difference.
Practice activity
Produce a filter and activation gallery for two models.
Expected result: Clear visualisations with a short interpretation of early versus late layers.
Check your understanding
-
What do first-layer filters often look like?
Show answer
Edge and colour detectors.
-
What does a forward hook do?
Show answer
It records a layer's output during a forward pass.
Further learning
Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.