Nodes/Anymatix/Anymatix CLIPSeg
ComfyUI Node

Anymatix CLIPSeg

Describe the thing you want masked and get the mask — 'the cat', 'the sky', done

By Anymatix·Created about a year ago·Updated 2 days ago· 0
Anymatix CLIPSeg
  • image
  • MASK
text
blur0.0
threshold0.40
dilation_factor5

Sometimes you don't want to paint a mask or train a detector - you want to name the thing. "Segment the cat," "mask the sky," "isolate the product." AnymatixCLIPSeg is a text-prompted segmenter: give it an image and a phrase, and it returns a MASK of everything in that image matching the phrase. It's the older, lighter-weight cousin of the Grounded-SAM / SAM-3 text-prompting approach - not as smart, no open-vocabulary superpowers, but it runs on a small model, needs no separate detector, and is genuinely fine for "mask this one kind of thing" jobs.

It fits the masking-detailing loop perfectly. The automation playbook is: get a mask however you can, crop and re-render that region at higher resolution, paste it back. CLIPSeg is a respectable "get a mask however" for one-off objects that no community detector covers - a specific prop, a background element, a particular animal. It's also handy for inpainting prep: mask the thing, feed the mask to a masked img2img or inpaint node, and let the model replace or fix it.

How it works

The node loads the CLIPSeg model - specifically the CIDAS/clipseg-rd64-refined weights from Hugging Face - and downloads them to models/clip_seg on first use. Then it runs the standard trick: encode your text prompt, cross-attend against the image, sigmoid the result into a per-pixel probability, and threshold it into a hard mask. The three optional knobs are where you shape that:

  • threshold (default 0.4) - how confident a pixel must be to count as masked. Too high and you get holes; too low and the mask bleeds into the background.
  • dilation_factor (default 5) - how much to grow the mask outward after thresholding. Inpainting likes a slightly padded mask so the model has context to blend against.
  • blur (default 0) - soften the mask edges. Set it above zero when hard edges would show in the result.

Outputs a single MASK, which feeds any mask consumer: inpaint, detailers, background-removal compositing, whatever.

Install

Same pack:

cd ComfyUI/custom_nodes
git clone https://github.com/Anymatix/anymatix-comfy-nodes

then restart, or ComfyUI Manager → search "anymatix-comfy-nodes". The node pulls transformers (already a ComfyUI dependency) and downloads the CLIPSeg weights - a few hundred MB - on first run. Note this is one node in the pack that isn't fully offline-friendly: that first run wants the Hub.

Issues to expect

Honest limits: CLIPSeg is old (2022-era) and its understanding is basic. Complex phrases confuse it - "the red cup on the table" often masks more than you meant, so use short, concrete nouns. Results on difficult backgrounds need threshold tuning more often than you'd like. And it's single-image: the node segments image[0], so a batch means the first frame only. For anything CLIPSeg fumbles, Grounded-SAM or SAM-3 text prompting is the upgrade path.

CategoryAnymatix

Inputs (5)

NameTypeDefaultDescription
imageIMAGE
textSTRING
bluroptFLOAT0.00–15
thresholdoptFLOAT0.400–1
dilation_factoroptINT50–10

Outputs (1)

NameTypeDescription
MASKMASK