Source-linked AI summary

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

arXiv:2207.02696v1cs.CV

TL;DR

Real-time object detectors face unresolved training issues around re-parameterization and dynamic label assignment. YOLOv7 addresses these with trainable bag-of-freebies and model-scaling methods, achieving state-of-the-art speed–accuracy results while reducing parameters and computation in several comparisons.

  • Problem

    Dynamic label assignment creates unresolved questions about assigning soft labels across auxiliary and lead output heads during detector training.

  • Method

    YOLOv7 combines trainable bag-of-freebies, planned re-parameterized convolution, coarse-to-fine label assignment, and model scaling for real-time detection.

  • Results

    YOLOv7 achieves the best comprehensive speed–accuracy trade-off, including 51.4% AP at 161 FPS and 41% fewer parameters than PPYOLOE-L.

  • Takeaways & Limitations

    The YOLOv7 series delivers state-of-the-art real-time object-detection results across GPU and mobile-GPU settings.

  • Takeaways & Limitations

    Reported FLOPs use rectangular input resolutions, while inference time is estimated after letterbox resizing to fixed long-side dimensions.

Abstract

from arXiv · show

YOLOv7 surpasses all known object detectors in both speed and accuracy in the range from 5 FPS to 160 FPS and has the highest accuracy 56.8% AP among all known real-time object detectors with 30 FPS or higher on GPU V100. YOLOv7-E6 object detector (56 FPS V100, 55.9% AP) outperforms both transformer-based detector SWIN-L Cascade-Mask R-CNN (9.2 FPS A100, 53.9% AP) by 509% in speed and 2% in accuracy, and convolutional-based detector ConvNeXt-XL Cascade-Mask R-CNN (8.6 FPS A100, 55.2% AP) by 551% in speed and 0.7% AP in accuracy, as well as YOLOv7 outperforms: YOLOR, YOLOX, Scaled-YOLOv4, YOLOv5, DETR, Deformable DETR, DINO-5scale-R50, ViT-Adapter-B and many other object detectors in speed and accuracy. Moreover, we train YOLOv7 only on MS COCO dataset from scratch without using any other datasets or pre-trained weights. Source code is released in https://github.com/WongKinYiu/yolov7.

1. Introduction

The introduction motivates real-time object detection as a core component of computer-vision systems across applications and devices, then presents YOLOv7’s focus on training advances that improve accuracy without increasing inference cost. It identifies unresolved issues in model re-parameterization and dynamic label assignment and proposes methods to address them.

  • Motivation: Real-time object detection supports systems including multi-object tracking, autonomous driving, robotics, and medical image analysis.These systems commonly execute detection on mobile CPUs or GPUs and neural processing units.
  • Related work: Recent detectors target different deployment settings, with MCUNet and NanoDet emphasizing low-power edge CPUs and YOLOX and YOLOR emphasizing GPU inference speed.Efficient architecture design has become a major focus, while CPU-oriented detectors commonly build on MobileNet and ShuffleNet.
  • Problem setting: Model re-parameterization and dynamic label assignment have introduced new training issues for object detectors.The paper analyzes how re-parameterized modules replace original modules and how dynamic assignment distributes targets across output layers.
  • Contributions: The paper proposes methods for the evolution of object detection by addressing module replacement under re-parameterization and assignment across output layers.These issues are explicitly identified as two new problems discovered by the authors.
  • Contributions: YOLOv7 designs trainable bag-of-freebies methods to improve detection accuracy without increasing inference cost.This is presented as the paper’s first summarized contribution.

2. Related work

The related work centers on real-time detectors based mainly on YOLO and FCOS, highlighting architectural, feature-integration, detection, and loss-function improvements alongside model re-parameterization and scaling techniques.

  • Real-time object detectors: YOLO and FCOS mainly underpin current state-of-the-art real-time object detectors, which typically require faster architectures, effective feature integration, accurate detection, and robust loss functions.These four characteristics are presented as requirements for achieving state-of-the-art real-time detection.
  • Model re-parameterization: Model re-parameterization merges multiple computational modules into one inference model and comprises module-level and model-level ensemble approaches.The technique is described as an ensemble method with two categories.
  • Model scaling: Model scaling adjusts resolution, depth, width, and stage to fit different devices while trading off parameters, computation, inference speed, and accuracy.Scaling can enlarge or reduce an already designed model using different factors.
  • Extended efficient layer aggregation networks: E-ELAN preserves the original gradient-transmission path while using grouped convolution and shuffle-merge operations to enhance feature learning and parameter utilization.The figure describes increasing feature cardinality and combining different groups.

