A stronger, transformer-based open-vocabulary detector. Better at nuanced phrases, meaningfully heavier to run.
Cross-attention between text and image regions, via Hugging Face transformers (IDEA-Research/grounding-dino-tiny). Several seconds to over a minute per image on CPU, versus sub-second for YOLO-World in Level 5 — a real compute tradeoff, not just a quality upgrade.
Latest transformers (5.x) requires torch>=2.5, which conflicts directly with this Intel Mac's torch==2.2.2 ceiling (see Environment on the Summary page). Pinned transformers==4.46.3 instead — it predates that requirement and still supports Grounding DINO. API differences between versions also required a single flat text string ("helmet. person. safety vest.") rather than the newer nested-list input format.
processor = AutoProcessor.from_pretrained("IDEA-Research/grounding-dino-tiny")
model = AutoModelForZeroShotObjectDetection.from_pretrained("IDEA-Research/grounding-dino-tiny")
text_query = "helmet. person. safety vest. electrical cabinet. hand pallet truck. cardboard box."
inputs = processor(images=image, text=text_query, return_tensors="pt")
results = processor.post_process_grounded_object_detection(
outputs, input_ids=inputs.input_ids, box_threshold=0.22, text_threshold=0.2, target_sizes=[image.size[::-1]]
)[0]
Terminal output
warehouse3.jpg -> Total objects detected: 8
hand pallet truck: 1
cardboard box wooden crate: 2
electrical cabinet: 4
cardboard box: 1
Saved annotated image as output3.jpgFor reference: Level 5's YOLO-World returned zero detections on this exact same image — same scene, two different open-vocabulary detectors, very different outcomes.