Sub topic 7
Backbone, Neck and Head: Where the Work Happens
Assume you know basic convolutional neural networks, feature maps, and the idea of training with a loss function. In YOLO, object detection is divided into three connected parts: the backbone, neck, and head. Together, they turn pixels into class labels, confidence scores, and bounding boxes.
The backbone extracts visual features
The backbone is the first major network section. It receives the image and applies convolutional layers that transform pixels into feature maps.
Early layers usually detect simple patterns such as:
- Edges and corners
- Color changes
- Small textures
Deeper layers combine these patterns into larger structures, such as wheels, faces, or animal shapes. As the network goes deeper, feature maps often become smaller in width and height but richer in channels. This process is called downsampling.
A small feature map can represent broad context efficiently, but it may lose fine details. This creates a problem for small objects. A distant bicycle, for example, may occupy only a few pixels after several downsampling steps.
The neck combines different scales
The neck receives feature maps from several backbone depths and combines them. This is important because detection needs both:
- Fine detail for small objects
- Broad context for large objects
A common neck uses a feature pyramid. It passes information between high-resolution and low-resolution feature maps. One path may move detailed information upward, while another combines deep semantic information downward.
The exact modules differ between YOLO versions. Some use feature pyramid networks, path aggregation, or specialized convolution blocks. Their shared purpose is to create multi-scale features for the detection head.
The head predicts detections
The head converts each feature map into predictions. A prediction typically contains:
- Box coordinates
- An objectness or confidence score
- Class scores
Many YOLO models use separate prediction scales. The high-resolution scale helps find small objects. The low-resolution scale covers large objects. Later processing decodes the predictions into pixel-coordinate boxes and applies non-maximum suppression.
The head does not directly “recognize” an object in the same way a person does. It learns numerical patterns that make the correct box and class scores likely.
Common errors and trade-offs
A frequent mistake is to assume that a deeper backbone always gives better detection. A deeper network can learn richer features, but it also requires more memory and computation. It may be too slow for a camera or edge device.
Another mistake is to ignore object size. A model may detect large objects well but miss small ones if its feature maps lose too much spatial detail. Increasing input resolution or choosing a model with stronger multi-scale features can help, but both increase cost.
When diagnosing poor results, inspect whether errors occur mainly with small objects, crowded scenes, or unusual visual patterns. The pattern can indicate whether the problem is feature resolution, insufficient training data, or a mismatch between the deployment images and the training images.
Exercise
Why does a YOLO detector use feature maps at multiple scales?
Show answer
Different scales preserve different information. Higher-resolution maps retain detail for small objects, while lower-resolution maps provide context and cover large objects efficiently.