File size: 6,458 Bytes
2913805
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a69b375
2913805
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
---
license: apache-2.0
tags:
- vision
- image-detection
- image-segmentation
datasets:
- COCO
---

<div align="center">

# RF-DETR for TI EdgeAI

### Real-Time Transformer Detection with a DINOv2 Backbone

[![License](https://img.shields.io/badge/License-Apache%202.0-blue?style=for-the-badge)](https://opensource.org/licenses/Apache-2.0)
[![Framework](https://img.shields.io/badge/Framework-ONNX-orange?style=for-the-badge)](https://onnx.ai/)
[![Task](https://img.shields.io/badge/Task-Object%20Detection-green?style=for-the-badge)](https://github.com/TexasInstruments/edgeai)
[![Dataset](https://img.shields.io/badge/Dataset-COCO-blueviolet?style=for-the-badge)](https://cocodataset.org/)

</div>

---

## Overview

**RF-DETR** is a real-time transformer-based object detection (and instance segmentation) architecture developed by Roboflow, achieving state-of-the-art accuracy/latency trade-offs on COCO (presented at ICLR 2026). It builds on a **DINOv2 ViT backbone** paired with a DETR-style decoder and a hierarchical feature pyramid, giving it strong small-object and dense-scene performance without the NMS and anchor-tuning overhead of traditional detectors.

RF-DETR ships in six size variants, Nano through 2XLarge, for flexible accuracy-speed trade-offs. The Nano through Large variants are released under Apache 2.0; XLarge and 2XLarge require the `rfdetr[plus]` extra and are licensed under PML 1.0. This folder packages the ONNX exports and TIDL configs for the Apache-licensed detection variants (Nano/Small/Medium/Large); the `prepare_model.py` script can additionally export the PML-licensed XLarge/2XLarge detection variants and the segmentation family on request.

---

## Model Variants

| Model | Input Size | Reference mAP[.5:.95]% | Reference mAP[.50]% | Validated Devices | Config |
|-------|-----------|--------------|-----------|--------------------|--------|
| `rfdetr_nano` | 384×384 | 48.4 | 67.6 | TDA4VH | [rfdetr_nano_config.yaml](rfdetr_nano_config.yaml) |
| `rfdetr_small` | 512×512 | 53.0 | 72.1 | TDA4VH | [rfdetr_small_config.yaml](rfdetr_small_config.yaml) |
| `rfdetr_medium` | 576×576 | 54.7 | 73.6 | TDA4VH | [rfdetr_medium_config.yaml](rfdetr_medium_config.yaml) |
| `rfdetr_large` | 704×704 | 56.5 | 75.1 | TDA4VH | [rfdetr_large_config.yaml](rfdetr_large_config.yaml) |

> mAP values are on COCO val2017. `rfdetr_xlarge` (700×700, mAP[.5:.95] 58.6) and `rfdetr_2xlarge` (880×880, mAP[.5:.95] 60.1) are available via `prepare_model.py --plus` but are licensed under PML 1.0 and are not shipped as ONNX/config files in this folder.

**Recommended for edge deployment:** `rfdetr_nano` (best accuracy/compute trade-off, smallest)

---

## Quick Start

### Prerequisites

```bash
# ONNX export dependencies
pip install "rfdetr[onnx]"

# For XLarge / 2XLarge variants (PML 1.0 license)
pip install "rfdetr[onnx,plus]"

# Inference and deployment
pip install onnx>=1.22.0
pip install onnxruntime>=1.23.2
```

### Export the Model

```bash
# List all available variants with accuracy and latency info
python prepare_model.py --list-models

# Export the default model (rfdetr_nano)
python prepare_model.py

# Export a specific model variant
python prepare_model.py --model rfdetr_medium

# Export multiple variants at once
python prepare_model.py --model rfdetr_nano rfdetr_small rfdetr_medium rfdetr_large

# Export XLarge / 2XLarge (requires rfdetr[plus], PML 1.0 license)
python prepare_model.py --model rfdetr_xlarge rfdetr_2xlarge --plus
```

The script automatically:
- Installs `rfdetr[onnx]` (or `rfdetr[onnx,plus]` for XLarge/2XLarge) if not already present
- Downloads pretrained COCO weights from HuggingFace on first use
- Exports the selected variant(s) to ONNX (opset 17 by default, static batch dimension)
- Saves the result as `rfdetr_<variant>.onnx` in the output directory

### Compile and Infer uing edgeai-tidlrunner

> **Note:** Run the commands below from inside the `tidlrunner` directory (the cloned [edgeai-tidlrunner](https://github.com/TexasInstruments/edgeai-tidlrunner) repository), with `--config_path` pointing to this model's config file.

**Compile using edgeai-tidlrunner - on PC**

```bash
cd /path/to/edgeai-tidlrunner
tidlrunner-cli compile --target_device J784S4 \
  --config_path /path/to/rfdetr_nano_config.yaml
```

**Run Inference Benchmark - on device**

```bash
cd /path/to/edgeai-tidlrunner
tidlrunner-cli infer --target_device J784S4 \
  --config_path /path/to/rfdetr_nano_config.yaml
```

### Compile and Infer using edgeai-tidl-tools (Advanced):

Follow the instructions at https://github.com/TexasInstruments/edgeai-tidl-tools

### Deploy using edgeai-tidl-tools:

Deplyment can be done using **[edgeai-tidl-tools](https://github.com/TexasInstruments/edgeai-tidl-tools)**. For ONNX models, onnxruntime-tidl with TIDL acceleration can be used. Consult the documentation of edgeai-tidl-tools for more details.

---

## Citation

If you use RF-DETR in your research, please cite:

```bibtex
@software{rfdetr2025,
  title        = {RF-DETR},
  author       = {Robinson, Isaac and Robicheaux, Peter and Popov, Matvei},
  year         = {2025},
  publisher    = {Roboflow},
  url          = {https://github.com/roboflow/rf-detr},
  note         = {International Conference on Learning Representations (ICLR) 2026}
}
```

---

## 🔗 Resources

| Resource | Link |
|----------|------|
| **RF-DETR Source Code** | [roboflow/rf-detr](https://github.com/roboflow/rf-detr) |
| **RF-DETR Documentation** | [rfdetr.roboflow.com](https://rfdetr.roboflow.com) |
| **RF-DETR on HuggingFace** | [huggingface.co/roboflow](https://huggingface.co/roboflow) |
| **edgeai-tidl-tools** | [GitHub](https://github.com/TexasInstruments/edgeai-tidl-tools) |
| **edgeai-tidlrunner** | [GitHub](https://github.com/TexasInstruments/edgeai-tidlrunner) |
| **EdgeAI SDK** | [Documentation](https://github.com/TexasInstruments/edgeai/blob/main/edgeai-mpu/readme_sdk.md) |

---

## Related Models

<table>
<tr>
<td align="center">

**RT-DETRv2**
Real-time DETR variant
Anchor-free, NMS-free

</td>
<td align="center">

**DEIMv2**
DETR-family detector
Improved matching/training

</td>
<td align="center">

**Deformable-DETR**
Sparse attention DETR
Faster convergence

</td>
<td align="center">

**DETR**
Original transformer detector
End-to-end set prediction

</td>
</tr>
</table>

---

<div align="center">

**Maintained by:** Texas Instruments EdgeAI Team  
**Last Updated:** August 2026

</div>