Skip to main content
RF-DETR is a real-time transformer architecture for object detection and instance segmentation developed by Roboflow. Built on a DINOv2 vision transformer backbone, RF-DETR delivers state-of-the-art accuracy-latency trade-offs on Microsoft COCO and RF100-VL, with model sizes ranging from Nano to 2XLarge.

Quickstart

Run your first detection or segmentation model in minutes.

Installation

Install RF-DETR via pip, uv, or from source.

Train a model

Fine-tune RF-DETR on your custom dataset.

API Reference

Explore the full Python API surface.

What is RF-DETR?

RF-DETR uses a windowed DINOv2 vision transformer backbone and a deformable DETR detection head to achieve real-time inference with leading COCO accuracy. It supports both object detection and instance segmentation through a single, consistent Python API.

Run detection

Run pre-trained detection models on images, video, and streams.

Run segmentation

Run pre-trained segmentation models for pixel-level predictions.

Pretrained models

Overview of all available model sizes and their benchmarks.

Dataset formats

Train on COCO or YOLO format datasets.

Export to ONNX

Export models for deployment with ONNX Runtime or TensorRT.

Deploy to Roboflow

Deploy fine-tuned models to Roboflow cloud inference.

Get started in 3 steps

1

Install RF-DETR

pip install rfdetr
2

Load a model and run inference

from rfdetr import RFDETRMedium

model = RFDETRMedium()
detections = model.predict("https://media.roboflow.com/dog.jpg", threshold=0.5)
3

Fine-tune on your dataset

from rfdetr import RFDETRMedium

model = RFDETRMedium()
model.train(dataset_dir="./my-dataset", epochs=50, batch_size=4)

Model sizes

RF-DETR provides detection and segmentation models across six sizes to match your latency and accuracy requirements.
SizeDetection classCOCO AP50:95Latency (ms)License
NRFDETRNano48.42.3Apache 2.0
SRFDETRSmall53.03.5Apache 2.0
MRFDETRMedium54.74.4Apache 2.0
LRFDETRLarge56.56.8Apache 2.0
XLRFDETRXLarge58.611.5PML 1.0
2XLRFDETR2XLarge60.117.2PML 1.0
XL and 2XL detection models require pip install rfdetr[plus] and are licensed under PML 1.0. All other models and code are Apache 2.0.
See the benchmarks page for full detection and segmentation comparison tables.

Build docs developers (and LLMs) love