3. Architecture

The architecture section develops E-ELAN to enhance learning without disrupting established gradient paths and proposes scaling considerations tailored to concatenation-based models. It also emphasizes that inference efficiency depends on memory-access and architectural factors beyond parameters and computation.

  • Architecture design: Efficient architecture design must consider memory-access cost, input/output channel ratio, branch count, element-wise operations, and activation alongside parameters and computation.These factors influence network inference speed and computational density.
  • E-ELAN: Unlimited stacking of computational blocks can destroy large-scale ELAN’s stable state and reduce parameter utilization.The stable state is maintained regardless of gradient path length and computational-block stacking number until excessive stacking disrupts it.
  • E-ELAN: E-ELAN uses expand, shuffle, and merge cardinality to enhance learning ability without destroying the original gradient path.It modifies only computational blocks, leaving transition-layer architecture unchanged.
  • Model scaling: The proposed scaling strategy for concatenation-based models scales only computational-block depth while leaving the remaining transition-layer structure unchanged.This avoids the output-width growth and subsequent transition-layer input-width increase caused by conventional depth scaling.
  • Model scaling: Concatenation-based models require jointly considering scaling factors because depth scaling changes transition-layer channel relationships and may reduce hardware usage.Unlike PlainNet or ResNet, these models do not preserve each layer’s in-degree and out-degree during depth scaling.

4. Trainable bag-of-freebies

YOLOv7 introduces trainable bag-of-freebies centered on planned re-parameterized convolutions and lead-head-guided label assignment. These designs adapt gradient flow and supervision across network architectures and detection heads.

  • Planned re-parameterized convolution: Planned re-parameterized convolution uses gradient-flow analysis to tailor re-parameterization to different network architectures.Directly applying RepConv beyond VGG can significantly reduce accuracy, motivating architecture-specific designs.
  • Planned re-parameterized convolution: RepConvN removes identity connections when residual or concatenation connections would otherwise be disrupted.RepConv combines 3 × 3 convolution, 1 × 1 convolution, and identity connection; the identity branch can destroy ResNet residuals and DenseNet concatenations.
  • Deep supervision label assignment: Lead-head-guided label assignment uses lead-head predictions and ground truth to generate soft labels for both auxiliary and lead heads.The method replaces separate label assignment with shared guidance from the stronger lead head.
  • Deep supervision label assignment: Coarse-to-fine lead-head guidance generates fine labels and relaxed coarse labels, assigning them to the lead and auxiliary heads respectively.Coarse labels treat more grids as positive targets by relaxing positive-sample constraints.
  • Deep supervision label assignment: Decoder restrictions limit the influence of extra coarse-positive grids while dynamically adjusting coarse- and fine-label importance.The mechanism keeps the optimizable upper bound of the fine label higher than that of the coarse label.
  • Trainable bag-of-freebies: The section collects trainable bag-of-freebies used during training, with their detailed procedures deferred to the Appendix.The authors describe these techniques as training tricks whose original concepts were not proposed by them.

5. Experiments

