RF-DETR (N / S / M / L detection, Seg N to 2XL) (fastforks)

RF-DETR (Roboflow 2025): real-time end-to-end detection with a DINOv2-small backbone using windowed attention, a single-scale projector and a deformable-attention decoder over 100 to 300 queries, no NMS; boxes, scores and COCO classes at the input size, plus instance masks for the Seg variants. The image is resized to a square (384 to 768 px per variant). The portable module() is the whole network (normalised boxes, class logits and, for Seg, mask logits).

This repo is the model card only: it holds no weights. fastforks downloads the authors' weights from the links below and checks them against the SHA-256 in the model card. Code: https://github.com/kleinicke/fastforks. Kernels for the kernels backend: https://huggingface.co/fastforks/kernels. Original code: https://github.com/roboflow/rf-detr at 5b22dfc09406.

Task: detection. Tier: experimental. Outputs: boxes, scores, labels, masks. Backends: portable, kernels.

Input: one RGB image. Output: boxes, class labels, scores and instance masks.

Variants

Weights are the authors' files (not hosted here). SHA-256 shortened to 12 hex digits; the full hashes are in card.toml.

variant weights (author link) SHA-256 weights licence commercial use
rf-detr-l-coco@1 rf-detr-large-2026.pth 0f4e20e19a99 Apache-2.0 yes
rf-detr-m-coco@1 rf-detr-medium.pth 749ff6071828 Apache-2.0 yes
rf-detr-n-coco@1 rf-detr-nano.pth d8d6b9ee57d4 Apache-2.0 yes
rf-detr-s-coco@1 rf-detr-small.pth d81979a9213a Apache-2.0 yes
rf-detr-seg-2xl-coco@1 rf-detr-seg-2xl-ft.pth f6e06ac5ebaf Apache-2.0 yes
rf-detr-seg-l-coco@1 rf-detr-seg-l-ft.pth ca7b7c630ba2 Apache-2.0 yes
rf-detr-seg-m-coco@1 rf-detr-seg-m-ft.pth 3ad325094735 Apache-2.0 yes
rf-detr-seg-n-coco@1 rf-detr-seg-n-ft.pth a44613a4ecd6 Apache-2.0 yes
rf-detr-seg-s-coco@1 rf-detr-seg-s-ft.pth 6de3da31b257 Apache-2.0 yes
rf-detr-seg-xl-coco@1 rf-detr-seg-xl-ft.pth 77d67f2b8033 Apache-2.0 yes

Licence

Original-code strings, recorded as they are (research-use package; check them before any other use). Code: Apache-2.0. Licence files: LICENSE.

