﻿# Grounding DINO: preserve the link between text phrases and image boxes

Interpret Grounding DINO text-conditioned detections with the correct phrase extraction, score thresholds and target image dimensions during postprocessing.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-grounding-dino-phrase-box-postprocessing/
Language: en

## Define the object in language

Grounding DINO accepts human descriptions to find objects beyond a fixed class list. The [original paper](https://arxiv.org/abs/2303.05499) connects a detector with grounded language pretraining. An application must still define what it asks for. A broad category, an attribute-rich phrase and a relational description can pose different localization questions even when they refer to the same visible object in a demonstration image.

## Preserve the exact text input

The [official implementation](https://github.com/IDEA-Research/GroundingDINO) explains text-based detection and the relationship between words and predicted boxes. Save the actual prompt after any application normalization. A UI label is not necessarily the string delivered to the tokenizer. Changing punctuation, category wording or a multilingual translation can change the query being evaluated; keep those changes visible when investigating a detection that appeared or disappeared.

## Keep box and phrase thresholds distinct

The [Transformers processor](https://huggingface.co/docs/transformers/model_doc/grounding-dino) exposes detection filtering and text-related filtering in postprocessing. These controls do different work. A retained box does not mean that every word in a long input phrase is supported equally. Inspect the resulting text labels alongside the coordinates and scores. Do not assign a class identifier by assuming the output label is always the complete original prompt string.

## Restore boxes to the intended canvas

Postprocessing needs the target image dimensions to produce boxes in the desired coordinate system. Preserve the correspondence between each batched image and its target size. A transposed width and height can produce plausible numeric values but visibly misplaced detections. If the application crops or tiles images before inference, map boxes through that additional transformation before combining results on the original image or comparing them with reference annotations.

## Test localization and naming separately

A product-search pilot should include a correct box with an ambiguous phrase, an absent category and several similar objects. Evaluate whether the intended region was found and whether the returned wording is usable by the application. [Object detection dataset scope](/journal/data-guide-objects365-detection-domain/) and [image orientation](/journal/data-guide-image-exif-box-coordinate/) provide useful background. Neither substitutes for preserving the text-to-box correspondence, which is the distinctive contract of a grounded detector.
