How does a CNN work?
A CNN works by applying learnable filters across an input, creating feature maps, and progressively combining simple local patterns into more useful representations.
For an image, the flow is typically:
Image
↓
Convolution
↓
Activation
↓
Optional pooling / downsampling
↓
More convolution layers
↓
Prediction layer1. Convolution detects local patterns
A small filter slides across the image and computes responses from nearby pixels.
Different filters can learn to respond to different patterns, such as edges, textures, or color transitions.
The output of a filter is called a feature map.
For the operation itself, see “What is convolution in deep learning?”.
2. Activations add nonlinearity
After convolution, an activation function such as ReLU is often applied so the network can learn more complex relationships.
See “What is ReLU and why is it widely used?” for that concept.
3. Deeper layers combine features
Early layers may detect simple patterns. Later layers combine those responses into increasingly task-relevant representations.
Edges → Textures → Shapes → Higher-level features4. Pooling may reduce spatial size
Some CNNs use pooling or other downsampling operations to reduce the height and width of feature maps.
This lowers computation and can help the network focus on stronger features.
See “What is pooling in a CNN?” for the dedicated explanation.
5. Final layers produce the output
After enough feature extraction, the network converts the learned representation into the required output, such as class scores for image classification.
In short, a CNN works by repeatedly detecting local patterns, transforming them into feature maps, combining them across deeper layers, and using the final representation to make a prediction.
Learning Sequence
Deep Learning Curriculum
Explore Related Questions
Deepen your understanding across related Deep Learning topics.