Training data: COCO 2017 (train, instance annotations), Objects365 (train, box annotations), LVD-142M (DINOv2's curated web-image set, not released) (COCO 2017 train (README); the RF-DETR paper (arXiv:2511.09554) pretrains detection on Objects365; the DINOv2-small backbone originates from LVD-142M pretraining. Full intermediate training provenance is not stated.).

Licence evidence: https://github.com/roboflow/rf-detr/blob/5b22dfc0940697ce1abdfa681a5f7392b3eddbfb/README.md#license

Input size

any H x W >= 32, padded to a multiple of 32 Tested up to (portable, fp16, RTX 5060 Ti 16 GB): rf-detr-l-coco 3000x4000 (0.5 GiB peak allocated, 0.5 reserved); rf-detr-m-coco 3000x4000 (0.5 GiB peak allocated, 0.5 reserved); rf-detr-n-coco 3000x4000 (0.5 GiB peak allocated, 0.5 reserved); rf-detr-s-coco 3000x4000 (0.5 GiB peak allocated, 0.5 reserved); rf-detr-seg-2xl-coco 3000x4000 (0.5 GiB peak allocated, 0.5 reserved); rf-detr-seg-l-coco 3000x4000 (0.5 GiB peak allocated, 0.5 reserved); rf-detr-seg-m-coco 3000x4000 (0.5 GiB peak allocated, 0.5 reserved); rf-detr-seg-n-coco 3000x4000 (0.5 GiB peak allocated, 0.5 reserved); rf-detr-seg-s-coco 3000x4000 (0.5 GiB peak allocated, 0.5 reserved); rf-detr-seg-xl-coco 3000x4000 (0.5 GiB peak allocated, 0.5 reserved)

Speed and memory

Detection, synthetic, 800x1344

model time (ms): original fp32 original portable kernels kernels speed-up: vs original vs portable peak memory (MiB, allocated / reserved): original portable kernels
rf-detr-l-coco – 11.8 10.7 5.36 2.2x 2.0x 219 / 240 148 / 166 146 / 206
rf-detr-m-coco – 11.8 11.3 3.90 3.0x 2.9x 140 / 174 136 / 156 133 / 180
rf-detr-n-coco – 10.5 9.43 2.46 4.2x 3.8x 118 / 160 114 / 140 114 / 142
rf-detr-s-coco – 11.2 10.1 3.44 3.2x 2.9x 189 / 238 126 / 148 125 / 170
rf-detr-seg-2xl-coco – 25.6 25.5 16.0 1.6x 1.6x 287 / 352 210 / 230 218 / 332
rf-detr-seg-l-coco – 15.3 15.2 6.75 2.3x 2.2x 459 / 492 150 / 168 151 / 228
rf-detr-seg-m-coco – 14.4 13.2 5.36 2.7x 2.5x 381 / 424 141 / 180 144 / 204
rf-detr-seg-n-coco – 13.0 11.9 3.75 3.5x 3.2x 255 / 298 123 / 148 126 / 190
rf-detr-seg-s-coco – 13.0 12.0 4.34 3.0x 2.8x 327 / 382 130 / 154 129 / 198
rf-detr-seg-xl-coco – 18.7 17.9 10.5 1.8x 1.7x 182 / 248 177 / 206 188 / 268

Startup and first call

model load (s): original portable kernels first call (s): original portable kernels
rf-detr-l-coco 1.10 3.11 3.31 0.02 0.38 0.36
rf-detr-m-coco 2.77 3.59 2.96 0.02 0.42 0.35
rf-detr-n-coco 5.93 2.59 2.67 0.56 0.35 0.35
rf-detr-s-coco 2.74 2.61 2.65 0.02 0.35 0.34
rf-detr-seg-2xl-coco 0.47 2.82 2.63 0.06 0.34 0.33
rf-detr-seg-l-coco 0.44 3.13 2.89 0.02 0.36 0.34
rf-detr-seg-m-coco 0.44 3.95 2.74 0.02 0.40 0.34
rf-detr-seg-n-coco 0.43 2.78 2.62 0.03 0.36 0.33
rf-detr-seg-s-coco 0.42 2.72 2.62 0.02 0.35 0.34
rf-detr-seg-xl-coco 0.61 2.92 2.68 0.04 0.34 0.35

torch.compile and TensorRT

model input time: portable compile TensorRT fp16 kernels preparation: compile (cold first call) ONNX + engine build peak MiB (alloc / reserved): portable compile kernels TensorRT (engine + torch)
rf-detr-l-coco 800x1344 10.7 ms 5.32 ms 2.87 ms 5.36 ms 28.7 s 65.7 s 148 / 166 164 / 182 146 / 206 203 / 222
rf-detr-m-coco 800x1344 11.3 ms 4.92 ms 2.10 ms 3.90 ms 27.8 s 55.3 s 136 / 156 156 / 166 133 / 180 194 / 216
rf-detr-n-coco 800x1344 9.43 ms 4.58 ms 1.15 ms 2.46 ms 25.8 s 60.1 s 114 / 140 141 / 156 114 / 142 179 / 208
rf-detr-s-coco 800x1344 10.1 ms 4.56 ms 1.83 ms 3.44 ms 24.4 s 52.5 s 126 / 148 150 / 162 125 / 170 188 / 214
rf-detr-seg-2xl-coco 800x1344 25.5 ms 16.9 ms 8.62 ms 16.0 ms 44.6 s 69.2 s 210 / 230 245 / 308 218 / 332 334 / 366
rf-detr-seg-l-coco 800x1344 15.2 ms 7.08 ms 3.30 ms 6.75 ms 31.5 s 68.5 s 150 / 168 190 / 208 151 / 228 218 / 234
rf-detr-seg-m-coco 800x1344 13.2 ms 6.86 ms 2.50 ms 5.36 ms 32.1 s 72.4 s 141 / 180 172 / 194 144 / 204 208 / 228
rf-detr-seg-n-coco 800x1344 11.9 ms 6.59 ms 1.52 ms 3.75 ms 31.2 s 54.0 s 123 / 148 158 / 166 126 / 190 189 / 218
rf-detr-seg-s-coco 800x1344 12.0 ms 6.55 ms 2.00 ms 4.34 ms 29.8 s 63.6 s 130 / 154 162 / 190 129 / 198 197 / 224
rf-detr-seg-xl-coco 800x1344 17.9 ms 10.8 ms 5.20 ms 10.5 ms 35.3 s 92.5 s 177 / 206 212 / 246 188 / 268 302 / 326

Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).

