Feature Maps and Filters
In the previous lesson, we learned how padding and stride control the size and movement of convolution operations.
Now we focus on the true learning components inside a Convolutional Neural Network — filters and feature maps.
This lesson explains what CNNs actually learn and how raw pixels slowly turn into meaningful patterns.
What Is a Filter?
A filter (also called a kernel) is a small matrix of numbers that slides across the input image.
Each filter is responsible for detecting a specific pattern.
These patterns are not hand-written. They are learned automatically during training.
How Filters Learn
At the beginning of training, filters contain random values.
As training progresses, backpropagation adjusts filter values to reduce prediction error.
Over time, filters specialize in detecting:
• Edges • Corners • Textures • Shapes
What Is a Feature Map?
A feature map is the output produced when a filter is applied to the input.
Each filter produces one feature map.
If a convolution layer has 32 filters, it produces 32 feature maps.
Why Feature Maps Matter
Feature maps show where a specific pattern exists in the image.
High values mean the pattern strongly appears at that location.
Low values mean the pattern is absent.
Hierarchical Learning
CNNs learn in layers.
Early layers detect simple features:
• Horizontal edges • Vertical edges • Color contrasts
Middle layers detect combinations:
• Corners • Curves • Object parts
Deep layers detect:
• Faces • Wheels • Text • Complex objects
Filters in Code
Let us define a convolution layer with multiple filters.
from tensorflow.keras.layers import Conv2D
conv_layer = Conv2D(
filters=64,
kernel_size=(3,3),
padding="same",
activation="relu"
)
This layer creates:
• 64 learnable filters • 64 feature maps
Why Small Filters Are Preferred
Modern CNNs mostly use 3 × 3 filters.
Smaller filters:
• Capture fine details • Reduce parameters • Allow deeper networks
Stacking small filters creates a larger receptive field without heavy computation.
Receptive Field Intuition
The receptive field is the portion of the input image that affects a neuron.
As layers go deeper, the receptive field increases.
This allows neurons to understand larger context.
Real-World Example
In face recognition:
Early filters detect edges of eyes.
Mid-level filters detect eyes and nose.
Deep filters detect entire faces.
This hierarchy makes CNNs powerful.
Mini Practice
Think about this:
Why would using many filters in early layers increase learning capacity?
Exercises
Exercise 1:
Does each filter learn the same pattern?
Exercise 2:
What happens if we increase the number of filters?
Quick Quiz
Q1. How many feature maps does one filter produce?
Q2. Why are feature maps important?
In the next lesson, we will study classic CNN architectures and see how feature maps are stacked to build deep models.