LC Segment Anything π―
Type 'hair, eyes, bikini' and get the mask back
- image
- cutout
- mask
- raw_mask
A trained detector can only find what it was trained on. There is no bikini_yolov8.pt in the community library, and there won't be. Text-prompted segmentation is the answer for everything a face/hand/person detector doesn't cover, and this node is a clean front end for it: describe what you want in words, get a mask.
It's the second of this pack's two "get a mask" nodes - Person Mask handles anatomy, this handles arbitrary nouns.
The mechanism
Two engines, and they're genuinely different pipelines.
grounding_dino + sam is the classic Grounded SAM pair. GroundingDINO is text-prompted detection - give it "bikini" and it returns bounding boxes. SAM then turns each box into a precise mask. Two models, two downloads, both Apache-2.0, both in Hugging Face format: grounding-dino-tiny / -base into models/grounding-dino, and sam-vit-base / -large / -huge into models/sam.
sam3 is one model doing both steps, routed through ComfyUI's own SAM 3 support. SAM 3 (November 2025) added promptable concept segmentation - a short noun phrase returns masks for every matching instance at once - which is exactly the pipeline above folded into one network, and the reason SAM 3 became the masking tier everything else in this ecosystem measures against. It's also the one place in this pack where you must read the licensing: SAM and SAM 2 are Apache-2.0, SAM 3 is not - it's Meta's custom SAM License.
Your inputs
prompt is the interesting one, and it's simpler than a lot of people expect. Comma-separated words: hair, eyes, bikini. Per the author's tooltip, each word is found on its own and the results are combined. So it's not a phrase to be parsed, it's a list of independent queries unioned into one mask. That means "red dress" is more likely to misfire than dress - the word-level query is what these models are built for.
threshold (0.3, dino engine) is detection confidence. Lower finds more and more wrong things. sam3_threshold (0.5, sam3 engine) is separate because SAM 3's scores run higher - start at 0.5, and be aware that near 0.3 it starts inventing matches for words that simply aren't in the image. That failure mode is worse than a miss, because it looks like it worked.
max_objects (0 = all, dino engine only) caps how many boxes per word are kept, best first. Set it to 1 when the prompt matches five instances and you only wanted the biggest.
Model entries are all download-on-first-use and all labelled with their license. The SAM 3 entry is deliberately one-click: Meta's original facebook/sam3 repo is gated behind manual approval, so it's never downloaded for you, but the dropdown offers SAM 3.1 (1.7 GB, hosted by Comfy-Org, the same ungated copy ComfyUI's SAM 3 template uses) - or it picks up your own sam3.safetensors in models/sam3 if you already have it.
Then the refine half, which is this pack's shared matting machinery: refine (vitmatte / guided_filter / none), vitmatte_model (Apache-2.0, models/vitmatte), edge_erode / edge_dilate at 10/10 to set the uncertain band width, black_point / white_point to crush hesitation, and max_megapixels to cap the expensive matting pass.
Outputs are cutout (RGBA), mask (refined), and raw_mask (pre-refine - wire this one when you're debugging whether the detector or the refine is the problem). The node also has a before/after wipe: preview_view switches between cutout, mask and trimap, and the "before" side is the raw mask. Queue once to get it.
Where it fits
This is the mask source for anything downstream that needs a named region: inpainting a garment swap, a detail pass on a hand, a blend that only touches the jacket, a color grade on the sky. It's also the front end of the automatic-detailing loop - a promptable segmenter is a detector like any other, and ComfyUI's SAM 3 nodes advertise SEGS output for exactly that reason, which means a text query can drive a detailer with no trained detector for the thing you named.
When not to reach for it: faces. A face_yolov8 pass is faster and more reliable at finding faces than describing "a face" to an open-vocabulary model. Promptable masking wins on one-offs and on things nobody has trained a detector for.
Also worth flagging from the wider ecosystem: the SAM 3 nodes in some packs require Triton, which is a genuine obstacle on Windows. This one goes through ComfyUI's built-in SAM 3 support instead, which sidesteps that - but it does mean you need a ComfyUI recent enough to have it.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/lonecatone23/ComfyUI_LC_MaskMaker_nodes
# restart ComfyUI
Manager β search LC MaskMaker. The pack's installer only adds transformers and huggingface_hub if missing. Grounding DINO plus SAM is the heaviest first-run download in the pack; grounding-dino-tiny with sam-vit-base is the sane starting pair, and huge is the accurate-and-slow end.
Gotchas
- It found things you didn't ask for. On sam3, raise sam3_threshold toward 0.5β0.6. On dino, raise threshold. Below roughly 0.3 on SAM 3 is where words that aren't in the image start matching.
- Your
sam_vit_h_4b8939.pthisn't in the dropdown. Original-format.pthfiles use a different layout and are deliberately not listed. Use the Hugging Face-format entries. facebook/sam3won't download. It's gated - that's Meta's approval flow, not a broken node. Take the SAM 3.1 entry instead.- A multi-word prompt works worse than single words. Compounds aren't parsed as phrases; each comma-separated token is searched independently and unioned.
- Hands and hair still look rough. Same fix as everywhere in this pack: vitmatte refine, and a wider
edge_dilate.
Inputs (17)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Image to cut things out of. | |
| prompt | STRING | subject | What to select, as simple words separated by commas: hair, eyes, bikini. Each word is found on its own and the results are combined. |
| engine | COMBO | grounding_dino + sam | grounding_dino + sam: GroundingDINO finds boxes, SAM makes the masks. Apache-2.0 models, downloaded when first used. sam3: SAM 3 does both in one step (SAM License). Pick the SAM 3.1 download, or use your own sam3.safetensors in models/sam3. |
| dino_model | COMBO | Used by grounding_dino + sam. Entries marked 'Download' are fetched the first time you run. | |
| sam_model | COMBO | Used by grounding_dino + sam. base is fastest, huge is the most accurate. | |
| sam3_model | COMBO | Used by the sam3 engine. | |
| threshold | FLOAT | 0.300β1 | grounding_dino + sam: detection confidence. Lower finds more (and more wrong things), higher is pickier. |
| sam3_threshold | FLOAT | 0.500β1 | sam3: detection confidence. SAM 3 scores run higher, so 0.5 is a good start. Around 0.3 it starts inventing matches for words that are not in the image. |
| max_objects | INT | 00β64 | grounding_dino + sam only. Keep at most this many boxes per word (best first). 0 = all. |
| refine | COMBO | vitmatte | Edge refinement of the raw mask. vitmatte is best for hair, guided_filter is fast, none keeps the raw mask. |
| vitmatte_model | COMBO | Only used when refine is vitmatte. | |
| edge_erode | FLOAT | 10.00β1024 | Trimap: how far the sure-foreground is pulled in from the mask edge (pixels). |
| edge_dilate | FLOAT | 10.00β1024 | Trimap: how far the unknown band reaches out past the mask edge (pixels). |
| black_point | FLOAT | 0.0100β0.999 | Mask values at or below this become 0. |
| white_point | FLOAT | 0.9900.001β1 | Mask values at or above this become 1. |
| max_megapixels | FLOAT | 2.000.25β16 | vitmatte only. Larger images are matted at this size, then scaled back. |
| preview_view | COMBO | cutout | What the wipe on the node shows. Before is the raw mask. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| cutout | IMAGE | β |
| mask | MASK | β |
| raw_mask | MASK | β |