Hardware, protocol and caveats: benchmarks (RTX 5060 Ti 16 GB, sm_120). Original = the original code named above at the precision of portable (fp16, or (fp32) where fp16 is unsupported or not finite); original fp32 = its default fp32 run. Peak memory is the torch allocator's.

Accuracy

On public datasets

pycocotools COCOeval of the top 100 detections per image. Original = the original code named under Details, same checkpoint and protocol.

variant dataset original fp32 original fp16 portable kernels note
rf-detr-m-coco COCO val2017, every 10th image, box mAP 54.48 54.42 54.42 54.40
rf-detr-m-coco COCO val2017, all 5000 images, box mAP 54.53 54.51 54.51
rf-detr-seg-m-coco COCO val2017, every 10th image, box mAP / mask mAP 53.21 / 44.24 53.30 / 44.30 53.30 / 44.30 53.49 / 44.38

Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 7cecd6cb, 2026-11-12.

Parity with the original code

Every variant is checked against reference outputs of the original code at its pinned commit. CPU, float32: max |diff| <= 0.0001 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 1.1 and p99 <= 4.2 (absolute error of the output boxes).

Limitations

  • Requires the optional transformers and torchvision libraries.
  • Only the Apache-2.0 checkpoints are included; the PML-1.0 detection variants (A / F / P / XL / 2XL) are not.
  • torch.compile uses upstream positional-interpolation graph breaks; fullgraph=True is unsupported.

Usage

from fastforks import detection

model = detection.load("rf-detr-l-coco")  # mode="auto": the preferred backend from recorded measurements
result = model("photo.jpg")
result.boxes, result.scores, result.labels  # [N, 4], [N], [N]
result.backend  # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16')

Install with pip install fastforks (see https://github.com/kleinicke/fastforks). Other variants: rf-detr-l-coco, rf-detr-m-coco, rf-detr-n-coco, rf-detr-s-coco, rf-detr-seg-2xl-coco, rf-detr-seg-l-coco, rf-detr-seg-m-coco, rf-detr-seg-n-coco, rf-detr-seg-s-coco, rf-detr-seg-xl-coco.

Kernels backend

detection.load("rf-detr-l-coco", mode="kernels") runs our CUDA kernels (fastbb, fvm_conv). It needs a prebuilt kernel for your GPU architecture (downloaded from https://huggingface.co/fastforks/kernels on first use) and a recent NVIDIA driver; if there is none it raises BackendUnavailableError with the reason and never falls back silently. mode="auto" picks kernels when it can run and logs the choice.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Collection including fastforks/rfdetr

Paper for fastforks/rfdetr