YOLOv8
YOLOv8 is a real-time object detector and the direct successor to YOLOv5.
- Source: released in January 2023 by Ultralytics (Glenn Jocher, Ayush Chaurasia, Jing Qiu), codebase-first: github.com/ultralytics/ultralytics, docs.ultralytics.com/models/yolov8.
- No paper: unlike most entries in the YOLO lineage it has no accompanying publication, so everything below is transcribed from the reference implementation and the official docs.
- Changes: drops anchor boxes, splits the detection head into decoupled classification and regression branches, and generalizes the framework from detection alone to a multi-task suite (detect, segment, classify, pose, OBB, track).
- Why it matters: the architectural baseline that YOLOv10 builds on.
Core idea
YOLOv8 is less a new detection paradigm than a consolidation of the anchor-free, decoupled-head, distribution-based-regression design that the field converged on between YOLOX (2021) and YOLOv6/PP-YOLOE (2022), packaged as a single scalable model family (n/s/m/l/x) with a unified training/export API. Its three substantive departures from YOLOv5 are:
- Anchor-free prediction — each feature-map location predicts one box directly, removing anchor priors, anchor-matching hyperparameters, and the k-means anchor-clustering step.
- Decoupled head — classification and box regression get separate convolutional branches instead of a single shared 1×1 output convolution, avoiding the well-documented task conflict between localization and classification features.
- Task-aligned assignment + DFL — the objectness branch is removed entirely; positives are chosen by a task-aligned assigner (TAL) and boxes are regressed as discrete distributions via Distribution Focal Loss.
Architecture
The network is the familiar three-stage arrangement — CSPDarknet-style backbone → PAN-FPN neck → detection head — parameterized by compound scaling factors [depth, width, max_channels].
C2f block
The backbone’s workhorse is C2f (“CSP bottleneck with 2 convolutions, faster”), which replaces YOLOv5’s C3. A 1×1 convolution expands the input to channels, which are chunked in half; one half is fed through residual bottlenecks, and — crucially — the output of every bottleneck is kept, so all intermediate tensors are concatenated and fused by a final 1×1 convolution:
C3 discarded the intermediate bottleneck outputs; C2f’s dense reuse gives richer gradient flow at similar cost. Each bottleneck uses two 3×3 convolutions (expansion 1.0), with a residual shortcut in the backbone and without one in the neck.
Head
The head is anchor-free and objectness-free. For each of the three feature levels (P3/8, P4/16, P5/32) two branches of two 3×3 convolutions plus a 1×1 output convolution emit:
ncclass logits, trained with BCE — the class score doubles as the confidence, so no separate objectness channel exists;- regression logits: each of the four box sides (left/top/right/bottom offsets from the anchor point) is a discrete distribution over 16 bins (
reg_max = 16), decoded to a continuous value by a softmax-weighted expectation (theDFLmodule).
Losses
with gains , , . Positives are selected by the Task-Aligned Assigner (from TOOD), which scores every candidate anchor inside a ground-truth box by
and keeps the top-10 candidates per ground truth as positives (see Task-Aligned-Assignment for the full algorithm and its soft-target normalization). This is exactly the metric YOLOv10 later reuses for both of its heads — YOLOv10’s one-to-one branch is literally the same assigner with topk = 1. Because assignment is one-to-many, inference must run NMS (default IoU threshold 0.7, max_det = 300).
Computing the loss
Per batch, assignment runs first under no_grad (sigmoid scores, detached boxes) and yields, for every anchor, a soft class target (zero for negatives), a box target, and a positive mask. With as normalizer, the three terms are:
Classification — plain BCE over all anchors and all classes (no focal term). Negatives target 0; positives target the soft rather than 1, so the class score learns to report localization quality:
Box (CIoU) — the box is decoded from the DFL distributions (below) and compared to the target on positives only, each weighted by :
with the centre distance and the diagonal of the smallest enclosing box. The two penalties keep the gradient informative for non-overlapping or badly shaped boxes.
DFL (distribution focal loss) — each of the four side distances (anchor point to box edge, in stride units) is a distribution over the reg_max = 16 bins; the decoded value is the expectation . CIoU only sees that mean, so DFL supervises the distribution itself. For a target (clamped to ) with neighbouring bins , and weights , :
This concentrates probability mass on the two bins around the true edge, in proportion to proximity, which sharpens the distribution — most useful for ambiguous edges (occlusion, blur). Because box loss only covers positives while sums over every anchor and class, the box terms carry the larger gains (7.5 / 1.5 vs 0.5). Ultralytics additionally scales the final sum by the batch size, a convention rather than part of the method.
Hyperparameters
YOLOv8 has no paper-reported training table; these are the reference defaults from ultralytics/cfg/default.yaml (verified against Ultralytics 8.3.75), which are also the values used for the released COCO checkpoints:
- Optimizer:
auto(selects SGD with the settings below for long schedules; AdamW with lr ≈ 1×10⁻³ for short/small runs) - Initial learning rate
lr0: 1×10⁻², final factorlrf: 0.01 (linear decay to 1×10⁻⁴;cos_lroff by default) - Momentum: 0.937, weight decay: 5×10⁻⁴, nominal batch size
nbs: 64 - Warm-up: 3 epochs, warm-up momentum 0.8, warm-up bias lr 0.1
- Epochs: 100 default (500 for the released COCO models), batch 16, image size 640
- Loss gains: box 7.5, cls 0.5, dfl 1.5 (pose 12.0, kobj 1.0 for the pose task)
- Assigner: TAL, topk 10, α = 0.5, β = 6.0;
reg_max= 16 - Augmentation: mosaic 1.0 (disabled for the final
close_mosaic = 10epochs), fliplr 0.5, HSV hue 0.015 / saturation 0.7 / value 0.4, translate 0.1, scale 0.5, mixup 0.0, copy-paste 0.0, degrees/shear/perspective/flipud 0.0 - Inference: NMS IoU 0.7, conf 0.001 (val) / 0.25 (predict), max detections 300
- AMP mixed-precision training enabled, early-stopping patience 100
Note the augmentation defaults are scale-independent, unlike YOLOv10’s, which ramp scale/mixup/copy-paste with model size.
Results
COCO val2017 mAP50-95 at 640 px, as reported by Ultralytics:
| Model | mAP50-95 | Params (M) | FLOPs (B) |
|---|---|---|---|
| YOLOv8n | 37.3 | 3.2 | 8.7 |
| YOLOv8s | 44.9 | 11.2 | 28.6 |
| YOLOv8m | 50.2 | 25.9 | 78.9 |
| YOLOv8l | 52.9 | 43.7 | 165.2 |
| YOLOv8x | 53.9 | 68.2 | 257.8 |
Beyond detection, the same backbone/neck powers segmentation (-seg, prototype-mask head), pose estimation (-pose, 17-keypoint COCO), oriented bounding boxes (-obb, DOTA) and classification (-cls, ImageNet) checkpoints.
Differences to YOLOv10
YOLOv10 takes YOLOv8 as its explicit baseline — same backbone/PAN-FPN skeleton, same DFL+CIoU+BCE losses, same TAL metric — and changes two things: it removes NMS from the pipeline, and it re-audits every component for FLOP efficiency.
| YOLOv8 (2023, Ultralytics) | YOLOv10 (2024, Tsinghua) | |
|---|---|---|
| Publication | No paper; code + docs release | Peer-reviewed paper, arXiv:2405.14458 |
| Label assignment | One-to-many only (TAL, topk 10) | Dual heads: o2m (topk 10) + o2o (topk 1) trained jointly, with a consistent matching metric (, , ) |
| Inference post-processing | NMS required (IoU 0.7) | NMS-free — only the o2o head is used at inference; end-to-end, no duplicate-removal step and no NMS hyperparameters |
| Head cost | Symmetric decoupled head; classification branch as heavy as regression | Lightweight classification head — two depthwise-separable 3×3 convs + 1×1, after showing the cls branch is over-provisioned relative to its accuracy contribution |
| Downsampling | Single stride-2 3×3 conv (halves resolution and doubles channels at once) | Spatial-channel decoupled downsampling: pointwise conv for channels, then depthwise conv for space — cheaper and less lossy |
| Basic block | C2f everywhere, uniformly across stages | Rank-guided block design: stages whose last conv has low intrinsic rank (i.e. redundant) are swapped for the Compact Inverted Block (CIB), greedily, only while accuracy holds |
| Receptive field | 3×3 convs throughout | 7×7 large-kernel depthwise conv inside CIB, at deep stages of the N/S scales only, with a reparameterized 3×3 training branch |
| Global context | None (purely convolutional; SPPF is the only wide-context op) | Partial Self-Attention (PSA) after SPPF — MHSA+FFN applied to half the channels at the lowest resolution only |
| Model scales | n, s, m, l, x | N, S, M, B, L, X (B = M widened) |
| Tasks | Detection, segmentation, pose, OBB, classification, tracking | Detection only (in the paper; downstream ports added later) |
| Augmentation schedule | Fixed across scales (scale 0.5, mixup 0.0, copy-paste 0.0) | Scale-dependent (scale 0.5→0.9, mixup 0→0.15, copy-paste 0→0.3 from N/S to L/X) |
| Reported gain | — | +1.2/+1.4/+0.5/+0.3/+0.5 AP over YOLOv8 N/S/M/L/X with 28–57% fewer parameters, 23–38% fewer FLOPs and 37–70% lower latency |
Two caveats worth keeping in mind when comparing them:
- YOLOv10’s efficiency wins are partly bookkeeping-free: removing NMS cuts measured end-to-end latency (4.63 ms on YOLOv10-S in the ablation) without touching the network itself, so a chunk of the speedup is post-processing, not architecture.
- YOLOv10’s NMS-free head still trails a one-to-many + NMS pipeline by up to 1.0 AP at the N/S scales, so for offline batch workloads where latency is not the binding constraint, YOLOv8’s plain o2m head remains competitive — and its multi-task checkpoints have no YOLOv10 equivalent in the original release.
Limitations
- No paper, no ablations. There is no published justification for the design choices, no controlled comparison against YOLOv5/YOLOv7, and no reproducibility statement; the only ground truth is the code.
- AGPL-3.0 licensing makes the reference implementation and weights awkward for closed-source commercial deployment (Ultralytics sells a separate enterprise license).
- NMS remains in the loop: latency is threshold-sensitive and the model is not truly end-to-end exportable without a post-processing step.
- Uniform block/head design across scales leaves the redundancy that YOLOv10 later quantifies with its rank analysis.
- Small-object performance still lags, as the head only operates on P3–P5 (no P2/4 level by default).
See also
- All Articles
- Task-Aligned-Assignment — the TOOD-derived assigner that selects YOLOv8’s positive samples and supplies its soft classification targets.
- YOLOv10 — the direct successor built on this architecture; adds NMS-free dual-assignment training and an efficiency-driven redesign.
- DETR — the transformer detector that introduced one-to-one set prediction, the idea YOLOv10 imports to eliminate the NMS that YOLOv8 still needs.
- YOLACT — the origin of the prototype + mask-coefficient decomposition this article’s
-segsegmentation head reuses essentially unchanged. - Segmentation Head Comparison — that segmentation head placed side by side with Mask R-CNN’s, SOLOv2’s, DETR’s and Mask2Former’s.
- Implementing Research Papers