Nodes/◧ AP ClipSEG Mask Light/◧ AP CLIPSeg Text Mask
ComfyUI Node

◧ AP CLIPSeg Text Mask

Generates a segmentation mask from a text prompt using CLIPSeg. Works with numpy 2.x. prompt: Main text description of the region to segment, e.g. 'face' or 'person'. Separate multiple prompts with '|' to average their heatmaps: e.g. 'face | head | eyes' threshold: Sigmoid-normalised heatmap value above which a pixel is considered foreground. Lower = larger mask, higher = tighter mask. smooth_radius: Gaussian blur applied to the heatmap before thresholding. Helps produce cleaner soft edges. 0 = no smoothing. model: clipseg_rd64 – higher quality, ~350 MB download, slower clipseg_rd16 – faster, ~100 MB, slightly lower quality device: auto = use cuda when available, else cpu. Models are cached in memory so subsequent frames do not reload weights. unload_after_run: Free the model from memory after each execution. Enable to save VRAM when this node is not used every frame.

By adampolczynski·Created 5 months ago·Updated 5 months ago· 1
◧ AP CLIPSeg Text Mask
  • image
  • mask
promptface
threshold0.40
smooth_radius4
soft_masktrue
invertfalse
modelclipseg_rd64
mask_dilate0
mask_blur0
deviceauto
unload_after_runfalse
CategoryAP ClipSEG Light

Inputs (11)

NameTypeDefaultDescription
imageIMAGE
promptSTRINGfaceText description of the region to mask. Use '|' to separate multiple prompts.
thresholdFLOAT0.400.01–0.99Sigmoid heatmap threshold. Lower → larger mask, higher → tighter mask.
smooth_radiusINT40–32Gaussian blur radius applied to the heatmap before thresholding.
soft_maskBOOLEANtrueTrue = output the smoothed sigmoid heatmap (soft/feathered edges). False = hard binary mask at the threshold value.
invertBOOLEANfalseInvert the output mask.
modelCOMBOclipseg_rd64CLIPSeg variant. rd64 = better quality, rd16 = faster.
mask_dilateINT00–64Dilate (expand) the final mask by this many pixels. 0 = off.
mask_blurINT00–64Gaussian blur applied to the final mask. 0 = off.
deviceCOMBOautoCompute device. 'auto' uses CUDA when available.
unload_after_runoptBOOLEANfalseUnload the model from memory after each run to free VRAM.

Outputs (1)

NameTypeDescription
maskMASK