Nodes/lf-nodes/Load CLIPSeg model
ComfyUI Node

Load CLIPSeg model

Load CLIPSeg, the 'make a mask from a sentence' model

By lucafoscili·Created 2 years ago·Updated 6 days ago· 35
Load CLIPSeg model
  • ui_widget
  • processor
  • model
folderclip_vision
model_idCIDAS/clipseg-rd64-refined

Some masks you can paint. Some you'd rather describe. LF_LoadCLIPSegModel is the loader for the CLIPSeg family - the zero-shot text-to-mask models that turn "give me a mask of the person" into an actual mask, no box-drawing, no SAM click-loop. It's the configuration node that feeds the other half of the pair, LF_CreateMask, which is where the prompt goes in and the mask comes out.

CLIPSeg is the same family of targeted masking that the background-removal playbook calls "GroundingDINO for the box, SAM for the mask" - except CLIPSeg skips the box entirely and predicts the segmentation from text directly. It's lighter and less precise than the DINO+SAM chain, but for "mask the foreground person" or "mask just the red car" it's often enough, and it's a single model rather than two.

How it works

Two inputs:

  • model_id (default CIDAS/clipseg-rd64-refined) - the HuggingFace model to pull. The default is the standard general-purpose CLIPSeg; it's small (tens of MB) and downloads on first load.
  • folder (default clip_vision) - which ComfyUI folder the model is saved into, via the standard folder_paths mechanism. Keep it inside the ComfyUI directory or the loader can't resolve it.

The node checks whether the model is already cached and skips the download if so. Outputs are the two objects LF_CreateMask needs: processor (the CLIPSegProcessor) and model (the segmentation model), wired into that node's processor and model inputs respectively.

Installing it

Part of the lf-nodes pack, so the install is the pack install:

cd ComfyUI/custom_nodes
git clone https://github.com/lucafoscili/lf-nodes

restart ComfyUI (or ComfyUI Manager → "LF Nodes"). The dependency that matters here is transformers, which the pack already lists in its requirements. The model itself is small - a quick first-run download, nothing like the multi-GB tagger or checkpoint downloads you'll see elsewhere in the suite.

Troubleshooting

  • "Folder must be in the ComfyUI directory" - keep folder set to a real ComfyUI folder like clip_vision or models/clip_vision; it has to resolve through ComfyUI's own folder system.
  • First load slow - that's the HF download. One time, then cached.
  • Masks that don't look right - that's usually the thresholding in LF_CreateMask, not the model. Head over there and try otsu mode before blaming the load.
Category✨ LF Nodes/Configuration

Inputs (3)

NameTypeDefaultDescription
folderSTRINGclip_visionFolder to download the model to. This folder must be in the ComfyUI directory.
model_idSTRINGCIDAS/clipseg-rd64-refinedHuggingFace CLIPSeg model ID.
ui_widgetoptLF_CODE[object Object]

Outputs (2)

NameTypeDescription
processorCLIP_PROCESSORCLIPSeg processor.
modelCLIP_MODELCLIPSeg model.