Computer Vision Lab Models RT-DETR (R50)
RT-DETR (R50)
Real-time DETR: efficient hybrid encoder + IoU-aware query selection
Knowledge card: the first detector of the DETR family to run in real time and, according to the paper, to outperform contemporary YOLO detectors in both accuracy and speed, without NMS; its speed can be adjusted by changing the number of decoder layers without retraining.
| Architecture | Real-time DETR: efficient hybrid encoder + IoU-aware query selection |
|---|---|
| Task | Object detection |
| Training data | COCO 2017 |
| the number of parameters | 42M (official repository) |
| Framework | PyTorch / PaddlePaddle |
| File size | — |
| Licence | Apache-2.0 |
| Where it runs | Knowledge card only |
| Official source | github.com |
Published metrics (from the official source, not measured by this site)
| Metric | Value | Evaluation data | Source |
|---|---|---|---|
| AP | 53.1 | COCO val2017, 640×640 | Source |
| FPS | 108 | T4 GPU, TensorRT FP16 | Source |
Architecture diagram
- Input / output
- Convolutional layer
- Attention / transformer
- Composite block
- Embedding / tokens / queries
- Memory / intermediate features
Detailed model explanation
Idea and intuition
RT-DETR (Real-Time DETR) is an attempt to make transformer detectors compete with the YOLO family in speed while keeping the advantage of eliminating NMS. The problem with the original DETR is that self-attention over multi-scale features is very costly. So the authors proposed an «efficient hybrid encoder» that separates interaction within a single scale from fusion across scales.
Components
- Backbone (ResNet or HGNetv2) outputs three maps S3–S5.
- AIFI (Attention-based Intra-scale Feature Interaction): self-attention on the deepest map S5 only, because it is the richest semantically and the smallest, which greatly reduces the cost.
- CCFF (CNN-based Cross-scale Feature Fusion): convolutional fusion across scales in the PAN manner.
- Uncertainty-aware query selection (uncertainty-minimal query selection): the best
Kencoder features are selected to initialise the decoder queries. - Decoder with deformable attention; the number of its layers can be reduced at inference to trade accuracy for speed without retraining.
Mathematical formulation
RT-DETR inherits bipartite matching from DETR, so it does not need NMS. The AIFI idea is essentially standard attention over the sequence of S5 cells:
\mathrm{Attn}(Q,K,V)=\mathrm{softmax}\!\Big(\frac{QK^\top}{\sqrt{d}}\Big)V,\qquad Q=K=V=\mathrm{flatten}(S_5)+\mathrm{PE}Performance
According to the official repository: RT-DETR-R50 reaches 53.1 AP on COCO val2017, with about 42 million parameters and 108 frames per second on a T4 with TensorRT FP16.
Strengths and limitations
- Strength: real-time speed without NMS, so inference time is more stable and unaffected by the number of boxes.
- Strength: flexible speed tuning by changing the number of decoder layers.
- Limitation: training is more complex and more sensitive to hyperparameters than convolutional detectors.
- Limitation: the published figures are measured on specific hardware (T4 + TensorRT) and may differ on your hardware.
Uses
Real-time detection on GPU, powerful embedded systems.
Runtime requirements
GPU with TensorRT for the published speed.
How to load
Not loaded in the lab (knowledge card).
References
- Y. Zhao et al. (2023).DETRs Beat YOLOs on Real-time Object Detection. arXiv:2304.08069 (CVPR 2024). doi:10.48550/arXiv.2304.08069
- N. Carion, F. Massa, G. Synnaeve, N. Usunier, A. Kirillov, S. Zagoruyko (2020).End-to-End Object Detection with Transformers. arXiv:2005.12872 (ECCV 2020). doi:10.48550/arXiv.2005.12872
