Models · Object detection

DETR (ResNet-50 / ResNet-101)

DETR (ResNet-50 and ResNet-101, COCO) from Facebook Research: end-to-end boxes and classes from 100 object queries, no NMS.

stable Fork of facebookresearch/detr@29901c5 · backends: portable, kernels

Checkpoint

Paper 2020 Added in 0.1.0 Evaluated with 0.2.0

Kernels, RTX 5060 Ti 16 GB 9.93 ms 800x1344, fp16
vs the faster original 5.6× original fp32: 55.5 ms
Peak memory 218 MiB original: 491 MiB
Accuracy vs original fp32 +0.03 kernels box mAP, COCO val2017 (43.59 original)

Use it

pip install fastforks

Lean install with only what this model needs: pip install fastforks-core

from fastforks import detection

model = detection.load("detr-r50-coco")  # kernels on a supported GPU, else portable PyTorch
result = model(image)
result.boxes  # also: scores, labels
result.backend  # what ran: mode, device, dtype, kernels
fastforks bench detr-r50-coco

Times the model on this machine. load(…, mode="portable") or mode="kernels" picks a backend; usage guide.

Speed and memory

Every backend on one GPU (RTX 5060 Ti 16 GB) and the same input, the authors’ code included. Kernels runs fp16. Portable runs fp16 on CUDA.

Input: synthetic, 800x1344 (the task’s standard size)

BackenddtypeTime per call (ms)vs original fp32Peak memory
allocated / reserved
Load (s)First call (s)
Original fp32incl. CPU resize + host copy (official pipeline)fp32 55.5–491 MiB/540 MiB0.60.12
Original fp16torch.autocast(fp16) around the forward; incl. CPU resize + host copy (official pipeline)fp16 62.00.90×459 MiB/558 MiB2.50.83
Portable fp32fp32not measured ––––
Portablefp16 12.44.5×280 MiB/332 MiB0.70.44
Kernelsfp16 9.935.6×218 MiB/272 MiB0.30.03
Portable + torch.compile 9.276.0×233 MiB/292 MiB22 (build)–
TensorRT fp16fp16 4.4013×182 MiBenginenot comparable33 (build)–

Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-11-02 to 2026-11-04. Median of 5 after 3 warm-up, uint8 CUDA input (synthetic for bench_inputs sizes), card defaults; gc before each load; peak = max over the first call and the timed calls. Ratios divide two times of this table (same GPU, same input). Original fp16 is the authors’ own precision option, else torch.autocast. torch.compile and TensorRT: build time instead of load time. TensorRT memory (engine, not comparable) is the GPU memory the engine took, read from the driver because TensorRT allocates outside PyTorch, so it can't be compared with the PyTorch peaks of the other rows.

Other devices

DeviceBackenddtypems / callPeak memoryOutput vs referenceInput
Apple M1 Pro 16 GB MPS, torch 2.14.1, 2026-11-14Originalfp32237 1,954 MiB process–800x1344
Portablefp16105 1,954 MiB processmatches800x1344
Portablefp32125 1,995 MiB processmatches800x1344
Kernelsfp16not implemented–800x1344
NVIDIA L4 CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp1613.7 256 MiB/312 MiB–800x1344
Kernelsfp1611.8 194 MiB/232 MiB–800x1344
NVIDIA L40S CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp1610.1 256 MiB/312 MiB–800x1344
Kernelsfp168.21 195 MiB/232 MiB–800x1344
NVIDIA A10 CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp1613.1 256 MiB/312 MiB–800x1344
Kernelsfp168.64 193 MiB/232 MiB–800x1344
NVIDIA A100-SXM4-40GB CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp1610.7 256 MiB/312 MiB–800x1344
Kernelsfp168.82 193 MiB/232 MiB–800x1344
NVIDIA RTX PRO 6000 CUDA, torch 2.14.1+cu130, 2026-11-08Portablefp163.32 280 MiB/332 MiB–800x1344
Kernelsfp163.14 221 MiB/252 MiB–800x1344

CUDA memory is torch’s peak allocated / reserved; Apple has no such counter, so the Mac rows show the process footprint (weights, Python and torch included). “Output vs reference” compares the device’s output with the stored golden output under the card’s tolerance; – = not checked on that device. Kernels “not implemented” = no kernels for this model on that backend yet: it runs portable there.

Licence and weights

Commercial use allowed

Code
Apache-2.0 LICENSE
Weights
Apache-2.0 source
Training data

Our reading of the licences, not legal advice.

Weights

detr-r50-e632da11.pth 167 MB· hosted on Meta (fbaipublicfiles)

fastforks downloads and checks these files on first use (fastforks download detr-r50-coco).

Accuracy

The test set through the authors’ code and through ours: same checkpoint, same protocol. The distance between the original’s fp32 and fp16 runs is what half precision alone costs; our runs should stay within it.

COCO val2017

every 10th image, box mAP

Rundtypebox mAP ↑Δ box mAP vs fp32 originalimagesms / image
Original fp32fp3243.59 reference 500 45.7
Original fp16fp1643.53 −0.06 500 38.7
Portable fp32fp3243.56 −0.03 500 26.6
Portablefp1643.59 ±0.00 500 11.1
Kernelsfp1643.62 +0.03 500 8.63

pycocotools COCOeval of the top 100 detections per image. Original = the authors’ code, same checkpoint and protocol. Measured on original fp32, original fp16: RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-06; portable fp32: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 44640884, 2026-11-17; portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 939adfe8, 2026-11-06.

Closeness to the original

Beyond the test-set scores: the raw output of ours against the original’s fp32 output on the same input, pixel by pixel. CPU, float32: max |diff| <= 0.002 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.2 and p99 <= 1.0 (absolute error of the output boxes).

