YOLOv7: Trainable Bag-of-Freebies Sets New State-of-the-Art for Real-Time Object Detectors

Chien-Yao Wang, Alexey Bochkovskiy, Hong-Yuan Mark Liao

Abstract

YOLOv7 establishes a new state-of-the-art for real-time object detection, surpassing all known detectors in both speed and accuracy within the 5 to 160 FPS range. By introducing architectural innovations like E-ELAN and a novel "coarse-to-fine" label assignment strategy, it achieves 56.8% AP on MS COCO while being significantly more parameter-efficient than its predecessors. This paper demonstrates that optimizing gradient flow and training-time strategies can yield substantial performance gains without increasing inference costs.

Introduction

In the world of computer vision, "real-time" object detection is a critical requirement—models must be fast enough for robotics or autonomous vehicles while remaining highly accurate. Traditionally, researchers have improved these models via two paths: Architecture Optimization (designing better layers) and Bag-of-Freebies (training-time tricks that increase accuracy without adding inference cost).

However, as architectures have become more complex—specifically those using "concatenation-based" structures like DenseNet or ELAN—standard methods for scaling models (making them deeper or wider) and re-parameterization (merging layers) have started to produce sub-optimal results. YOLOv7 tackles these integration challenges head-on to push the limits of what is possible in real-time detection.

Proposed Methods

The authors introduce several "trainable bag-of-freebies" and architectural shifts to improve performance and efficiency:

E-ELAN (Extended Efficient Layer Aggregation Network)

An evolution of the ELAN architecture, E-ELAN uses group convolutions to expand the "cardinality" (the number of paths) of the features. This allows the network to learn more diverse features without disrupting the original gradient flow, which is critical for stable training and high performance.

Evolution of layer aggregation networks leading to E-ELAN

Compound Model Scaling

In concatenation-based models, scaling depth alone changes the input properties of subsequent layers. YOLOv7 introduces a method to scale both depth and width simultaneously for these specific blocks, maintaining the optimal model structure at different sizes.

Planned Re-parameterized Convolution

While "RepConv" (merging multiple branches into one at inference) is popular, the authors found it can destroy identity connections in certain block styles. They designed a "planned" version that determines exactly where re-parameterization can be used safely to preserve model integrity.

Coarse-to-Fine Lead Guided Label Assignment

This is a new take on "Deep Supervision." Instead of having auxiliary heads (middle layers) and the lead head (final layer) learn independently from the ground truth, the Lead Head generates "soft labels" to guide the auxiliary head. This ensures the intermediate layers are learning features that are actually useful for the final prediction.

Key Results

YOLOv7's performance is dominant across the board when evaluated on the MS COCO dataset:

  • Accuracy: It reaches 56.8% AP on COCO test-dev, the highest among all real-time detectors (defined as 30+ FPS on a V100 GPU).
  • Efficiency: Compared to YOLOv4, YOLOv7 uses 40% fewer parameters and 50% less computation while achieving higher accuracy.
  • Speed vs. Transformers: The YOLOv7-E6 (56 FPS) outperforms the transformer-based Swin-L Cascade-Mask R-CNN by 509% in speed and 2% in accuracy.
Comparison of YOLOv7 against other real-time object detectors on MS COCO

Conclusion

YOLOv7 redefines the state-of-the-art for real-time object detection. By focusing on gradient path preservation and intelligent label assignment, the authors have created a model that is both faster and more accurate than previous iterations. While the current focus is on high-end GPUs, the "tiny" version shows great promise for edge devices. Future work may extend these "trainable bag-of-freebies" to tasks such as instance segmentation and pose estimation.

Summary updated

BibTeX
@inproceedings{wang2022yolov,
  author = {Chien-Yao Wang and Alexey Bochkovskiy and Hong-Yuan Mark Liao},
  title = {{YOLOv7: Trainable Bag-of-Freebies Sets New State-of-the-Art for Real-Time Object Detectors}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2022},
}
Figure