Run ComfyUI Easily with InstaSD

Skip the complex setup and run ComfyUI online. 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

A set of nodes for ComfyUI that can composite layer and mask to achieve Photoshop like functionality.

Available Nodes

LayerMask: SegformerB2ClothesUltra

Documentation for LayerMask: Segformer B2 Clothes Ultra

Overview

The LayerMask: Segformer B2 Clothes Ultra node is a component of the ComfyUI system, designed for image segmentation tasks specifically targeting clothing segmentation. It leverages the Segformer architecture to create masks that distinguish different clothing items within an image, as well as accessories and body parts. This node can be used to separate various elements in an image based on their semantic categories, allowing for more detailed image editing and manipulation.

Functionality

This node utilizes a pretrained Segformer model to segment an image into distinct regions. The segmentation process categorizes each pixel in the image into one of several predefined labels such as hat, hair, upper clothes, and more. This segmentation can be used to apply further processing, like image enhancements or modifications, on specific parts of the image while leaving others unchanged.

Inputs

The LayerMask: Segformer B2 Clothes Ultra node accepts the following inputs:

  • Image: The primary image input which is to be processed.
  • Boolean Toggles: A series of boolean inputs corresponding to image categories like face, hair, hat, sunglasses, upper clothes, skirt, pants, dress, belt, shoe, left leg, right leg, left arm, right arm, bag, and scarf. These toggles allow users to specify which segments should be kept or removed in the final output.
  • Detail Method: A selection among different edge refinement methods, including VITMatte, VITMatte(local), PyMatting, and GuidedFilter.
  • Detail Erode and Detail Dilate: Integer values specifying the extent of erosion and dilation applied to the mask, affecting the level of detail captured.
  • Black Point and White Point: Float values allowing users to adjust the histogram range for better mask contrast.
  • Process Detail: A boolean value indicating whether the mask detail should be processed.
  • Device: Choice between 'cuda' or 'cpu' to specify computational device.
  • Max Megapixels: A float value setting the maximum number of megapixels for the image, impacting performance and processing time.

Outputs

The node produces the following outputs:

  • Image: The original input image with an additional alpha channel representing the computed mask, applied to visually separate the selected segments.
  • Mask: A binary mask image where selected segments are highlighted.

Use in ComfyUI Workflows

In a ComfyUI workflow, the Segformer B2 Clothes Ultra node can be inserted at points where detailed segmentation of clothing and accessories is necessary. It is particularly useful in scenarios where modifying or enhancing specific garments or accessories is required without affecting other parts of the image. Some practical examples include:

  • Isolating clothing items for virtual try-ons or fashion demonstrations.
  • Streamlining the photo editing process by segmenting clothes and accessories to apply targeted filters or transformations.
  • Enhancing parts of an image by applying specific effects such as sharpening or saturation to certain clothing items.

Special Features and Considerations

  • Pretrained Model: The node uses a pretrained Segformer model, which allows for state-of-the-art segmentation performance without the need for manual training.
  • Flexible Segmentation: Users can customize the segments to be kept through input toggles, enabling flexibility in how images are processed.
  • Multiple Refinement Methods: The node provides multiple options for mask refinement, allowing users to choose the best method suited to their needs.
  • Device Agnostic Processing: Users can choose between GPU (cuda) and CPU processing based on their available hardware, balancing performance with resource usage.

This node is a powerful tool for image segmentation within the ComfyUI framework, providing precise and customizable segmentation of clothing items suitable for various applications in design, marketing, and entertainment.

Want to try LayerStyle without installing anything? Run ComfyUI online on InstaSD's cloud GPUs — no setup required.