DETRs Beat YOLOs on Real-time Object Detection

Yian Zhao,Wenyu Lv,Shangliang Xu,Jinman Wei,Guanzhong Wang,Qingqing Dang,Yi Liu,Jie Chen
2024-04-03
Abstract:The YOLO series has become the most popular framework for real-time object detection due to its reasonable trade-off between speed and accuracy. However, we observe that the speed and accuracy of YOLOs are negatively affected by the NMS. Recently, end-to-end Transformer-based detectors (DETRs) have provided an alternative to eliminating NMS. Nevertheless, the high computational cost limits their practicality and hinders them from fully exploiting the advantage of excluding NMS. In this paper, we propose the Real-Time DEtection TRansformer (RT-DETR), the first real-time end-to-end object detector to our best knowledge that addresses the above dilemma. We build RT-DETR in two steps, drawing on the advanced DETR: first we focus on maintaining accuracy while improving speed, followed by maintaining speed while improving accuracy. Specifically, we design an efficient hybrid encoder to expeditiously process multi-scale features by decoupling intra-scale interaction and cross-scale fusion to improve speed. Then, we propose the uncertainty-minimal query selection to provide high-quality initial queries to the decoder, thereby improving accuracy. In addition, RT-DETR supports flexible speed tuning by adjusting the number of decoder layers to adapt to various scenarios without retraining. Our RT-DETR-R50 / R101 achieves 53.1% / 54.3% AP on COCO and 108 / 74 FPS on T4 GPU, outperforming previously advanced YOLOs in both speed and accuracy. We also develop scaled RT-DETRs that outperform the lighter YOLO detectors (S and M models). Furthermore, RT-DETR-R50 outperforms DINO-R50 by 2.2% AP in accuracy and about 21 times in FPS. After pre-training with Objects365, RT-DETR-R50 / R101 achieves 55.3% / 56.2% AP. The project page:
Computer Science
What problem does this paper attempt to address?
The paper aims to address the issues present in real-time object detection, particularly the trade-off between speed and accuracy in existing real-time detectors (such as the YOLO series) and the negative impact of Non-Maximum Suppression (NMS). Specifically, the paper proposes a new real-time object detector—Real-Time Detection Transformer (RT-DETR), which is an end-to-end detection framework designed to overcome the limitations of existing methods: 1. **Eliminating the impact of NMS**: Existing real-time detectors typically require NMS for post-processing, which not only slows down inference speed but also introduces hyperparameters, leading to instability in speed and accuracy. RT-DETR addresses this issue by eliminating the need for NMS. 2. **Improving speed and accuracy**: RT-DETR designs an efficient hybrid encoder to quickly process multi-scale features and proposes an uncertainty minimization query selection method to provide high-quality initial queries to the decoder, thereby improving accuracy and inference speed. 3. **Flexible speed adjustment**: RT-DETR supports adapting to different application scenarios by adjusting the number of decoder layers without retraining the model. The paper validates through detailed experiments that RT-DETR improves both speed and accuracy compared to previous advanced YOLO detectors. Additionally, the paper analyzes the impact of NMS on the speed and accuracy of real-time detectors and establishes an end-to-end speed benchmark to evaluate the actual performance of different detectors. Overall, the goal of this research is to develop a new type of real-time object detector that can improve detection speed while maintaining high accuracy, thereby providing better solutions for practical applications.