Batch CLIPSeg(BatchCLIPSeg)
This node technically utilizes a pre-trained CLIPSeg model to align the input text prompt with image features and calculates the relevance score of each pixel to the text.
Batch CLIP Seg
The Batch CLIPSeg node technically utilizes a pre-trained CLIPSeg model to align input text prompts with image features and calculates the relevance score between each pixel and the text.
The Batch CLIPSeg node is an image segmentation tool based on the CLIP model, capable of automatically generating corresponding masks for an image or a batch of images based on text descriptions. Its core function is to transform natural language instructions into precise selections of visual regions, enabling semantically-driven mask creation.
Node Function
This node technically utilizes a pre-trained CLIPSeg model to align input text prompts with image features and calculates the relevance score between each pixel and the text. It supports processing batch inputs of the IMAGE type, consisting of single or multiple images. It converts the relevance score map into binary or continuous masks through thresholding and optionally applies post-processing such as Gaussian blur to the masks.
Node Parameter Description - Batch CLIPSeg
Connection Inputs (Inputs)
| Parameter Name | Data Type | Required | Default Value | Value Range/Options | Description |
|---|---|---|---|---|---|
images | IMAGE | Yes | - | - | images (Input Parameter): Input image(s) or image batch to be segmented. Supports single or multiple images. |
opt_model | CLIPSEGMODEL | No | - | - | opt_model (Input Parameter): Optional external CLIPSeg model input, used to replace the default model loaded internally by the node. |
Control Parameters (Parameters)
| Parameter Name | Data Type | Required | Default Value | Value Range/Options | Description |
|---|---|---|---|---|---|
text | STRING | Yes | - | - | "sky". |
threshold | FLOAT | Yes | 0.5 | 0.0 - 10.0 (Step: 0.001) | threshold (Input Parameter): Sets the confidence threshold for segmentation; regions above this value are retained. Range 0.0 - 10.0, step 0.001. |
binary_mask | BOOLEAN | Yes | True | - | binary_mask (Input Parameter): Controls whether to binarize the mask (black and white). If false, outputs a continuous grayscale mask. |
combine_mask | BOOLEAN | Yes | False | - | combine_mask (Input Parameter): Controls whether to combine all currently generated masks into a single mask. |
use_cuda | BOOLEAN | Yes | True | - | use_cuda (Input Parameter): Controls whether to use CUDA (GPU) for accelerated computation to improve processing speed. |
blur_sigma | FLOAT | No | 0.0 | 0.0 - 100.0 (Step: 0.1) | - |
prev_mask | MASK | No | None | - | - |
image_bg_level | FLOAT | No | 0.5 | 0.0 - 1.0 (Step: 0.01) | - |
invert | BOOLEAN | No | False | - | - |
Output
| Parameter Name | Data Type | Description |
|---|---|---|
| Mask | MASK | Mask (Output Parameter): The output mask, which can be used by subsequent image processing nodes. |
| Image | IMAGE | Image (Output Parameter): The output image, typically the same as the input image, used for workflow continuity. |
Usage Scenarios
In practical applications, this node is commonly used in workflows requiring automated matting based on object or scene descriptions. For example, when batch processing product images, you can input the text "a shoe" to quickly generate precise masks of the shoes for all images containing shoes, facilitating subsequent background replacement or local adjustments.
Notes
The node's processing speed is affected by the model size and whether GPU acceleration is used. For high-resolution images or large batches, processing time may be longer. Furthermore, segmentation accuracy largely depends on the accuracy of the text description and the coverage of the model's training data.
Batch CLIPSeg Node Source Code Link
The Batch CLIPSeg node is from the ComfyUI-KJNodes node package.
Comments
Sign in with GitHub to join the discussion.