Models · Object detection

Grounding DINO and MM-Grounding-DINO (open-vocabulary, Swin-T and Swin-B)

IDEA Research's Grounding DINO and OpenMMLab's MM-Grounding-DINO (tiny, base; Swin backbone, BERT text encoder): open-vocabulary detector, finds boxes for class names given as text at call time (default: the 80 COCO classes). Apache-2.0 code and weights.

experimental Fork of huggingface/transformers@c4c4605 · backends: portable, kernels

Checkpoint

Paper 2023 Added in 0.2.0 Evaluated with 0.2.0

Portable, RTX 5060 Ti 16 GB 138 ms 800x1344, fp16
vs the faster original 1.4× original fp16: 199 ms
Peak memory 1,404 MiB original: 2,541 MiB
Accuracy vs original fp32 +0.06 portable box mAP, COCO val2017 (51.08 original)

Use it

pip install fastforks

Lean install with only what this model needs: pip install "fastforks-core[transformers]"

from fastforks import detection

model = detection.load("grounding-dino-tiny")  # 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 grounding-dino-tiny

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 fp16Peak memory
allocated / reserved
Load (s)First call (s)
Original fp32fp32not measured ––––
Original fp16torch.autocast(float16) around the call; transformers GroundingDinoForObjectDetection + processor (CPU), coco-80 caption, text tower per callfp16 199–2,541 MiB/2,716 MiB1.40.34
Portable fp32fp32not measured ––––
Portablefp16 1381.4×1,404 MiB/1,468 MiB3.00.51
Kernelsnot measured ––––
Portable + torch.compile 1111.8×2,550 MiB/2,664 MiB73 (build)–
TensorRTplanned for 0.2.1fails––––

Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-11-12. First call, 3 warm-up, peak reset, median of 3 rounds x median of 5. 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-13Originalfp32912 4,899 MiB process–800x1344
Portablefp32846 4,787 MiB processmatches800x1344
Kernelsfp32not implemented–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
Weights
Apache-2.0 source
Training data

Our reading of the licences, not legal advice.

Weights

gdino-tiny.config.json 1.6 KB· hosted on Hugging Face
gdino-tiny.model.safetensors 689 MB· hosted on Hugging Face
bert-uncased.vocab.txt 232 KB· hosted on Hugging Face

fastforks downloads and checks these files on first use (fastforks download grounding-dino-tiny).

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 fp32fp3251.08 reference 500 –
Original fp16fp1651.16 +0.08 500 –
Portable fp32fp3251.12 +0.04 500 –
Portablefp1651.14 +0.06 500 –
Kernelsnot measured

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-12; portable fp32: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 9e3ff83d+dir, 2026-11-17; portable: RTX 5060 Ti, torch 2.14.1+cu130, fastforks a981ff86, 2026-11-12.

COCO val2017

all 5000 images, box mAP

Rundtypebox mAP ↑Δ box mAP vs fp32 originalimagesms / image
Original fp32fp3248.25 reference 5000 –
Original fp16not measured
Portable fp32not measured
Portablefp1648.25 ±0.00 5000 –
Kernelsnot measured

pycocotools COCOeval of the top 100 detections per image. Original = the authors’ code, same checkpoint and protocol. Measured on original fp32: RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-12; portable: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 84ba91d4, 2026-11-12.

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.25 and p99 <= 0.8 (absolute error of the output boxes).

CheckToleranceMeasured
CPU fp32, max |diff|≤ 0.002 not recorded
GPU default dtypes, mean |diff|≤ 0.25 0.12884
GPU default dtypes, p99 |diff|≤ 0.8 0.53156

Recorded for grounding-dino-tiny on RTX 5060 Ti, torch 2.10.0+cu130, 2026-11-17, with these kernels: msda

Details

Grounding DINO (Liu et al. 2023, IDEA Research): open-set detection that fuses a Swin image backbone with a BERT text encoder in a DINO-style deformable transformer; each of 900 queries scores every caption token. MM-Grounding-DINO (Zhao et al. 2024, OpenMMLab) is the same network with a scaled, biased contrastive class head and unshared decoder heads, retrained on Objects365, GoldG and V3Det. Pass `text=[...]` at call time (default: the 80 COCO class names), joined into one caption; a class score is the mean token score of its name. Images are resized to 800 px on the short side (at most 1333 on the long side). The portable `module()` is the image side with the COCO caption's text features as constants.

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 (1,373 MiB allocated)
Options
  • score_threshold=0.250.0 to 1.0· changes the output
  • max_detections=100>= 1· changes the output
Outputs
boxes, scores, labels
CUDA kernels
  • msda
Apple (MPS)
fp32

