Nodes/ComfyUI Impact Pack/CLIPSegDetectorProvider
ComfyUI Node Runs on cloud

CLIPSegDetectorProvider

Detect regions by text prompt, not a trained model

By ltdrdata·Created 3 years ago·Updated 4 months ago· 3,242
CLIPSegDetectorProvider
    • BBOX_DETECTOR
    text
    blur7.0
    threshold0.40
    dilation_factor4

    Most detectors in Impact Pack need a model trained for a specific thing - a face YOLO, a hand YOLO. CLIPSeg is the odd one out: you type what you're looking for, in words, and it segments it. "shirt", "sky", "the dog", "left hand" - CLIPSeg reads the image against your text and produces a rough region for it. This node wraps that into a standard BBOX_DETECTOR so the rest of the pack can crop and detail whatever you named.

    That's genuinely useful when no off-the-shelf detector exists for your target. The tradeoff is precision: a purpose-trained YOLO will nail faces far more reliably than CLIPSeg will, but CLIPSeg will find "the red umbrella" that no YOLO was ever trained to see. Reach for it when flexibility beats accuracy.

    How it works

    CLIPSeg is a text-conditioned segmentation model. Give it an image and a phrase and it returns a heatmap of where that phrase applies, which then gets thresholded into a mask. This node runs that and packages the result as a BBOX_DETECTOR, so downstream it behaves like any other detector - feed it into a Simple Detector (SEGS) or straight into a Detailer.

    One hard requirement: it's a wrapper. The actual CLIPSeg model comes from a separate custom node (biegert's ComfyUI-CLIPSeg), and this provider does nothing without it installed.

    The inputs and outputs that matter

    • text - the phrase describing what to find. This is the whole point of the node. Keep it short and concrete; "face" beats "the person's facial features."
    • threshold (default 0.4) - how confident a pixel has to be to make it into the mask. Lower catches more (and more junk); higher is stricter and can miss parts of the target. This is your main tuning dial when the mask is too big or too small.
    • dilation_factor (default 4) - grows the mask outward so you catch the edges of the region, not just its core.
    • blur (default 7) - softens the mask boundary.

    The output is BBOX_DETECTOR, wired into a detailer or Simple Detector node.

    How to install it

    Two installs, and people forget the second one.

    1. Impact Pack - via ComfyUI Manager (search ComfyUI Impact Pack, Install, restart), or manually:
      cd ComfyUI/custom_nodes
      git clone https://github.com/ltdrdata/ComfyUI-Impact-Pack comfyui-impact-pack
      cd comfyui-impact-pack
      pip install -r requirements.txt
      
    2. ComfyUI-CLIPSeg - the node extension that provides the model. Without it, this provider can't run. Install it through Manager too, then restart.

    Common issues & troubleshooting

    The node errors or won't run. You're missing the ComfyUI-CLIPSeg extension. The README is explicit that this is a wrapper and needs it - installing Impact Pack alone isn't enough.

    The mask grabs way too much (or too little). Tune threshold first. Too much junk in the mask, raise it; missing chunks of the target, lower it. Then adjust dilation_factor to tighten or expand the edges.

    Detection is vague or inconsistent. That's CLIPSeg being CLIPSeg - it's a text-similarity segmenter, not a precision detector. Simplify the phrase, or if you're detailing something a trained model exists for (faces, hands, people), use the YOLO detector from the Impact Subpack instead; it'll be far steadier.

    CategoryImpactPack/Util

    Inputs (4)

    NameTypeDefaultDescription
    textSTRINGEnter the targets to be detected, separated by commas
    blurFLOAT7.00–15Blurs the detected mask
    thresholdFLOAT0.400–1Detects only areas that are certain above the threshold.
    dilation_factorINT40–10Dilates the detected mask.

    Outputs (1)

    NameTypeDescription
    BBOX_DETECTORBBOX_DETECTOR