Files
2026-06-03 12:42:47 +08:00

5.5 KiB

DETRs Beat YOLOs on Real-time Object Detection

Introduction

This repository is the official pytorch implementation of RTDETR, and is compatiable with RT-DETR/rtdetr_pytorch. For paddle version implementation, please refer to RT-DETR/rtdetr_paddle. If you are using rtdetr for the first time, it is highly recommended to use rtdetrv2.

Fig

Model Zoo

Model Dataset Input Size APval AP50val #Params(M) FPS checkpoint
rtdetr_r18vd COCO 640 46.4 63.7 20 217 url*
rtdetr_r34vd COCO 640 48.9 66.8 31 161 url*
rtdetr_r50vd_m COCO 640 51.3 69.5 36 145 url*
rtdetr_r50vd COCO 640 53.1 71.2 42 108 url*
rtdetr_r101vd COCO 640 54.3 72.8 76 74 url*
rtdetr_18vd COCO+Objects365 640 49.0 66.5 20 217 url*
rtdetr_r50vd COCO+Objects365 640 55.2 73.4 42 108 url*
rtdetr_r101vd COCO+Objects365 640 56.2 74.5 76 74 url*

Notes

  • COCO + Objects365 in the table means finetuned model on COCO using pretrained weights trained on Objects365.
  • FPS is evaluated on a single T4 GPU with batch\\_size = 1 and tensorrt\\_fp16 mode
  • url* is the url of the pretrained weights, converted from the paddle model to save energy. *There may be slight differences between this table and the paper.

Usage

details
  1. Training
CUDA_VISIBLE_DEVICES=0,1,2,3 torchrun --master_port=9909 --nproc_per_node=4 tools/train.py -c path/to/config &> log.txt 2>&1 &
  1. Testing
CUDA_VISIBLE_DEVICES=0,1,2,3 torchrun --master_port=9909 --nproc_per_node=4 tools/train.py -c path/to/config -r path/to/checkpoint --test-only
  1. Tuning
CUDA_VISIBLE_DEVICES=0,1,2,3 torchrun --master_port=9909 --nproc_per_node=4 tools/train.py -c path/to/config -t path/to/checkpoint &> log.txt 2>&1 &
  1. Export onnx
python tools/export_onnx.py -c path/to/config -r path/to/checkpoint --check
  1. Inference

Support torch, onnxruntime, tensorrt and openvino, see details in references/deploy

python references/deploy/rtdetrv2_onnx.py --onnx-file=model.onnx --im-file=xxxx
python references/deploy/rtdetrv2_tensorrt.py --trt-file=model.trt --im-file=xxxx
python references/deploy/rtdetrv2_torch.py -c path/to/config -r path/to/checkpoint --im-file=xxx --device=cuda:0

Citation

If you use RTDETR in your work, please use the following BibTeX entries:

bibtex
@misc{lv2023detrs,
      title={DETRs Beat YOLOs on Real-time Object Detection},
      author={Wenyu Lv and Shangliang Xu and Yian Zhao and Guanzhong Wang and Jinman Wei and Cheng Cui and Yuning Du and Qingqing Dang and Yi Liu},
      year={2023},
      eprint={2304.08069},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}

@software{Lv_rtdetr_by_cvperception_2023,
author = {Lv, Wenyu},
license = {Apache-2.0},
month = oct,
title = {{rtdetr by cvperception}},
url = {https://github.com/lyuwenyu/cvperception/},
version = {0.0.1dev},
year = {2023}
}