AI/TLDR

RF-DETR

Real-time transformer-based object detection and segmentation from Roboflow

Vision & UnderstandingOpen source
Language
Python
License
Apache-2.0
$pip install rfdetr

Overview

RF-DETR is a real-time object detection and instance segmentation model from Roboflow. It uses a transformer (DETR-style) architecture built on a DINOv2 vision transformer backbone, and exposes both detection and segmentation through a single, consistent Python API.

It is aimed at computer-vision engineers who need a fast detector that runs in real time. The project reports accuracy and latency results on the COCO and RF100-VL benchmarks, and ships in several sizes (Nano, Small, Medium, Large) so you can trade speed for accuracy depending on your hardware.

Within the computer-vision space, RF-DETR is an alternative to YOLO-family detectors. The core rfdetr package and its models are released under Apache 2.0, while larger Plus models (RF-DETR-XL and 2XL) use a separate PML 1.0 license.

What it does

  • Single, consistent API covering both object detection and instance segmentation
  • DINOv2 vision transformer backbone for the detection and segmentation heads
  • Multiple model sizes (Nano, Small, Medium, Large) to balance latency and accuracy
  • Benchmarked on Microsoft COCO and the RF100-VL dataset
  • Works with the supervision library for annotating and drawing detections
  • Open-source rfdetr package under Apache 2.0; larger Plus models available under PML 1.0

Getting started

Install the rfdetr package in a Python 3.10+ environment, then load a model and run inference on an image.

Install rfdetr

Install the package with pip into a Python 3.10 or newer environment.

bashbash
pip install rfdetr

Run detection on an image

Load a model size (here Medium), call predict() on an image URL or path, and annotate the result with supervision.

pythonpython
import supervision as sv
from rfdetr import RFDETRMedium
from rfdetr.assets.coco_classes import COCO_CLASSES

model = RFDETRMedium()
detections = model.predict("https://media.roboflow.com/dog.jpg", threshold=0.5)
labels = [f"{COCO_CLASSES[class_id]}" for class_id in detections.class_id]
annotated_image = sv.BoxAnnotator().annotate(detections.metadata["source_image"], detections)
annotated_image = sv.LabelAnnotator().annotate(annotated_image, detections, labels)

Commands and code are distilled from the project's own documentation — always check the official repo for the latest.

When to use it

  • Add real-time object detection to a camera or video pipeline
  • Run instance segmentation to get per-object masks instead of just boxes
  • Pick a smaller model (Nano/Small) when you need low latency on limited hardware
  • Evaluate a transformer detector as an alternative to YOLO models on COCO or custom datasets

How RF-DETR compares

RF-DETR alongside other open-source vision & understanding tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
OpenCV★ 90.9kThe long-standing open-source computer-vision library for C++, Python and Java; version 5 rewrote the DNN engine and added ONNX-based LLM and VLM inference in-library.
PaddleOCR★ 90.1kA toolkit for detecting and recognizing text in images across many languages, plus document parsing.
Ultralytics YOLO★ 61.9kA framework for training and running YOLO models for real-time object detection, segmentation, and tracking.
Supervision★ 51kA Python toolkit for processing, annotating, and visualizing detections and segmentations from many vision models.
MediaPipe★ 37kGoogle's on-device ML framework: ready-to-run vision, text and audio tasks with one cross-platform API for Android, iOS, web, desktop and edge.
MMDetection★ 33kAn OpenMMLab toolbox with many object detection and instance segmentation algorithms for research and production.
vit-pytorch★ 25.5kA single pip package with readable PyTorch implementations of the Vision Transformer and dozens of its research variants, for training image models from scratch.
RF-DETR★ 9.6kReal-time transformer-based object detection and segmentation from Roboflow