GroundingDinoModelLoader (segment anything)
GroundingDinoModelLoader (segment anything)
- GROUNDING_DINO_MODEL
This is the little loader node that feeds the text-detection half of the pack. On its own it does nothing you'd notice - it loads a GroundingDINO checkpoint into memory and hands it downstream. But GroundingDinoSAMSegment won't run without it, so if you're wiring up text-prompted masking, this is one of the two loaders you drop in first.
Why you'd reach for it
You don't reach for it so much as you can't avoid it. The whole appeal of this pack is typing "the person on the left" and getting a mask back, and GroundingDINO is the model that turns those words into bounding boxes. This node's only job is to load that model. It exists as a separate node for a good reason: loading a checkpoint is expensive, so you do it once, cache it, and reuse the loaded model across every segment call in your graph instead of paying the load cost each time.
In the wider picture, GroundingDINO is the "where is it" step of intelligent masking - our masking notes describe it as text-prompted object detection that "pairs with SAM: GroundingDINO finds the object, SAM creates a precise mask around it." This node supplies the finder.
How it works
GroundingDINO is an open-vocabulary detector: it takes an image and a text phrase and returns boxes around whatever matches, without being limited to a fixed list of classes. Under the hood it uses BERT as its text encoder - which is why the pack quietly needs bert-base-uncased downloaded too. This node reads the checkpoint file, builds the model, and outputs a handle to it. That's the entire mechanism; the actual detection happens later, inside the segment node.
The inputs and outputs that matter
There's exactly one input: model_name - a dropdown with two choices.
- GroundingDINO_SwinT_OGC (694MB) - the Swin-Tiny backbone. Smaller, faster, the sensible default. Handles the vast majority of "find the obvious object" prompts fine.
- GroundingDINO_SwinB (938MB) - the Swin-Base backbone. Bigger and a bit sharper on harder or more ambiguous detections, at the cost of more VRAM and a slower load.
Start with SwinT. Only move up to SwinB if it's genuinely missing objects that a human would spot immediately.
The single output is GROUNDING_DINO_MODEL, which wires straight into the grounding_dino_model input of GroundingDinoSAMSegment. That's the only place it goes.
How to install it
It comes with the pack - there's no separate install for the node itself. ComfyUI Manager: search segment anything (the storyicon pack), install, restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/storyicon/comfyui_segment_anything
then pip install -r requirements.txt and restart. The two GroundingDINO checkpoints auto-download the first time you pick them, or you can pre-place them in models/grounding-dino under your ComfyUI root - the README is explicit that you should keep the original filenames. The .pth weight and its .cfg.py config both need to be there.
Common issues & troubleshooting
The GroundingDINO half fails to build. This is the pack's oldest and most common snag - SAM installs clean while GroundingDINO throws errors, because GroundingDINO ships CUDA ops that sometimes have to compile locally. If this loader can't produce a model, the compile is usually where it died. It's the reason people have complained "GroundingDINO install failed" since the extension's earliest days.
Nothing in the dropdown / download stalls. If the two model names don't appear or the download hangs, drop the files into models/grounding-dino by hand from the links in the pack README. If your connection to the model host is slow, the README notes you can route the download through HTTP_PROXY/HTTPS_PROXY.
It imports but errors at runtime. storyicon's pack is old and no longer maintained, and it breaks against newer transformers (v5+). On a managed host it's pinned to a compatible environment; on a fresh local install a version clash is the likely culprit. This loader is a means to an end - the actual segmenting, tuning, and troubleshooting all happen at GroundingDinoSAMSegment, so wire this up, point it at SwinT, and move on to the node that does the work.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| model_name | COMBO | 2 options: GroundingDINO_SwinT_OGC (694MB), GroundingDINO_SwinB (938MB) |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| GROUNDING_DINO_MODEL | GROUNDING_DINO_MODEL | — |