A convolutional neural network (CNN) processes an image by extracting increasingly complex spatial features, reducing their dimensions, and using the resulting features to make a prediction. During training, it learns which visual patterns are useful rather than relying on manually programmed rules.
The Processing Stages
An image is represented as a tensor of numerical pixel values. For example, an RGB image with height and width has dimensions , where the three channels represent red, green, and blue.
| Stage | What happens |
|---|---|
| Input | Pixel values are usually normalized to a consistent range. |
| Convolution | A convolutional layer slides a small filter, or kernel, across the input. At each position, it calculates a weighted sum to produce a feature map. |
| Activation | A non-linear activation function such as ReLU applies , allowing the network to learn complex patterns. |
| Pooling | Pooling summarizes local regions, reducing the feature map's spatial dimensions and computational cost. |
| Classification | The extracted features pass to a fully connected layer or similar output layer, which produces scores or probabilities for each class. |
Early convolutional layers commonly detect simple features such as edges and corners. Deeper layers combine these into textures, shapes, and eventually higher-level features associated with particular objects.
For example, applying a filter to a single-channel image with stride and no padding produces a feature map:
During training, backpropagation calculates how much each weight contributed to the prediction error. An optimization method such as gradient descent then adjusts filter weights to reduce the loss. During inference, the trained weights are fixed and used to classify new images.
A common misconception is that filters are manually designed. In most CNNs, the useful filter values are learned automatically from training data.
Exam Technique
For A4.3 Machine learning approaches, explain the sequence from pixels to feature maps to output. Distinguish training, when weights are updated, from inference, when the trained model makes predictions.