Nodes/ComfyUI-RMBG/Segmentation V1 (RMBG)
ComfyUI Node Runs on cloud

Segmentation V1 (RMBG)

Segment / Segmentation V1 (RMBG)

By 1038lab·Created 2 years ago·Updated 7 days ago· 2,051
Segmentation V1 (RMBG)
  • image
  • background_color
  • IMAGE
  • MASK
  • MASK_IMAGE
prompt
sam_model
dino_model
threshold0.30
mask_blur0
mask_offset0
invert_outputfalse
backgroundAlpha

Segment is the original text-prompted object picker in this pack - the "type a word, get a mask" node, version one. It's the classic combo: GroundingDINO reads your text and finds where the thing is, then SAM (Meta's first Segment Anything model) cuts a precise mask around it. Say cat, dog in tag style or a person wearing a red jacket in natural language, and it returns a mask of that object. This is targeted selection for inpainting, regional edits, and compositing - not background removal, which RMBG or BiRefNet handle better.

The mechanism is worth understanding because it explains the two model dropdowns. GroundingDINO is a text-to-box detector; SAM is a box-to-mask segmenter. Neither does the whole job alone, so this node chains them. That's the same architecture the SAM2 and SAM3 nodes use - this is just the first, original-SAM generation of it.

Inputs that matter: prompt is your query, and it takes both tag-style (cat, dog) and full sentences. sam_model picks the SAM checkpoint - you've got the standard sam_vit_h (2.56GB, best), sam_vit_l, and sam_vit_b (375MB, lightest), plus the sam_hq_ variants which are the high-quality fork that gives cleaner edges for a similar size. If you're masking hair or fine detail, the HQ ones are usually worth it. dino_model is the detector: GroundingDINO_SwinT_OGC (694MB, default) or GroundingDINO_SwinB (938MB) for harder scenes. threshold (0.05–0.95, default 0.3) is detection confidence - roughly 0.25–0.35 to catch things broadly, 0.45–0.55 when you want it to be picky. Then the finishers: mask_blur, mask_offset, invert_output, and background / background_color. Outputs are the standard IMAGE, MASK, and MASK_IMAGE; the MASK is what you feed onward.

Install like the rest of the pack: "Comfyui-RMBG" in ComfyUI Manager, or cd ComfyUI/custom_nodes && git clone https://github.com/1038lab/ComfyUI-RMBG, then pip install -r requirements.txt and restart. The SAM checkpoints download to ComfyUI/models/SAM/ and GroundingDINO to ComfyUI/models/grounding-dino/ on first use - so the first run of a given model pair is slow while it fetches, then cached.

The gotcha to expect: a 401 error initializing GroundingDINO. This is the pack's most common stumble and it's not a real auth problem - the repos are public and pull anonymously. A stale Hugging Face token is what's breaking it. Delete %USERPROFILE%\.cache\huggingface\token (and .huggingface\token if present), unset any HF_TOKEN env var, re-run, done.

Honest take: this V1 node still works, but there's little reason to reach for it over SegmentV2 (same SAM+DINO combo, better defaults and batch support) or the SAM2/SAM3 nodes (newer segmenters). If you're starting fresh, start with SegmentV2 or SAM2Segment. Where V1 earns its keep is the SAM-HQ checkpoints in its dropdown, which are a nice option for edge quality, and simple familiarity if you already have a workflow built on it. And the standing reminder for all of these: if all you need is the foreground cut out, don't wire up SAM and GroundingDINO to do it - that's a heavy detector stack for a job RMBG does in one model. Keep Segment for when you genuinely need one named object, not the whole subject.

Category🧪AILab/🧽RMBG

Inputs (10)

NameTypeDefaultDescription
imageIMAGE
promptSTRINGEnter the object or scene you want to segment. Use tag-style or natural language for more detailed prompts.
sam_modelCOMBO6 options: sam_vit_h (2.56GB), sam_vit_l (1.25GB), sam_vit_b (375MB), sam_hq_vit_h (2.57GB), sam_hq_vit_l (1.25GB), sam_hq_vit_b (379MB)
dino_modelCOMBO2 options: GroundingDINO_SwinT_OGC (694MB), GroundingDINO_SwinB (938MB)
thresholdoptFLOAT0.300.05–0.95Adjust mask detection strength (higher = more strict)
mask_bluroptINT00–64Apply Gaussian blur to mask edges (0 = disabled)
mask_offsetoptINT0-64–64Expand/Shrink mask boundary (positive = expand, negative = shrink)
invert_outputoptBOOLEANfalseInvert the mask output
backgroundoptCOMBOAlpha2 options: Alpha, Color
background_coloroptCOLORCODE#222222Choose background color (Alpha = transparent)

Outputs (3)

NameTypeDescription
IMAGEIMAGE
MASKMASK
MASK_IMAGEIMAGE