DETR (ResNet-50 / ResNet-101) (fastforks)
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).
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/facebookresearch/detr at 29901c51d7fe.
Task: detection. Tier: stable. Outputs: boxes, scores, labels. 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 |
|---|---|---|---|---|
detr-r101-coco@1 |
detr-r101-2c7b67e5.pth | 2c7b67e52d2e |
Apache-2.0 | yes |
detr-r50-coco@1 |
detr-r50-e632da11.pth | e632da11ec76 |
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), ImageNet-1k (ILSVRC 2012 classification) (COCO 2017 train (500 epochs); the ResNet backbone was initialised from torchvision's ImageNet-1k model).
Licence evidence: https://github.com/facebookresearch/detr/blob/29901c51d7fe8712168b8d0d64351170bc0f83e0/README.md (License section)
Input size
any H x W >= 32, padded to a multiple of 32
Tested up to (portable, fp16, RTX 5060 Ti 16 GB): detr-r101-coco 3000x4000 (0.6 GiB peak allocated, 0.7 reserved); detr-r50-coco 3000x4000 (0.6 GiB peak allocated, 0.6 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 |
|---|---|---|---|---|---|---|---|---|---|
detr-r101-coco |
78.9 | 80.8 | 18.7 | 13.7 | 5.8x | 1.4x | 531 / 650 | 316 / 368 | 254 / 328 |
detr-r50-coco |
55.5 | 62.0 | 12.4 | 9.93 | 5.6x | 1.2x | 459 / 558 | 280 / 332 | 218 / 272 |
Startup and first call
| model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
|---|---|---|---|---|---|---|
detr-r101-coco |
0.95 | 0.81 | 0.22โ | 0.06 | 0.02 | 0.01 |
detr-r50-coco |
2.55 | 0.70 | 0.28โ | 0.83 | 0.44 | 0.03 |
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) |
|---|---|---|---|---|---|---|---|---|---|---|---|
detr-r101-coco |
800x1344 | 18.7 ms | 14.7 ms | 6.60 ms | 13.7 ms | 17.7 s | 35.0 s | 316 / 368 | 272 / 330 | 254 / 328 | 377 / 440 |
detr-r50-coco |
800x1344 | 12.4 ms | 9.27 ms | 4.40 ms | 9.93 ms | 21.7 s | 33.4 s | 280 / 332 | 233 / 292 | 218 / 272 | 318 / 350 |
Fixed-size speed and peak memory, all models
| model | mode | 480x640 | 720x1280 | 1080x1920 | 12 MP 3000x4000 |
|---|---|---|---|---|---|
detr-r101-coco |
portable | 14.4 ms / 278 / 332 | 17.6 ms / 307 / 356 | 18.3 ms / 320 / 416 | 23.8 ms / 636 / 676 |
detr-r101-coco |
kernels | 10.5 ms / 228 / 278 | 13.0 ms / 248 / 294 | 13.3 ms / 262 / 354 | 19.8 ms / 637 / 678 |
detr-r50-coco |
portable | 9.5 ms / 241 / 296 | 11.6 ms / 270 / 320 | 12.2 ms / 283 / 380 | 18.7 ms / 599 / 640 |
detr-r50-coco |
kernels | 7.7 ms / 191 / 240 | 8.9 ms / 211 / 256 | 9.8 ms / 225 / 316 | 16.7 ms / 600 / 640 |
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 |
|---|---|---|---|---|---|---|
detr-r50-coco |
COCO val2017, every 10th image, box mAP | 43.59 | 43.53 | 43.59 | 43.62 | |
detr-r101-coco |
COCO val2017, every 10th image, box mAP | 44.04 | 44.00 | 44.11 | 44.05 |
Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 939adfe8, 2026-11-06.
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.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).
Usage
from fastforks import detection
model = detection.load("detr-r101-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: detr-r101-coco, detr-r50-coco.
Kernels backend
detection.load("detr-r101-coco", mode="kernels") runs our CUDA kernels (cudnn_hacc). 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.