PP-YOLOv2: A Practical Object Detector

Xin Huang, Xinxin Wang, Wenyu Lv, Xiaying Bai, Xiang Long, Kaipeng Deng, Qingqing Dang, Shumin Han, Qiwen Liu, Xiaoguang Hu, Dianhai Yu, Yanjun Ma, Osamu YoshiearXiv 2021

Abstract

Being effective and efficient is essential to an object detector for practical use. To meet these two concerns, we comprehensively evaluate a collection of existing refinements to improve the performance of PP-YOLO while almost keep the infer time unchanged. This paper will analyze a collection of refinements and empirically evaluate their impact on the final model performance through incremental ablation study. Things we tried that didn't work will also be discussed. By combining multiple effective refinements, we boost PP-YOLO's performance from 45.9% mAP to 49.5% mAP on COCO2017 test-dev. Since a significant margin of performance has been made, we present PP-YOLOv2. In terms of speed, PP-YOLOv2 runs in 68.9FPS at 640x640 input size. Paddle inference engine with TensorRT, FP16-precision, and batch size = 1 further improves PP-YOLOv2's infer speed, which achieves 106.5 FPS. Such a performance surpasses existing object detectors with roughly the same amount of parameters (i.e., YOLOv4-CSP, YOLOv5l). Besides, PP-YOLOv2 with ResNet101 achieves 50.3% mAP on COCO2017 test-dev.

Introduction

In the field of object detection, there is a constant trade-off between effectiveness (accuracy) and efficiency (speed). While complex architectures like Cascade R-CNN achieve high accuracy, they are often too slow for real-time industrial applications. Conversely, while YOLOv3 remains a favorite in production due to its speed and software support, it lags behind modern detectors in precision. PP-YOLOv2 aims to bridge this gap, serving as a "Tech Report" on how to systematically stack existing refinements to create a detector that is both state-of-the-art and production-ready.

Methods

PP-YOLOv2 builds upon the original PP-YOLO, which utilized a ResNet50-vd backbone. The researchers conducted an incremental ablation study to identify refinements that improved accuracy without significantly slowing down inference. Key additions include:

  • Path Aggregation Network (PAN): Replaces the standard Feature Pyramid Network (FPN) to better aggregate top-down and bottom-up spatial information.
  • Mish Activation Function: Applied specifically in the detection neck to preserve the power of high-accuracy pre-trained ImageNet weights in the backbone.
  • Larger Input Size: Increasing the maximum training/evaluation input size helps the model detect smaller objects more clearly.
  • IoU Aware Branch: Modified to a "soft label" format, making predicted IoU scores more consistent with actual localization performance.
Architecture of the Path Aggregation Network (PAN) and Detection Blocks in PP-YOLOv2

Datasets

The models were trained and evaluated on the industry-standard MS-COCO 2017 dataset. This included the standard train2017 (118k images) and minival (5k images) sets. A 25k image subset, COCO minitrain, was utilized for rapid iteration and testing of new ideas before full-scale training. Final benchmarking was conducted on the test-dev set.

Key Insights and Ideas

  • Trick Synergy: The paper emphasizes that while many techniques claim to improve accuracy independently, they often conflict when combined. PP-YOLOv2 identifies a specific combination of refinements that work harmoniously.
  • Backbone Wisdom: The authors chose to retain a highly optimized, pre-trained ResNet-vd backbone (achieving 82.4% Top-1 accuracy on ImageNet) rather than adopting a novel, unproven architecture.
  • Honest Failure Analysis: The report includes a section on "Things We Tried That Didn’t Work," noting that standard practices like Cosine Learning Rate Decay and Backbone Parameter Freezing actually hindered performance on the full COCO dataset.

Key Results

PP-YOLOv2 achieves a superior balance of speed and accuracy compared to its peers. It reached 49.5% mAP on COCO test-dev with a ResNet50 backbone and 50.3% mAP with ResNet101. In terms of speed, it runs at 68.9 FPS at 640x640 resolution, jumping to 106.5 FPS when optimized with the Paddle inference engine and TensorRT (FP16). At similar frame rates, PP-YOLOv2 outperforms YOLOv5l by 1.3% mAP, while the ResNet101 version matches YOLOv5x's accuracy with a 15.9% speed advantage.

Comparison of PP-YOLOv2 performance (mAP vs FPS) against other state-of-the-art detectors on MS COCO

Limitations and Future Work

The authors acknowledge an "inconsistency phenomena" where certain refinements work on small datasets but fail on larger ones. This highlights a limitation in current research regarding how universal features generalize across scales. Future work will likely involve narrowing the gap between model development and deployment through automated architecture searches or sophisticated distillation techniques tailored for the PaddlePaddle ecosystem.

Summary updated

BibTeX
@misc{huang2021pp,
  author = {Xin Huang and Xinxin Wang and Wenyu Lv and Xiaying Bai and Xiang Long and Kaipeng Deng and Qingqing Dang and Shumin Han and Qiwen Liu and Xiaoguang Hu and Dianhai Yu and Yanjun Ma and Osamu Yoshie},
  title = {{PP-YOLOv2: A Practical Object Detector}},
  year = {2021},
  eprint = {2104.10419},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2104.10419},
}
Figure