2026-10-02 · 24 min · computer-vision · object-detection · vision-transformers · tensorrt · benchmarks · inference
A 1:51 narrated explainer, drawn in code. Every number and picture in it is this article's own; the sources are below.
› transcript
Hi, I'm Quincy! RF-DETR is a real-time object detector. It predicts boxes in one shot, and it sizes itself from a single training run. Here's how. The idea: train one network once, then pick any speed-accuracy point from it without retraining. The named sizes are just points someone chose on one curve. An image enters a DINOv2 backbone, a vision transformer pretrained on web-scale images. It alternates cheap local windows with a few global layers, then a projector hands features to the decoder. A fixed set of object queries read the features through deformable attention. Class and box heads give each query one label and one box. No suppression step. It's direct set prediction. Normally you train a separate model for every size, and repeat the whole search for each new device. Here one shared network holds every config at once. Each step trains a random one. Afterward you grid-search the best, with no retraining. On COCO, every RF-DETR size sits above and to the left of the other detectors' curves. Only the top curve crosses sixty. That corner is the largest size, the first real-time detector past sixty. Re-measured in one harness, the largest size reaches sixty point one. The strong baselines stay below sixty, and even the nano hits forty-eight point four. Train one shared network, then pick your operating point. That is how a detector family crossed sixty AP in real time. To recap: a DINOv2 backbone, one-shot set prediction, one shared network for every size, and the first real-time detector past sixty. Every source is in the full article. I'm Quincy. Bye!
Why read this
Essentialtop 10%Runs RF-DETR N/S on a 3090: README AP reproduced, the 48.0 vs 48.4 gap traced to a resize flag, NAS knobs turned on the released weights.
- Checked against the source
- Runs on a consumer GPU
- Widely used
Vision & multimodalMixed licencesPractitioner model
How this was scored
- Is it new?
- 2 of 3: A real new idea, method or capability
- Can I trust it?
- 3 of 3: Reproduces the headline result, or shows from primary files it is wrong
- Can I run it?
- 3 of 3: Open, permissive, runs on reader hardware with instructions
- Will I understand it?
- 2 of 3: Mechanism from first principles with figures
- Can I act on it?
- 2 of 3: A concrete recipe, numbers or comparison
- Will it last?
- 2 of 3: A reference for a year or more
- Does it affect many?
- 2 of 3: A widely used model, tool or lab release
- Only here?
- 2 of 3: A teardown or measurement few others did
Score 79 of 100, ranked 35 of 773 rated articles. Each question is answered 0–3 by hand, and a 3 is rare. How articles are scored
A DETR predicts a fixed set of boxes in one shot, matches them to the ground truth with a bipartite assignment, and skips non-maximum suppression entirely. That design has been elegant since 2020 and slow since 2020. RF-DETR (Roboflow: Robinson, Robicheaux, Popov, Ramanan, Peri; arXiv 2511.09554, ICLR 2026) is a DETR that is fast enough to call real-time: a DINOv2 vision-transformer backbone, a deformable-attention decoder, and a weight-sharing neural architecture search (NAS) that trains one network from which the published sizes are read. RF-DETR-2XL is, by the authors' claim, the first real-time detector past 60 AP on COCO.
Object detection is where I spend a lot of time, so I wanted to know what the headline is made of. The first version of this page read the paper and the repository against each other; this one runs the code. I installed the Apache-2.0 rfdetr package at the release this page was written against, evaluated the official Nano and Small weights on all 5,000 COCO val2017 images on an RTX 3090, counted their parameters, timed them, and turned the NAS knobs on the released checkpoints to see how much of "pick your operating point after training" survives in what you can download.
| Repo | roboflow/rf-detr · I pinned v1.11.1 (2026-09-30); 1.12.1 was tagged 2026-11-12 |
| Paper | arXiv 2511.09554 v2, "RF-DETR: Neural Architecture Search for Real-Time Detection Transformers" (ICLR 2026) |
| Tasks | detection, instance segmentation, keypoint detection (preview), one API |
| Backbone | DINOv2 ViT-S for N/S/M/L, ViT-B for XL/2XL (replaces LW-DETR's CAEv2) |
| License | rfdetr package + N/S/M/L detectors + all Seg + keypoint = Apache-2.0; XL/2XL detection (rfdetr_plus) = PML 1.0 |
| Headline | 2XL: 60.1 COCO AP50:95 at 17.2 ms (T4, TensorRT, FP16, batch 1) |
RF-DETR is a real-time object detection and segmentation model architecture developed by Roboflow, SOTA on COCO, designed for fine-tuning. [ICLR 2026]
- license
- Apache-2.0
- branch
- develop
- forks
- 1.3K
- open issues
- 94
- tests
- 195 files
- source
- 10.0 MB
- commit date
- 2026-11-21
GitHub REST API, 2026-11-23 — branch, createdAt, description, forks, homepage, license, openIssues, pushedAt, stars, topics
local clone, 2026-10-02 at 1268d0a — fileCount, hasTests, licenseFile, shallow, testFileCount
shallow clone: counts describe the pinned tree, not the history
Why "real-time DETR" used to be an oxymoron
A classical detector (YOLO, Faster R-CNN) predicts a dense grid of candidate boxes, then runs non-maximum suppression, a hand-tuned post-process whose cost grows with how crowded the frame is. DETR (2020) threw it out. It carries a fixed number of learned object queries, lets them attend to image features through a transformer decoder, and emits exactly that many boxes. Training uses the Hungarian algorithm to find the one-to-one matching of predictions to ground truth with the lowest total cost, so each query learns to claim at most one object. No grid, no duplicates, no NMS.
The original DETR needed hundreds of epochs and ran nowhere near real time. Deformable DETR (attend to a few sampled points), then RT-DETR, LW-DETR and D-FINE cut it down to single-digit milliseconds on a T4. RF-DETR keeps LW-DETR's deformable decoder and changes the backbone, to DINOv2, and the way the whole thing is sized.

Read it left to right. Patches plus positional embeddings go into the ViT. Inside each backbone block, windowed layers (self-attention restricted to a tile of tokens, cheap) alternate with a non-windowed layer (global attention, expensive, mixes information across the image). A projector passes the backbone features to the decoder. The decoder is two-stage: the encoder output scores every feature-map cell, the most confident cells become the starting boxes for the queries, and the decoder layers refine them with self-attention among queries, deformable cross-attention into the image and a feed-forward network. Class and box heads turn each query into a label and a rectangle. Losses are applied at every decoder layer, which is what makes it safe to drop decoder layers at inference.
The DINOv2 backbone
LW-DETR used a CAEv2 backbone. RF-DETR swaps it for DINOv2, a ViT self-supervised on a large curated image corpus. The paper's motivating complaint is that specialist detectors overfit COCO through bespoke architectures, learning-rate and augmentation schedules, then fall over on datasets with a different object count, class count or imaging modality. A backbone pretrained at internet scale arrives already knowing what surfaces, textures and boundaries look like. In the paper's backbone ablation, DINOv2 beats CAEv2 by 2.4% under identical pretraining and hyperparameters.
The cost: DINOv2's encoder has 12 layers to CAEv2's 10, and the authors "make up for this latency using NAS". They also found SAM2's Hiera-S backbone considerably slower than its size suggests, because a plain ViT gets TensorRT's fused attention kernels and Hiera does not.
Two training details make the transplant work. The learning rate drops to 1e-4 (LW-DETR used 4e-4) with a per-layer multiplicative decay of 0.8, so the early backbone layers barely move and DINOv2's features survive. And the multi-scale projector uses layer norm instead of batch norm, which costs a little accuracy but lets the whole thing train on consumer GPUs with gradient accumulation.
One supernet, many sizes
Classical NAS trains a candidate, measures it and repeats, per device. RF-DETR uses the Once-For-All trick: train one over-parameterised network whose sub-networks share weights, sampling a random configuration at every step, so every sub-network is trained a little all the time. The paper notes a side effect: this "architecture augmentation" regularises the model, enough that adding weight-sharing NAS improves even the base configuration, whose patch size 14 is not in the search grid.

The five knobs are input resolution, patch size, decoder layers, query count and windows per windowed-attention block. Resolution and patch size are varied during training, with positional embeddings pre-allocated for the largest resolution over the smallest patch and interpolated down. Decoder layers and queries are only dropped at inference. The search evaluates 6,468 configurations: 11 resolutions × 7 patch sizes × 7 decoder-layer counts × 3 window settings × 4 query settings. That grid is a search over a trained network, with no retraining per point.
There are two supernets, not one. The paper's own configuration table (its Table 7) puts N, S, M and L on DINOv2-S and XL and 2XL on DINOv2-B, and the paper's Figure 1 draws one continuous curve per backbone. "Every point on a curve comes from a single training run" is the claim, and it is a per-backbone claim.
It costs something: a NAS run takes two to four times as long as one non-NAS baseline, and the paper estimates the search at about 10,000 GPU-hours (200 T4s for 48 hours), against retraining a separate model for every size and latency target.
What the released code contains
I read src/rfdetr/config.py at v1.11.1 for the five knobs. They are all there as ModelConfig fields: resolution, patch_size, num_windows, dec_layers, num_queries. For N through L, config.py sets them exactly as the paper's Table 7 (its detection-config table) does. XL and 2XL live in the separate rfdetr_plus package, so those two rows are Table 7's:
| Size | Backbone | Resolution | Patch | Windows | Decoder layers | Queries |
|---|---|---|---|---|---|---|
| N | DINOv2-S | 384 | 16 | 2 | 2 | 300 |
| S | DINOv2-S | 512 | 16 | 2 | 3 | 300 |
| M | DINOv2-S | 576 | 16 | 2 | 4 | 300 |
| L | DINOv2-S | 704 | 16 | 2 | 4 | 300 |
| XL | DINOv2-B | 700 | 20 | 1 | 5 | 300 |
| 2XL | DINOv2-B | 880 | 20 | 2 | 5 | 300 |
N through L differ only in resolution and decoder depth. The segmentation variants move the other knobs: patch 12, one window for Seg-N, 100 queries for Seg-N and Seg-S and 200 for Seg-M and Seg-L.
What the repository does not contain is the search. There is no supernet training loop, no configuration sampler, no code that grids over 6,468 points. The README says the same method "is now available on the Roboflow platform", and its docs folder carries a chart comparing "Platform NAS" with "Paper NAS". The open package ships the points the search picked, not the search.
Running it
Setup on the 3090 box: rfdetr==1.11.1 with torch 2.7.1 (the package needs transformers 5.x, which needs torch 2.6 or newer), the official rf-detr-nano.pth and rf-detr-small.pth, the 5,000 val2017 images. I scored the released weights three ways. First, the package's public predict() with threshold=0.0 and its default top-300 selection, boxes scored with pycocotools. Second, the same with one change to predict()'s resize (below). Third, the package's own evaluator, model.evaluate(split="val", dataset_file="coco", ...), which is the Lightning validation loop training uses. All three are FP32 PyTorch, not the TensorRT FP16 engine behind the README's latency column.
| AP50:95 / AP50 | README (SAB) | Paper Table 2 | evaluate() | predict() | predict(), antialiased resize |
|---|---|---|---|---|---|
| Nano | 48.4 / 67.6 | 48.0 / 67.0 | 48.46 / 67.60 | 48.03 / 67.10 | 48.43 / 67.55 |
| Small | 53.0 / 72.1 | 52.9 / 71.9 | 53.01 / 72.10 | 52.80 / 71.96 | 52.97 / 72.10 |
The package's evaluator reproduces the README within 0.06 AP on both sizes (48.46 against 48.4, 53.01 against 53.0). predict() lands 0.4 lower on Nano and 0.2 lower on Small. The whole difference is one line in predict():
# rfdetr/detr.py (1.11.1), inside predict()
# antialias=False matches the antialias-free bilinear resize (cv2.INTER_LINEAR)
# used by Albumentations during training — see issue #1203.
batch_tensor = torch.stack([F.resize(t, resize_to, antialias=False) for t in processed_images])COCO images are about 640 pixels on the long side and Nano runs at 384, so the resize is a downscale, and antialiasing a downscale changes what the backbone sees. Patch that call to antialias=True and predict() scores 48.43, the README's number. The validation loop's Resize (datasets/_torchvision.py) resizes PIL images, which torchvision always antialiases, and its own comment says so; the inference API deliberately does not, to match the training augmentation. Which one your deployment matches depends on how it resizes, and on Nano it is worth 0.4 AP.
Parameters. sum(p.numel() for p in model.parameters()) on the loaded LWDETR module gives 30,467,298 for Nano and 32,111,170 for Small, which round to the README's 30.5M and 32.1M. Medium and Large come out at 33,687,458 and 33,933,218 against the README's 33.7M and 33.9M. Splitting by tensor name shows what is in that number. The backbone is 23.27M in Nano and 23.44M in Small; the difference is positional embeddings for a 32 × 32 patch grid instead of 24 × 24. Each decoder layer is about 1.47M. And about 3.9M sits in tensors that LW-DETR's "group DETR" training trick replicates 13 times: the query features (query_feat, 13 × 300 × 256), the reference points, and the two-stage encoder heads (enc_output, enc_out_class_embed, enc_out_bbox_embed). At inference only the first group is used, so roughly 3.6M of Nano's 30.5M (12/13 of those tensors) never touch an image after training. The README's count is honest about what it is (model.parameters()), but it is not the number of weights an inference pass multiplies by.
Latency. The README's 2.3 ms (Nano) and 3.5 ms (Small) are T4, TensorRT, FP16, batch 1, through Roboflow's SAB harness. I did not build TensorRT engines. Through the package's own optimised path, model.inference(dtype=torch.float16), which traces the model with TorchScript, the 3090 gives a median of 6.8 ms for Nano and 7.9 ms for Small over 300 back-to-back batch-1 passes, and 8.4 and 9.4 ms with the paper's 200 ms pause between passes. The inductor backend (CUDA graphs) failed to compile on torch 2.7.1. A bigger GPU coming out three times slower than a T4 is the point: at this size a TorchScript forward is bound by kernel launches on a busy CPU, not by the GPU, and the box was shared. The paper's latency story is a TensorRT story, and these numbers do not belong in the same table as the README's.
Paper 48.0, README 48.4
The earlier version of this page said the README re-measured newer checkpoints in a different harness, and that the paper reported the configuration "as it stood at submission". The git history says otherwise. The README has listed Nano at 48.4 AP since commit 110df1cd on 2025-07-23, four months before the paper's first arXiv version (2025-11-12), and that first version already said 48.0.
The explanation is in the paper's Appendix G. Its Table 15 lists each COCO detector twice: as mined from the supernet, and after a short fine-tune at that one configuration. Nano is 48.0 AP and 67.0 AP50 as mined, and the fine-tune adds +0.4 and +0.6: 48.4 and 67.6, the README's numbers. Small is 52.9 and 71.9 plus +0.1 and +0.2: 53.0 and 72.1. Medium adds +0.0, and the README and paper agree at 54.7. Table 2 in the body reports the mined models; the README reports the fine-tuned ones.
The downloadable checkpoints are the fine-tuned row, and the full COCO breakdown says so. Through the antialiased resize, my Nano run gives AP 48.4, AP50 67.5, AP75 51.8, small/medium/large 25.3 / 53.7 / 71.3. Table 15's fine-tuned Nano is 48.4, 67.6, 51.7, 25.3, 53.6, 71.3. Six numbers, none more than 0.1 apart. Small matches its fine-tuned row the same way (53.0, 72.1, 57.2, 31.8, 58.4, 73.0 against 53.0, 72.1, 57.2, 31.8, 58.5, 73.1). The mined Nano in Table 2 is 51.4 AP75 and 70.0 on large objects; no evaluation of the released file I ran gets there. The default predict() reproduces Table 2's AP and AP50 (48.0, 67.1) by coincidence, not its breakdown (51.0 AP75, 70.6 large).
The checkpoints carry their own training args, and they fit: COCO, a learning rate of 1e-6 (1.5e-6 on the encoder), multi-scale training off, one fixed resolution (384 for Nano, 512 for Small), a 60-epoch schedule saved at epoch 48 and epoch 40. Two fields do not fit anything (num_classes=2, pretrain_weights=None, on a 91-way COCO head), so I read the args as roughly right rather than exact. The two files are nearly the same network: across the 464 floating-point tensors they share with the same shape, Nano and Small differ by 0.24% in relative L2 norm, and the largest single-element difference anywhere is 0.010. Two sizes cut from one supernet, each fine-tuned at a tiny learning rate, is what that looks like.
So the margin over D-FINE-N (42.7) is 5.3 points for the mined Nano the paper describes and 5.7 for the checkpoint you download, measured the way the README measures it. The paper's appendix also says fine-tuning after NAS gives "limited benefit for COCO", and +0.4 is limited. The resize flag is worth the same 0.4 in the other direction, so check which resize your deployment uses before comparing it to either table.
Turning the knobs on released weights
The paper's pitch is that once the supernet is trained you can move along the curve without retraining. The released checkpoints are not the supernet; they are two of its sub-networks after a fine-tune at one setting each. So does the flexibility survive the download?
Four of the five knobs can be turned on a released checkpoint without touching a weight:
- Resolution is a
predict(shape=...)argument; it must be divisible by patch size × windows (32 for N and S). - Queries can be lowered; the config marks only an increase as load-breaking.
- Decoder layers can be dropped by truncating
transformer.decoder.layers, which works because every layer was trained with its own loss. - Windows is weight-free. Passing
num_windows=1or4toRFDETRNanoraises aPretrainWeightsCompatibilityWarningthat "significant portions of the model" will be "randomly initialised", but every tensor in the loaded state dict is identical to the default model's. The warning is a blanket rule over architecture fields, and for this one it is wrong.
Patch size is the knob the release cannot turn: the patch embedding is a convolution with a fixed kernel, and the package has no path to resample it.
I evaluated each setting on all 5,000 val2017 images, one knob at a time from the default, through predict(). I did not time the knob settings; the paper's Figures 4 and 5 below carry TensorRT latency for the same sweeps.
All of it works, and it works the way the paper says the supernet should. On the released Nano (48.03 at the default, through predict()):
- Decoder layers. Dropping from two layers to one costs 2.3 AP (45.72); dropping to none, so the boxes are the two-stage encoder proposals with no refinement at all, still gives 44.16. On Small, three layers to two to one goes 52.80, 52.16, 49.51.
- Queries. 300 to 200 to 100 goes 48.03, 47.91, 47.37. val2017 has 36,781 annotated objects over 5,000 images, about 7.4 per image, so the last hundred queries buy very little.
- Resolution. 320, 384, 448 and 512 pixels give 44.67, 48.03, 50.10 and 51.36. Run at 512, Nano's weights land 1.4 AP under Small's 52.80, with one fewer decoder layer. Small's weights at 640 give 54.84, past the README's Medium (54.7 at 576 pixels with four layers), and that is through
predict(), which reads low. - Windows. One window per block gives 48.81, higher than the released two-window default; four windows gives 46.83. Fewer windows means more global attention: more accurate and slower, the trade the paper's Figure 3 draws.
One comparison says something about the per-size fine-tune. Nano's weights run at Small's resolution with two decoder layers score 51.36; Small's own weights with two decoder layers score 52.16. Same architecture, same resolution, 0.8 AP apart: what Small's own fine-tune at 512 pixels bought.
The paper ran the same decoder-and-query sweep on the Nano supernet (its Figure 4), and the shape matches: dropping the 100 lowest-confidence queries costs little, and dropping decoder layers costs more the fewer remain.

The resolution knob, swept on the supernet with resolutions it never saw during training marked separately, behaves smoothly too:

Checking the 60 AP claim
The headline: RF-DETR-2XL is the first real-time detector past 60 AP on COCO. The README's benchmark table re-measures every row in SAB with pycocotools over the full 5,000-image val2017, on a T4 with TensorRT, FP16 and batch 1:
| Model | COCO AP50:95 | Latency (ms) | Params | Res | License |
|---|---|---|---|---|---|
| RF-DETR-N | 48.4 | 2.3 | 30.5M | 384 | Apache-2.0 |
| RF-DETR-S | 53.0 | 3.5 | 32.1M | 512 | Apache-2.0 |
| RF-DETR-M | 54.7 | 4.4 | 33.7M | 576 | Apache-2.0 |
| RF-DETR-L | 56.5 | 6.8 | 33.9M | 704 | Apache-2.0 |
| RF-DETR-XL | 58.6 | 11.5 | 126.4M | 700 | PML 1.0 |
| RF-DETR-2XL | 60.1 | 17.2 | 126.9M | 880 | PML 1.0 |
| D-FINE-X | 59.3 | 11.5 | 62.0M | 640 | Apache-2.0 |
| YOLO26-X | 56.9 | 9.6 | 56.9M | 640 | AGPL-3.0 |
At 60.1 AP the 2XL clears 60; D-FINE-X at 59.3 and YOLO26-X at 56.9 do not. The paper's Table 2 reports the 2XL identically, 60.1 AP at 17.2 ms. I did not run the 2XL: it ships in rfdetr_plus under PML 1.0, outside what I ran for this page.
Two caveats. XL to 2XL is 1.5 AP for 5.7 ms more at nearly the same parameter count (126.4M to 126.9M), bought with resolution (880 against 700); the 2XL's second window, which on my sweep costs accuracy and saves time, spends some of it back. And the two sizes past 58 are not Apache-licensed: XL and 2XL detection ship in rfdetr_plus under PML 1.0, so D-FINE-X (59.3, Apache-2.0) is the model to beat if your lawyers are in the room. Every Seg size (Seg-2XL at 49.9 mask AP) and the keypoint preview (71.8 AP) are Apache-2.0.

RF100-VL, and the "20×" that compares two runtimes
RF100-VL is Roboflow's 100-dataset benchmark for out-of-distribution detection, and there the comparison is a fine-tuned vision-language detector. In the paper's RF100-VL table GroundingDINO-tiny scores 62.3 AP at 309.9 ms and the fine-tuned 2XL 63.5 AP at 15.6 ms: the abstract's 1.2 AP, and 309.9 / 15.6 = 19.9, so "about 20× faster" is in the data. It is not like-for-like. GroundingDINO's latency is starred because it does not run under TensorRT, so it is PyTorch against TensorRT. What survives is that a 127M-parameter specialist matches a 173M-parameter VLM out of distribution and is deployable in real time. SAM 3.1's throughput story and DART's SAM3-to-detector conversion keep running into the same tension.
The benchmark harness is half the paper
The paper spends real effort on why detector latency numbers disagree. D-FINE's latency for LW-DETR is 25% faster than LW-DETR's own paper; the authors trace drift like that to GPU power throttling during back-to-back passes and fix it by pausing 200 ms between them. They also show that naive FP16 export can wreck a model (D-FINE fell to 0.5 AP until they moved its ONNX export to opset 17), and their rule is accuracy and latency from the same artifact, in a released harness, SAB. My numbers above break that rule and say so: FP32 PyTorch accuracy, TorchScript FP16 latency on a different GPU. The deployment path is the same glue that decides whether real-time perception actually runs on the robot.
Ship a checkpoint, sweep it, then decide
The released Nano and Small are what the README says: the parameter counts match to the decimal, and the package's evaluator reproduces the README's accuracy within 0.06 AP. The default predict() lands 0.2 to 0.4 lower because of one resize flag, which is worth knowing before you compare a deployment against the table. The paper-versus-README gap is the paper's own fine-tuning table, which the downloaded weights match metric for metric, and the checkpoints carry the fine-tune's hyperparameters inside them. A release you can audit this far from its own files is better than most.
The NAS story needs one qualification. The search code is not open, so the 6,468-point grid is something you rent from the Roboflow platform, not something you run. What the open release does give you is checkpoints that still bend: every knob but patch size moves on the downloaded weights, smoothly, and in the direction the paper's figures predict, so a released checkpoint is a small family of models rather than one. If I were shipping one model at several operating points, a nano on a camera and a larger one on a server, I would take an RF-DETR checkpoint and sweep resolution and queries on my own validation set before training anything new. If I needed more than 56.5 AP under Apache-2.0, I would look at D-FINE-X first.