What Is a Convolutional Neural Network? How CNNs Learn Visual Patterns
Learn what a convolutional neural network is, how CNNs use filters, feature maps, ReLU, pooling, and training to recognize patterns in images and other structured data.
A photograph looks obvious to us. We see a dog, a handwritten number, or a car approaching an intersection.
A computer begins with numbers.
A digital image is a grid of pixel values. A Convolutional Neural Network (CNN) learns useful patterns from that grid by applying small learned filters across local regions and combining the resulting features through multiple layers.
pixels → convolutions → feature maps → activations
→ spatial reduction → deeper features → output
The important idea is locality. Nearby pixels often form useful structures, and the same kind of structure can appear in many positions.
Images Give CNNs a Spatial Problem
A grayscale image can be represented as a two-dimensional grid:
12 15 18 20
11 16 40 80
10 18 90 180
12 20 110 220
An ordinary RGB image measuring 224 × 224 pixels can have a shape such as:
224 × 224 × 3
That is 150,528 channel values.
A fully connected network could flatten them into one vector, but doing so discards a useful assumption: location and neighbourhood matter. A dark-to-light transition can indicate an edge. Nearby edges can form corners or curves. Local textures can become evidence for larger structures.
CNNs build those spatial assumptions into the architecture.
A Convolution Reuses a Small Learned Filter
A convolutional layer contains learnable filters, also called kernels. A common spatial size is 3 × 3.
Suppose a filter examines:
20 20 20
20 20 180
20 20 180
The filter has its own learned weights. The layer combines those weights with the patch values to produce an activation, then applies the same filter at other positions.
The results form a feature map.
Reusing the same weights is called weight sharing. The network does not need a separate detector for every image position.
A layer normally learns many filters, producing many feature maps. This reduces parameters compared with connecting every pixel independently and gives the model a useful bias toward local patterns that can recur in different places.
Deeper Layers Combine Earlier Features
The first layers operate close to raw pixels and often respond to relatively simple structures such as edges, colour changes, or textures. Later layers receive those feature maps and combine them.
pixels
↓
edges / colour changes
↓
textures / curves
↓
larger structures
↓
features useful for the task
This hierarchy should not be read too literally. A trained CNN does not necessarily contain one clean “ear neuron” or “wheel filter.” Features can be distributed across many channels.
What also grows is the receptive field: the portion of the original input that can influence a later activation. An early feature may depend on a tiny patch; a deeper feature can combine information from a much larger region.
Activation Functions Make the Network Nonlinear
Convolution is linear. Stacking only linear transformations would still be equivalent to another linear transformation.
CNNs therefore use nonlinear activation functions. A common example is ReLU:
$$ \operatorname{ReLU}(x)=\max(0,x) $$
input: -4 -1 0 3 8
ReLU: 0 0 0 3 8
The operation is simple, but the nonlinearity lets deeper networks represent relationships that a purely linear model cannot. Other activations exist; ReLU is simply a clear example of the role activation plays.
Spatial Reduction Keeps Later Layers Manageable
Keeping full image resolution through every layer can be expensive.
Max pooling is one traditional reduction. Given:
2 7
4 3
a 2 × 2 max-pooling operation keeps 7.
Applied across a feature map, pooling reduces width and height. This lowers later computation and makes the representation somewhat less sensitive to small shifts within the pooled region.
Pooling is lossy. It discards spatial information and does not make a CNN independent of object position.
Modern CNNs may instead use strided convolutions. The broader pattern is the same: later stages often trade fine spatial detail for richer features and larger receptive fields.
Final Layers Turn Features Into a Prediction
Traditional CNNs often flatten the final feature maps. If a stage has shape:
7 × 7 × 512
flattening produces 25,088 values that can feed fully connected layers.
Many modern architectures instead use global average pooling, which summarizes each feature map and can avoid a large fully connected stage.
For classification, an output might look like:
cat 0.78
dog 0.17
rabbit 0.05
Softmax is often used when the model needs a probability distribution over mutually exclusive classes.
Other CNN heads can produce bounding boxes, segmentation masks, coordinates, embeddings, or numeric estimates. The convolutional backbone extracts spatial features; the task-specific head turns them into the required output.
Training Learns the Filters
Programmers usually do not type an edge filter or cat-ear filter into the network. The weights are learned from data.
image → network → prediction
↓
compare with label
↓
loss
↓
backpropagation
↓
weight update
A loss function measures error. Backpropagation calculates gradients showing how the parameters affected that loss. An optimizer updates the weights.
Across many examples, filters can become useful for reducing the training objective. This is what it means for a CNN to learn features.
Human choices still matter: data, labels, architecture, augmentation, loss functions, evaluation, and deployment can all determine whether the resulting model is useful.
Why CNNs Changed Computer Vision
Before deep learning became dominant in computer vision, many systems relied heavily on handcrafted features:
image → human-designed features → classifier
CNNs made it practical to learn feature extraction and prediction together:
image → learned convolutional features → task output
That proved useful for classification, object detection, segmentation, OCR, medical-image analysis, and many other visual tasks.
Convolution also extends beyond 2D images. One-dimensional convolutions can process local patterns in signals or time series, while three-dimensional convolutions can operate over volumetric data such as medical scans.
The common requirement is local structure.
CNNs Are Foundational, Not the Only Vision Architecture
Modern computer vision is not exclusively convolutional. Vision transformers, attention-based systems, and hybrid architectures are now common.
CNNs remain a clear example of how architecture can encode useful assumptions:
- nearby values are related;
- useful local patterns can recur in different positions;
- deeper features can be built by combining earlier local features.
A CNN begins with pixel values and learnable filters. Training adjusts those filters so repeated local operations produce representations useful for the task.
That is the central mechanism: learn local patterns, reuse them across space, and combine them into features useful for prediction.
More Articles Like This
What Is Artificial Intelligence? From Pattern Recognition to Systems That Generate, Decide, and Act
What Is ChatGPT? How a Prompt Becomes a Generated Answer
What Is Machine Learning? How Computers Learn Patterns From Data

What Is Natural Language Processing? How Computers Learn to Work With Human Language

Semantic Kernel vs Microsoft Agent Framework: Which Should You Actually Use?
