Paper commentary
YOLOv4: Optimal Speed and Accuracy of Object Detection
Proven training features make a real-time one-GPU detector
- Problem Accurate object detectors are usually too slow for everyday use, and the most accurate networks need many GPUs to train. Fast detectors tend to lose accuracy.
- Method YOLOv4 pairs the CSPDarknet53 backbone with SPP and PANet, then trains with features that add little inference cost. Unlike the usual approach, it optimizes for speed on parallel hardware instead of BFLOP count.
- Results YOLOv4 reaches 43.5% AP and 65.7% AP50 on MS COCO test-dev 2017 at about 65 FPS on a Tesla V100.
Why accurate detectors stay out of real-time use
Accurate detectors are often too slow for everyday use, and fast ones often lose accuracy. The introduction uses two examples: finding free parking spaces from urban cameras tolerates a slow, accurate model, while a car collision warning needs a fast one. Better real-time accuracy would let detectors serve as stand-alone process management tools instead of only giving hints for recommendations.
The most accurate networks don't run in real time, and training them usually needs many GPUs with a large mini-batch. The authors set a different target: a detector that runs in real time on a conventional GPU and can be trained on just one such GPU. They also optimize for speed on parallel hardware instead of the BFLOP count, which is a theoretical measure of computation.
Choosing the backbone and neck
The key idea is that a backbone that wins at classification isn't automatically the right backbone for a detector. A detector needs a larger input resolution to find small objects, more layers to cover that input with a wide receptive field, and more parameters to handle objects of many sizes.
CSPDarknet53 has 29 such layers, a 725x725 receptive field and 27.6 M parameters, which makes it the stronger candidate for a detector backbone. On ImageNet classification CSPResNeXt50 is the stronger model, but on MS COCO detection the authors found CSPDarknet53 better. Table 1 also lists 62 FPS for CSPResNext50 and 66 FPS for CSPDarknet53 on an RTX 2070 at 512x512.
Next, the authors add an SPP block over the backbone, which widens the receptive field while costing almost no speed. The SPP block concatenates max-pooling outputs with kernel sizes 1, 5, 9 and 13 at stride 1. For the neck, PANet replaces the FPN of YOLOv3 as the way to combine features from different backbone levels for each detector level.
The resulting architecture is CSPDarknet53, SPP, PANet and a YOLOv3 anchor-based head.
Training features that add little inference cost
The training-side features split into two bags, depending on whether they change inference cost. Bag of Freebies changes only the training strategy or raises the training cost, so the deployed detector stays the same. Bag of Specials adds a plugin module or post-processing step with only a small inference overhead.
Mosaic combines four training images into one input, so each training step sees four contexts. Batch normalization then takes its statistics from four different images on each layer, which the authors say reduces the need for a large mini-batch. Cross mini-Batch Normalization collects statistics only between the mini-batches inside one batch.
Self-Adversarial Training works in two forward and backward stages: first the network alters the input image to hide the object, then it trains to detect the object in the altered image. For box regression, CIoU loss accounts for overlap area, the distance between centre points and the aspect ratio. DropBlock was picked because its own comparisons favored it, and Mish was kept because it raised classifier accuracy in the tables.
Since the goal is one GPU, syncBN wasn't considered. On the classifier, the best row of the ablation table, with four features switched on, reaches 79.8% top-1, compared to 77.9% for the first row.
Which detector features helped
The ablations start from CSPResNeXt50-PANet-SPP at 512x512, and the loss function is the first lever tested. Switching the box loss from MSE to CIoU moved AP from 38.0% to 39.6%, with GIoU at 39.4%. So the regression objective matters even when the network stays the same.
The Bag of Specials results are mixed. Adding SAM raised AP from 42.4% to 42.7%, while adding RFB lowered it to 41.8%. The authors found the best detector with SPP, PAN and SAM together.
The backbone result runs against the classifier ranking. Pre-training CSPDarknet53 with Bag of Freebies and Mish gave 43.0 AP, compared to 42.4 AP for CSPResNeXt50 with the baseline weights. Pre-training CSPResNeXt50 with Bag of Freebies alone lowered detector AP to 42.3, so a better classifier doesn't automatically give a better detector.
With Bag of Freebies and Bag of Specials, CSPDarknet53 scored 41.6 AP at mini-batch 4 and 41.7 AP at mini-batch 8. Without those features, CSPResNeXt50 at 608 moved from 37.1 to 38.4 AP between the same two mini-batch sizes. The authors read this as the extra features making the detector insensitive to mini-batch size.
Speed and accuracy on MS COCO
The main YOLOv4 entry is the 608 input model, listed at 43.5% AP and 65.7% AP50 on MS COCO test-dev 2017. Its frame rate depends on the GPU in the table: 23 FPS on Maxwell and 62 FPS on Volta. The abstract gives about 65 FPS on a Tesla V100 for the same model.
Changing the input size from 416 to 608 lifts AP from 41.2% to 43.5%, while Maxwell FPS falls from 38 to 23. So input size trades speed for accuracy, and the 416 model is the faster option.
The Figure 1 caption says YOLOv4 runs twice as fast as EfficientDet with comparable performance. The Volta table's closest EfficientDet row, D2 at 768, scored 43.0% AP at 41.7 FPS, compared to 43.5% AP at 62 FPS for YOLOv4. The twofold claim therefore depends on which EfficientDet model is picked for comparison.
The authors state that YOLOv4 lies on the Pareto optimality curve. Some compared detectors reported FPS for only one GPU class, so their speeds aren't on a common device.
Limitations
All experiments use a single GPU, so multi-GPU techniques such as syncBN weren't used. The default MS COCO schedule uses a batch size of 64 with mini-batch size 8 or 4, depending on the architecture and GPU memory.
The component ablations use CSPResNeXt50-PANet-SPP at 512x512, not the final CSPDarknet53 model. The comparison-table frame rates are measured with batch=1 and without TensorRT. The authors plan to test more Bag of Freebies features in the future.
Paper info
- Authors
- Alexey Bochkovskiy, Chien-Yao Wang, Hong-Yuan Mark Liao
- Venue
- arXiv · Preprint
- First published
- 2020-4-23
- Added
- 2026-11-11
- Updated
- 2020-4-23
- Version
- v1
- arXiv
- 2004.10934
- Category
- cs.CV · eess.IV
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Quote from the paper
Alexey Bochkovskiy, Chien-Yao Wang, Hong-Yuan Mark Liao (2020). YOLOv4: Optimal Speed and Accuracy of Object Detection. arXiv:2004.10934v1. https://arxiv.org/abs/2004.10934v1
BibTeX
@misc{bochkovskiy2020yolov4,
title = {{YOLOv4: Optimal Speed and Accuracy of Object Detection}},
author = {Alexey Bochkovskiy and Chien-Yao Wang and Hong-Yuan Mark Liao},
year = {2020},
eprint = {2004.10934},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2004.10934v1}
}