Sub topic 16
The YOLO family: how versions differ
This chapter assumes you have read the earlier chapters. You should know how boxes, IoU, non-maximum suppression (NMS) and the backbone, neck and head split work. You should also have run a pretrained model with the ultralytics package. The goal is to help you choose between YOLO versions and read release notes without being misled by version numbers.
Version numbers are not one lineage
"YOLO" names an approach: detect objects in one forward pass. It is not a single codebase with a single owner. Different groups have released models under the YOLO name, and the numbers were not assigned by a central authority.
- Joseph Redmon wrote YOLOv1 to YOLOv3 in the original Darknet framework.
- Alexey Bochkovskiy and colleagues continued Darknet with YOLOv4. The authors of YOLOv7 and YOLOv9 published related work, and Meituan released YOLOv6.
- Ultralytics released YOLOv5, YOLOv8 and YOLO11 as a PyTorch package.
- A Tsinghua University group released YOLOv10.
A higher number therefore does not guarantee a better model for your data. Check what changed, how the authors measured it, and under what license the code is distributed.
What changed, release by release
YOLOv1 to YOLOv3: establishing the design
YOLOv1 divided the image into an S×S grid. Each cell predicted a few boxes with confidences, plus one set of class probabilities. It was fast but struggled with small objects and with several objects in one cell.
YOLOv2 added anchor boxes, which are preset box shapes that the network adjusts. It chose the shapes by running k-means on the training labels. It also added batch normalization and a higher-resolution classifier pretraining step.
YOLOv3 used a deeper backbone (Darknet-53) and predicted at three scales. Each scale handles a different object size range, which helped with small objects. It replaced softmax over classes with independent logistic outputs, so one box can carry more than one label.
YOLOv4 and YOLOv5: training recipes
These releases made modest changes to the architecture. Their main contribution was a packaged set of training techniques.
- Mosaic augmentation combines four training images into one.
- Better loss functions use IoU-based box terms instead of plain coordinate error.
- Improved backbones use cross-stage partial (CSP) connections.
YOLOv5 mattered mostly for usability. It was a PyTorch implementation with simple training, export and model-size options. This is why the n, s, m, l, x size suffixes (nano to extra large) are familiar today.
YOLOv6 and YOLOv7: efficiency tricks
Both focus on speed and accuracy at deployment. A common technique is structural reparameterization. The model trains with extra parallel branches, which are merged into a single plain convolution for inference. Training capacity goes up, and inference cost does not.
YOLOv8 and YOLO11: anchor-free and decoupled
YOLOv8 changed how the head works, and this affects how you read raw output.
- Anchor-free. The head predicts box distances from a location directly. No preset anchor shapes are needed, so there are no anchor hyperparameters to tune for your dataset.
- Decoupled head. Box regression and classification use separate branches instead of one shared output.
- No objectness score. Earlier versions predicted a box confidence and multiplied it by class scores. YOLOv8 predicts only class scores per candidate box. The class score also serves as the confidence.
- Task-aligned assignment. During training, a candidate is matched to a ground-truth box using a score that combines classification quality and localization quality.
YOLO11 keeps this layout and refines the building blocks for a better accuracy-to-compute trade-off. Its API is the same as YOLOv8's.
YOLOv9, YOLOv10 and later
YOLOv9 addresses information loss in deep networks with programmable gradient information and a new aggregation block (GELAN). YOLOv10 targets the post-processing step. It trains with two heads. A one-to-many head gives rich training signal. A one-to-one head learns to output a single box per object, so inference does not need NMS. Later releases experiment with attention-based blocks. Treat each as a design experiment, and compare it on your own data.
Summary of differences that affect your code
| Version | Head and box prediction | Objectness score | NMS at inference |
|---|---|---|---|
| YOLOv1 | Grid cells, direct box regression | Yes | Yes |
| YOLOv2, YOLOv3 | Anchor boxes, coupled head | Yes | Yes |
| YOLOv5 | Anchor boxes, coupled head | Yes | Yes |
| YOLOv8, YOLO11 | Anchor-free, decoupled head | No | Yes |
| YOLOv10 | Anchor-free, one-to-one head | No | No (in its one-to-one mode) |
The objectness column matters if you write your own decoding. Code that multiplies objectness by class score, as in the earlier output-decoding chapter, will not work on a YOLOv8 export. Its output has no objectness channel.
Comparing versions on your own machine
The Ultralytics package loads several of these models through the same interface. This script counts parameters and times inference. The first run downloads the weights, and you need bus.jpg or any image in the working directory.
import time
from ultralytics import YOLO
weights = ["yolov8n.pt", "yolo11n.pt", "yolov10n.pt"]
for name in weights:
model = YOLO(name)
params = sum(p.numel() for p in model.model.parameters())
model.predict("bus.jpg", verbose=False) # warm-up run
start = time.perf_counter()
results = model.predict("bus.jpg", conf=0.25, verbose=False)
ms = (time.perf_counter() - start) * 1000
n = len(results[0].boxes)
print(f"{name}: {params / 1e6:.1f}M params, {ms:.0f} ms, {n} detections")Timings depend on your hardware and include pre- and post-processing, so use them only to compare models on the same machine. One image is also too little to judge accuracy. For that, evaluate each model on your validation split with model.val() and compare mAP.
Choosing a version
Decide using these criteria, in roughly this order.
- Ecosystem and maintenance. Does the project have documented training, export and active maintenance? A slightly less accurate model with working export to your target runtime usually beats a better paper result you cannot deploy.
- License. Ultralytics models are distributed under AGPL-3.0, with a separate commercial license available. If you ship a closed-source product, this can decide the question. Other YOLO implementations carry their own licenses, so check each repository.
- Latency budget. Pick the size suffix first. A nano or small model of a newer version often matches a larger model of an older one, but verify this on your hardware.
- Pipeline fit. An NMS-free model simplifies deployment on runtimes where NMS is awkward. It also removes the IoU threshold from your tuning.
- Accuracy on your data. Published COCO numbers are a starting point only. Domain differences, such as small objects or unusual lighting, can reorder the models.
Failure modes when upgrading
- Old decoding code breaks. Post-processing written for objectness-based outputs gives wrong scores on anchor-free models. Use the library's results objects, or re-derive the output shape.
- Anchor settings are ignored. Anchor tuning from YOLOv5 does not carry over to anchor-free models. Do not spend time porting it.
- Different default thresholds. Defaults for
confandioudiffer between tools and versions. Set both explicitly so results are comparable. - Exported model behaves differently. An NMS-free model exports without an NMS step, so downstream code that expects to apply NMS may do redundant work or may be missing a step. Check the exported output shape.
- Checkpoint mismatch. A weights file trained with one framework version cannot be assumed to load in another. Pin your package version in production.
Exercise
You inherit code that decodes raw detector output by multiplying an objectness score by class probabilities, then runs NMS. The team swaps in a YOLOv8 export and the detections become nonsense. What changed in the model, and what would you check first?
Show answer
YOLOv8 is anchor-free with a decoupled head and has no objectness output. Its per-candidate output holds box coordinates and class scores only, so the code is reading the wrong channels. Check the exported output shape and compare it with what the decoding code expects. Then either remove the objectness multiplication and use the class scores directly, or switch to the library's results objects, which handle decoding.
Exercise
A colleague says YOLOv10 is better than YOLOv8 because 10 is larger than 8. Give two reasons this argument is weak, and say how you would settle the question for your project.
Show answer
First, version numbers come from different groups and do not form a single ranked lineage, so the number says nothing about accuracy on your data. Second, published benchmarks vary in image size, thresholds, hardware and whether NMS time is counted. To settle it, train both with identical data, epochs and image size, compare mAP50-95 on your validation split with model.val(), and measure latency on your target hardware. Also check licensing and export support.