CheckToleranceMeasured
CPU fp32, max |diff|≤ 0.002 not recorded
GPU default dtypes, mean |diff|≤ 0.2 0.02003
GPU default dtypes, p99 |diff|≤ 1 0.04454

Recorded for detr-r50-coco on RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-03, with these kernels: cudnn_hacc

Details

DETR (Carion et al. 2020, Facebook): end-to-end detection with a ResNet backbone and a 6+6 layer transformer encoder-decoder over 100 object queries, no NMS; boxes, scores and COCO classes at the input size. The portable `module()` is the whole network (class logits and normalised boxes).

Input / output
Input: one RGB image. Output: boxes, class labels, scores and instance masks.
Input size
any H x W >= 32, padded to a multiple of 32; tested up to 3000x4000 (599 MiB allocated)
Options
  • score_threshold=0.050.0 to 1.0· changes the output
  • max_detections=100>= 1· changes the output
Outputs
boxes, scores, labels
Checkpoint
blocks=[3,4,6,3]
CUDA kernels
  • cudnn_haccconvolutions with fp16 accumulation (cuDNN)
Apple (MPS)
fp32, fp16
Full reference, generated from the repository

DETR (ResNet-50 and ResNet-101, COCO) from Facebook Research: end-to-end boxes and classes from 100 object queries, no NMS.

Commercial use: yes.

variantinputbackendtime (ms)peak memory (MiB, allocated / reserved)
detr-r50-cocosynthetic (800x1344)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
55.5
62.0
12.4
9.93
9.27
4.40
491 / 540
459 / 558
280 / 332
218 / 272
233 / 292
318 / 350
detr-r101-cocosynthetic (800x1344)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
78.9
80.8
18.7
13.7
14.7
6.60
564 / 634
531 / 650
316 / 368
254 / 328
272 / 330
377 / 440
Details
  • Original code: https://github.com/facebookresearch/detr at 29901c51d7fe
  • Code licence: Apache-2.0 (permissive); files: LICENSE
  • Weights licence: Apache-2.0
  • Licence evidence: https://github.com/facebookresearch/detr/blob/29901c51d7fe8712168b8d0d64351170bc0f83e0/README.md (License section)
  • Training data: COCO 2017 (train, instance annotations), ImageNet-1k (ILSVRC 2012 classification) (COCO 2017 train (500 epochs); the ResNet backbone was initialised from torchvision's ImageNet-1k model)
  • Options: score_threshold = 0.05 (0.0 to 1.0), max_detections = 100 (>= 1)
  • Kernel libraries: cudnn_hacc
  • Variants: detr-r50-coco, detr-r101-coco
  • Outputs: boxes, scores, labels; label_set: coco-80
  • Input size: any H x W >= 32, padded to a multiple of 32
  • Tested up to (portable, fp16, RTX 5060 Ti 16 GB): detr-r50-coco 3000x4000 (0.6 GiB peak allocated, 0.6 reserved); detr-r101-coco 3000x4000 (0.6 GiB peak allocated, 0.7 reserved)
  • detr-r50-coco 800x1344, first call: portable + torch.compile 22 s (cold Inductor cache), TensorRT fp16 33 s (ONNX + engine).
  • detr-r101-coco 800x1344, first call: portable + torch.compile 18 s (cold Inductor cache), TensorRT fp16 35 s (ONNX + engine).
  • detr-r50-coco original (fp32) 800x1344: incl. CPU resize + host copy (official pipeline)
  • detr-r50-coco original 800x1344: torch.autocast(fp16) around the forward; incl. CPU resize + host copy (official pipeline)
  • detr-r101-coco original (fp32) 800x1344: incl. CPU resize + host copy (official pipeline)
  • detr-r101-coco original 800x1344: torch.autocast(fp16) around the forward; incl. CPU resize + host copy (official pipeline)
  • detr-r50-coco load / first call: original 2.55 s / 0.827 s, portable 0.7 s / 0.439 s, kernels 0.28† s / 0.032 s
  • detr-r101-coco load / first call: original 0.95 s / 0.063 s, portable 0.81 s / 0.019 s, kernels 0.22† s / 0.014 s
  • † measured in the speed sweep after the portable load (or an earlier size) in the same process: file cache and kernels are warm, so the time is lower than a fresh start.
  • Protocol, median of 5 after 3 warm-up, uint8 CUDA input (synthetic for bench_inputs sizes), card defaults; gc before each load; peak = max over the first call and the timed calls

Measured

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

variantdatasetoriginal fp32original fp16portableportable fp32kernelsnote
detr-r50-cocoCOCO val2017, every 10th image, box mAP43.5943.5343.5943.5643.62
detr-r101-cocoCOCO val2017, every 10th image, box mAP44.0444.0044.1144.0544.05

Measured on portable: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 939adfe8, 2026-11-06; portable32: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 44640884, 2026-11-17; kernels: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 939adfe8, 2026-11-06.

Parity

CPU, float32: max |diff| <= 0.002 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.2 and p99 <= 1.0 (absolute error of the output boxes).

variantkernels error vs original, mean / p99GPU, torchkernels used
detr-r50-coco0.02003 / 0.04454RTX 5060 Ti, torch 2.14.1+cu130cudnn_hacc@cudnn92400
detr-r101-coco0.03227 / 0.07451RTX 5060 Ti, torch 2.14.1+cu130cudnn_hacc@cudnn92400

Example output

One fixed input through this checkpoint, the same for every model of the task (kernels · float16 · NVIDIA GeForce RTX 5060 Ti).

Input
Output
  • person 1.00
  • cell phone 0.86
Astronaut Eileen Collins, input
Input · 100%

Input: Astronaut Eileen Collins, NASA (public domain).