Experiments on MS COCO trained YOLOv7 models from scratch show strong speed–accuracy advantages over prior detectors and validate the proposed scaling, re-parameterization, and auxiliary-head designs. Across model sizes and hardware targets, YOLOv7 improves accuracy or efficiency while maintaining competitive performance.

  • Experimental setup: All models were trained from scratch on MS COCO, using train 2017 for training, val 2017 for verification and hyperparameter selection, and test 2017 for final comparison.No pre-trained models were used.
  • Main comparisons: 75% fewer parameters, 36% less computation, and 1.5% higher AP distinguish YOLOv7 from YOLOv4; versus YOLOR-CSP, it has 43% fewer parameters, 15% less computation, and 0.4% higher AP.For YOLOv4-tiny-31, YOLOv7-tiny reduces parameters by 39% and computation by 49% while maintaining the same AP.
  • Main comparisons: 127 fps faster and 10.7% more accurate on AP make YOLOv7-tiny-SiLU stronger than YOLOv5-N (r6.1), while YOLOv7 reaches 51.4% AP at 161 fps.PPYOLOE-L achieves the same 51.4% AP at only 78 fps.
  • Main comparisons: 8 fps faster and 1% higher AP make YOLOv7-W6 outperform YOLOR-P6 at 1280 resolution; YOLOv7-E6 also gains 0.9% AP over YOLOv5-X6 (r6.1) with 45% fewer parameters, 63% less computation, and 47% higher inference speed.YOLOv7-D6 improves AP by 0.8% over YOLOR-E6 at close inference speed.
  • Model scaling: 0.5% higher AP with fewer parameters and less computation is obtained by the proposed compound scaling method versus scaling only width.The method scales computational-block depth by 1.5 times and transition-block width by 1.25 times.
  • Re-parameterization: Higher AP values occur across concatenation-based experiments using the planned re-parameterized model, and residual-based comparisons confirm its effectiveness with equal parameters and operations.The concatenation-based model uses 3-stacked ELAN, while the residual-based model uses CSPDarknet and a reversed dark block.
  • Auxiliary head: Increasing assistant loss significantly improves overall performance, while lead-guided label assignment and objectness upper-bound constraints further improve auxiliary-head results.The upper bound is constrained using distance from the object center, and partial auxiliary heads recover information from intermediate pyramids during training.

6. Conclusions

The paper proposes a new real-time object detector architecture and model-scaling method, while identifying new research topics arising from object-detection evolution. It addresses re-parameterized-module replacement and dynamic-label-assignment allocation through a trainable bag-of-freebies method that enhances detection accuracy.

  • The paper proposes a new architecture for real-time object detection and a corresponding model-scaling method.
  • The evolving process of object-detection methods generates new research topics, including re-parameterized-module replacement and dynamic-label-assignment allocation.
  • The trainable bag-of-freebies method is proposed to solve these replacement and allocation problems and enhance object-detection accuracy.

8. More comparison

YOLOv7 establishes superior speed–accuracy performance across real-time object detectors, including transformer- and convolutional-based competitors. It also achieves strong COCO results from scratch and improves over YOLOv6 models under comparable conditions.

  • Speed and accuracy comparisons: 56.8% AP is YOLOv7’s highest accuracy among known real-time object detectors operating at 30 FPS or higher on GPU V100.YOLOv7 surpasses known object detectors in speed and accuracy across 5–160 FPS.
  • Speed and accuracy comparisons: 509% faster and 2% more accurate, YOLOv7-E6 (56 FPS V100, 55.9% AP) outperforms SWIN-L Cascade-Mask R-CNN (9.2 FPS A100, 53.9% AP).The comparison is against a transformer-based detector.
  • Speed and accuracy comparisons: 551% faster and 0.7% AP more accurate, YOLOv7-E6 outperforms ConvNeXt-XL Cascade-Mask R-CNN (8.6 FPS A100, 55.2% AP).The comparison is against a convolutional-based detector; YOLOv7 also outperforms YOLOR, YOLOX, Scaled-YOLOv4, YOLOv5, DETR, Deformable DETR, DINO-5scale-R50, and ViT-Adapter-B in speed and accuracy.
  • Comparisons with YOLOv6: +13.7% AP higher, YOLOv7-E6E reaches 56.8% AP versus meituan/YOLOv6-s at 43.1% AP on COCO.The passage identifies YOLOv7-E6E as a real-time model and meituan/YOLOv6-s as the current most accurate comparison model.
  • Comparisons with YOLOv6: +25% faster and +0.2% AP higher, YOLOv7-tiny (35.2% AP, 0.4 ms) outperforms meituan/YOLOv6-n (35.0% AP, 0.5 ms) under identical COCO and V100 GPU conditions with batch=32.YOLOv7 is trained only on MS COCO from scratch, without other datasets or pre-trained weights; higher IoU thresholds can also yield higher AP.
Loading 2207.02696v1…