Limitations

  • Requires the optional transformers library (the network is its `GroundingDinoForObjectDetection`).
  • The original in the benchmarks and goldens is the Hugging Face transformers 5.19.0 port with the authors' weights (IDEA-Research/grounding-dino-*, openmmlab-community/mm_grounding_dino_*); the official GroundingDINO and mmdetection code (their CUDA deformable-attention ops) was not run.
  • Class names are joined into one caption of at most 256 tokens (about 100 short names); a longer list raises an error instead of being split into several passes.
  • No phrase output: `labels` index into the given names (the token-level text threshold of the Hugging Face post-processing is not used).
  • grounding-dino-base was trained with COCO (and RefCOCO, ODinW) data: its COCO numbers are not zero-shot.
Full reference, generated from the repository

IDEA Research's Grounding DINO and OpenMMLab's MM-Grounding-DINO (tiny, base; Swin backbone, BERT text encoder): open-vocabulary detector, finds boxes for class names given as text at call time (default: the 80 COCO classes). Apache-2.0 code and weights.

Commercial use: yes.

variantinputbackendtime (ms)peak memory (MiB, allocated / reserved)
grounding-dino-tinysynthetic (800x1344)original
portable
kernels
portable + torch.compile
TensorRT fp16
199
138
–
111
planned for 0.2.1
2541 / 2716
1404 / 1468
–
2550 / 2664
–
grounding-dino-basesynthetic (800x1344)original
portable
kernels
portable + torch.compile
TensorRT fp16
230
160
–
131
planned for 0.2.1
2895 / 3094
1525 / 1624
–
2669 / 2800
–
mm-grounding-dino-tinysynthetic (800x1344)original
portable
kernels
portable + torch.compile
TensorRT fp16
202
138
–
111
planned for 0.2.1
2541 / 2716
1405 / 1470
–
2555 / 2666
–
mm-grounding-dino-basesynthetic (800x1344)original
portable
kernels
portable + torch.compile
TensorRT fp16
232
160
–
132
planned for 0.2.1
2895 / 3094
1525 / 1624
–
2669 / 2800
–
Details
  • Original code: https://github.com/huggingface/transformers at c4c4605f9618
  • Code licence: Apache-2.0 (permissive); files:
  • Weights licence: Apache-2.0
  • Licence evidence: https://huggingface.co/IDEA-Research/grounding-dino-tiny/blob/a2bb814dd30d776dcf7e30523b00659f4f141c71/README.md
  • Training data: Objects365 (train, box annotations) (Grounding DINO-T: Objects365, GoldG (Flickr30k Entities + GQA / Visual Genome images) and Cap4M (web image-caption pairs with pseudo-boxes); GoldG and Cap4M have no dataset id here (paper arXiv:2303.05499 table 2; the authors' model table).)
    • grounding-dino-base: COCO 2017 (train, instance annotations), Objects365 (train, box annotations) (Grounding DINO-B: COCO, Objects365, GoldG (Flickr30k Entities + GQA / Visual Genome images), Cap4M (web image-caption pairs with pseudo-boxes), OpenImages, ODinW-35 and RefCOCO; only COCO and Objects365 have dataset ids here (the authors' model table, github.com/IDEA-Research/GroundingDINO README).)
    • mm-grounding-dino-tiny: Objects365 (train, box annotations) (MM-Grounding-DINO-T (o365v1_goldg_v3det): Objects365 v1, GoldG (Flickr30k Entities + GQA / Visual Genome images) and V3Det; no COCO, so its COCO numbers are zero-shot (mmdetection configs/mm_grounding_dino README; paper arXiv:2401.02361).)
    • mm-grounding-dino-base: Objects365 (train, box annotations) (MM-Grounding-DINO-B (o365v1_goldg_v3det): Objects365 v1, GoldG (Flickr30k Entities + GQA / Visual Genome images) and V3Det; no COCO, so its COCO numbers are zero-shot (mmdetection configs/mm_grounding_dino README; paper arXiv:2401.02361).)
  • Options: score_threshold = 0.25 (0.0 to 1.0), max_detections = 100 (>= 1)
  • Kernel libraries: msda
  • Variants: grounding-dino-tiny, grounding-dino-base, mm-grounding-dino-tiny, mm-grounding-dino-base
  • Not in this release (planned for 0.2.1): grounding-dino-tiny ONNX / TensorRT export: the ONNX converter has no decomposition for aten._is_all_true; grounding-dino-base kernels: the pinned upstream CPU model and portable runner both exceed the existing Base box tolerance; grounding-dino-base ONNX / TensorRT export: the ONNX converter has no decomposition for aten._is_all_true; mm-grounding-dino-tiny ONNX / TensorRT export: the ONNX converter has no decomposition for aten._is_all_true; mm-grounding-dino-base ONNX / TensorRT export: the ONNX converter has no decomposition for aten._is_all_true
  • 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): grounding-dino-tiny 3000x4000 (1.3 GiB peak allocated, 1.5 reserved); grounding-dino-base 3000x4000 (1.5 GiB peak allocated, 1.7 reserved); mm-grounding-dino-tiny 3000x4000 (1.3 GiB peak allocated, 1.5 reserved); mm-grounding-dino-base 3000x4000 (1.5 GiB peak allocated, 1.7 reserved)
  • grounding-dino-tiny 800x1344, first call: portable + torch.compile 73 s (cold Inductor cache).
  • grounding-dino-base 800x1344, first call: portable + torch.compile 98 s (cold Inductor cache).
  • mm-grounding-dino-tiny 800x1344, first call: portable + torch.compile 71 s (cold Inductor cache).
  • mm-grounding-dino-base 800x1344, first call: portable + torch.compile 105 s (cold Inductor cache).
  • grounding-dino-tiny original 800x1344: torch.autocast(float16) around the call; transformers GroundingDinoForObjectDetection + processor (CPU), coco-80 caption, text tower per call
  • grounding-dino-base original 800x1344: torch.autocast(float16) around the call; transformers GroundingDinoForObjectDetection + processor (CPU), coco-80 caption, text tower per call
  • mm-grounding-dino-tiny original 800x1344: torch.autocast(float16) around the call; transformers MMGroundingDinoForObjectDetection + processor (CPU), coco-80 caption, text tower per call
  • mm-grounding-dino-base original 800x1344: torch.autocast(float16) around the call; transformers MMGroundingDinoForObjectDetection + processor (CPU), coco-80 caption, text tower per call
  • grounding-dino-tiny load / first call: original 4.06 s / 1.176 s, portable 3.01 s / 0.508 s
  • grounding-dino-base load / first call: original 4.16 s / 0.989 s, portable 3.29 s / 0.527 s
  • mm-grounding-dino-tiny load / first call: original 4.17 s / 0.99 s, portable 3.26 s / 0.517 s
  • mm-grounding-dino-base load / first call: original 4.1 s / 1.029 s, portable 3.33 s / 0.527 s
  • Protocol, first call, 3 warm-up, peak reset, median of 3 rounds x median of 5

Measured

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

variantdatasetoriginal fp32original fp16portableportable fp32note
grounding-dino-tinyCOCO val2017, every 10th image, box mAP51.0851.1651.1451.12
grounding-dino-tinyCOCO val2017, all 5000 images, box mAP48.2548.25
grounding-dino-baseCOCO val2017, every 10th image, box mAP55.6755.7355.7257.13
mm-grounding-dino-tinyCOCO val2017, every 10th image, box mAP51.49
mm-grounding-dino-tinyCOCO val2017, every 20th image, box mAP55.1854.92
mm-grounding-dino-baseCOCO val2017, every 10th image, box mAP53.01
mm-grounding-dino-baseCOCO val2017, every 20th image, box mAP57.1156.94

Measured on portable: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 84ba91d4 / a981ff86 / aee4b565, 2026-11-12 to 2026-11-13; portable32: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 9e3ff83d+dirty, 2026-11-17.

Parity

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

variantkernels error vs original, mean / p99GPU, torchkernels used
grounding-dino-tiny0.12884 / 0.53156RTX 5060 Ti, torch 2.10.0+cu130msda@7db8a6f4e515:sm_120
grounding-dino-baseno kernels backend--
mm-grounding-dino-tiny0.08186 / 0.19259RTX 5060 Ti, torch 2.10.0+cu130msda@7db8a6f4e515:sm_120
mm-grounding-dino-base0.08714 / 0.23686RTX 5060 Ti, torch 2.10.0+cu130msda@7db8a6f4e515:sm_120

Limitations

  • Requires the optional transformers library (the network is its GroundingDinoForObjectDetection).
  • The original in the benchmarks and goldens is the Hugging Face transformers 5.19.0 port with the authors' weights (IDEA-Research/grounding-dino-, openmmlab-community/mm_grounding_dino_); the official GroundingDINO and mmdetection code (their CUDA deformable-attention ops) was not run.
  • Class names are joined into one caption of at most 256 tokens (about 100 short names); a longer list raises an error instead of being split into several passes.
  • No phrase output: labels index into the given names (the token-level text threshold of the Hugging Face post-processing is not used).
  • grounding-dino-base was trained with COCO (and RefCOCO, ODinW) data: its COCO numbers are not zero-shot.

Example output

No example rendered for this checkpoint yet.