Run ComfyUI Easily with InstaSD

Skip the complex setup. InstaSD helps creative professionals build workflows and deploy them to the world:

  • One-click deployment
  • Any model, any node
  • Powerful GPUs for rapid iteration
Get Started

Available Nodes

BatchCLIPSeg

BatchCLIPSeg Node Documentation

Overview

The BatchCLIPSeg node is a component of the ComfyUI-KJNodes package designed to perform image segmentation using a model called CLIPSeg. It processes image data with text prompts to generate binary or fuzzy masks, which are useful in various image editing and processing tasks within ComfyUI workflows. The node has the capability to handle batches of images, making it scalable and efficient for large projects.

Functionality

The node utilizes a model named CLIPSeg to segment images based on input text prompts. It outputs masks that highlight relevant regions in images, which can be further used for various image processing tasks, such as masking, blending, or other manipulations.

Inputs

The BatchCLIPSeg node accepts the following inputs:

  • Images: A batch of images that need to be segmented.
  • Text: A string input that provides a description or context for the segmentation model to identify regions of interest in the images.
  • Threshold: A float defining the segmentation sensitivity. Ranges from 0.0 to 10.0, with a default of 0.5.
  • Binary Mask: A boolean indicating whether the output mask should be binary. Default is True.
  • Combine Mask: A boolean to determine whether to combine multiple masks into one. Default is False.
  • Use CUDA: A boolean to specify if the model should utilize CUDA for processing, potentially enhancing speed. Default is True.

Additionally, the node can take the following optional inputs:

  • Blur Sigma: A float defining the Gaussian blur's sigma applied to the mask for smoothing. Ranges from 0.0 to 100.0, with a default of 0.0.
  • Opt Model: A CLIPSeg model to be optionally loaded if custom models are intended for use.
  • Prev Mask: An optional input mask that can be combined with the currently generated mask.
  • Image BG Level: A float to determine the background level of the image when combined with the mask, ranging from 0.0 to 1.0. Default is 0.5.
  • Invert: A boolean to invert the generated mask. Default is False.

Outputs

The node outputs two key components:

  • Mask: The generated mask based on the provided inputs. It can be binary or have varying levels of transparency depending on settings.
  • Image: The original image batch with the mask applied. The mask is used to blend the image with a specified background level.

Usage in ComfyUI Workflows

The BatchCLIPSeg node is particularly useful in workflows where batch processing and segmentation are required. It supports the application of masks to large collections of images based on textual descriptions, which can drive further image modifications, such as applying effects to only masked regions or isolating certain parts of images for compositing.

  1. Image Editing: Users can use this node to create specific masks based on textual descriptions to enhance, alter or hide portions of images.
  2. Batch Processing: Efficiently process large image datasets by using consistent prompts to generate outcome masks.
  3. Integration: Integrate seamlessly with other nodes in ComfyUI to implement complex image operations, utilizing the resultant masks.

Special Features and Considerations

  • CUDA Support: Enables hardware acceleration, making it suitable for high-performance workflows.
  • Model Offloading: Automatically manages model loading, which is crucial for memory management during batch processing.
  • Inversion and Combination: Supports mask inversion and combination with previous masks, offering flexible use scenarios.
  • Blur Capability: Can blur masks for smoother transitions, crucial for visually compelling results.

By thoughtfully leveraging these features, complex image processing tasks can be efficiently handled within the ComfyUI environment. The BatchCLIPSeg node is versatile, catering to users looking for advanced segmentation capabilities in their image-based workflows.