ComfyUI  >  Nodes  >  ComfyUI-Transformers >  ImageSegmentation

ComfyUI Node: ImageSegmentation

Class Name

ImageSegmentationPipeline

Category
ComputerVision/Transformers
Author
kadirnar (Account age: 2447 days)
Extension
ComfyUI-Transformers
Latest Updated
6/22/2024
Github Stars
0.0K

How to Install ComfyUI-Transformers

Install this extension via the ComfyUI Manager by searching for  ComfyUI-Transformers
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-Transformers in the search bar
After installation, click the  Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • High-speed GPU machines
  • 200+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 50+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

ImageSegmentation Description

Perform image segmentation using pre-trained models for extracting specific elements with precision.

ImageSegmentation:

The ImageSegmentationPipeline node is designed to perform image segmentation tasks using pre-trained models from the Hugging Face Transformers library. This node allows you to extract specific categories or objects from an image by generating a mask that highlights the desired elements. By leveraging state-of-the-art models, such as those fine-tuned on datasets like Cityscapes, this node provides a powerful tool for AI artists to isolate and manipulate parts of an image with precision. Whether you are working on complex compositions or need to focus on particular objects within a scene, the ImageSegmentationPipeline simplifies the process, making it accessible even to those without a deep technical background.

ImageSegmentation Input Parameters:

image

This parameter expects an image file that you want to process. The image serves as the input for the segmentation model to analyze and generate the corresponding mask. The image should be in a format supported by the PIL library, such as JPEG or PNG.

category_name

This parameter is a string that specifies the name of the category or object you want to extract from the image. For example, if you are interested in segmenting cars from a street scene, you would set this parameter to "car". The accuracy of the segmentation depends on the model's training data and its ability to recognize the specified category.

model_name

This parameter allows you to choose the pre-trained model to be used for the segmentation task. The available options are "mattmdjaga/segformer_b2_clothes" and "nvidia/segformer-b1-finetuned-cityscapes-1024-1024". The default model is "mattmdjaga/segformer_b2_clothes". Each model has been fine-tuned on different datasets and may perform better on specific types of images or categories.

ImageSegmentation Output Parameters:

IMAGE

The output of this node is an image that contains the mask of the specified category. The mask highlights the areas of the input image that correspond to the category name provided. If the category is not found in the image, the output will be None. This mask can be used for further image processing tasks, such as compositing or applying effects to specific parts of the image.

ImageSegmentation Usage Tips:

  • Ensure that the input image is clear and well-lit to improve the accuracy of the segmentation.
  • Experiment with different models to find the one that best suits your specific use case and image type.
  • Use high-resolution images for better segmentation results, especially when dealing with small or intricate objects.

ImageSegmentation Common Errors and Solutions:

"Model not found"

  • Explanation: This error occurs when the specified model name is not available in the list of pre-trained models.
  • Solution: Ensure that the model name is correctly spelled and is one of the available options: "mattmdjaga/segformer_b2_clothes" or "nvidia/segformer-b1-finetuned-cityscapes-1024-1024".

"Category not found in image"

  • Explanation: This error occurs when the specified category name does not match any objects in the input image.
  • Solution: Verify that the category name is correctly spelled and that the object is present and clearly visible in the image. Consider using a different image or adjusting the category name to match the model's training data.

"Invalid image format"

  • Explanation: This error occurs when the input image is in a format not supported by the PIL library.
  • Solution: Convert the image to a supported format such as JPEG or PNG before using it as input for the node.

ImageSegmentation Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-Transformers
RunComfy

© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals.