ComfyUI > Nodes > ComfyUI_Florence2SAM2 > RdancerFlorence2SAM2GenerateMask

ComfyUI Node: RdancerFlorence2SAM2GenerateMask

Class Name

RdancerFlorence2SAM2GenerateMask

Category
💃rDancer
Author
rdancer (Account age: 5878days)
Extension
ComfyUI_Florence2SAM2
Latest Updated
2024-10-25
Github Stars
0.03K

How to Install ComfyUI_Florence2SAM2

Install this extension via the ComfyUI Manager by searching for ComfyUI_Florence2SAM2
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI_Florence2SAM2 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
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

RdancerFlorence2SAM2GenerateMask Description

Advanced image processing node for detailed object segmentation and manipulation using Florence2 and SAM2 models.

RdancerFlorence2SAM2GenerateMask:

The RdancerFlorence2SAM2GenerateMask node is designed to facilitate advanced image processing by integrating the capabilities of Florence2 and SAM2 models. This node is part of a two-stage inference pipeline where Florence2 initially performs tasks such as object detection, open-vocabulary object detection, image captioning, or phrase grounding. Subsequently, SAM2 takes over to execute object segmentation on the image. The primary benefit of this node is its ability to generate detailed masks and annotated images based on specified prompts, allowing for precise object segmentation and manipulation. This functionality is particularly useful for AI artists who wish to isolate or highlight specific elements within an image, providing a powerful tool for creative image editing and enhancement.

RdancerFlorence2SAM2GenerateMask Input Parameters:

sam2_model

The sam2_model parameter specifies the model to be used for the SAM2 segmentation process. This parameter is crucial as it determines the segmentation capabilities and accuracy of the node. The choice of model can significantly impact the quality of the generated masks and annotated images.

device

The device parameter indicates the computational device on which the processing will occur, such as a CPU or GPU. This parameter affects the speed and efficiency of the node's execution, with GPUs typically offering faster processing times for image segmentation tasks.

image

The image parameter is a tensor representation of the input image that you wish to process. This image serves as the canvas for the segmentation and annotation tasks performed by the node. The quality and resolution of the input image can influence the detail and accuracy of the output masks.

prompt

The prompt parameter is an optional text input that guides the segmentation process by specifying the objects or elements of interest within the image. This parameter allows for targeted segmentation, enabling the node to focus on particular features or objects as defined by the prompt.

keep_model_loaded

The keep_model_loaded parameter is a boolean flag that determines whether the model should remain loaded in memory after processing. Keeping the model loaded can be beneficial for batch processing multiple images, as it reduces the overhead of repeatedly loading and unloading the model.

RdancerFlorence2SAM2GenerateMask Output Parameters:

annotated_images

The annotated_images output consists of a tensor of images that have been annotated based on the segmentation results. These images provide a visual representation of the detected objects or elements, highlighting them within the context of the original image.

masks

The masks output is a tensor containing the binary masks generated by the segmentation process. Each mask corresponds to a specific object or element identified in the image, allowing for precise isolation and manipulation of these components.

masked_images

The masked_images output provides a tensor of images where the original image content is masked according to the generated masks. This output is useful for visualizing the effect of the segmentation and for further image editing tasks where only the masked areas are of interest.

RdancerFlorence2SAM2GenerateMask Usage Tips:

  • Ensure that the prompt parameter is clear and specific to achieve accurate segmentation results, especially when dealing with complex images containing multiple objects.
  • Utilize a GPU as the device parameter for faster processing times, particularly when working with high-resolution images or large batches of images.

RdancerFlorence2SAM2GenerateMask Common Errors and Solutions:

"Florence2SAM2: No objects of class <prompt> found in the image."

  • Explanation: This error occurs when the specified prompt does not match any detectable objects within the image.
  • Solution: Verify the accuracy and specificity of the prompt. Consider using more general terms or adjusting the prompt to better align with the content of the image.

"CUDA out of memory"

  • Explanation: This error indicates that the GPU does not have enough memory to process the image with the current model.
  • Solution: Reduce the image resolution or batch size, or consider using a GPU with more memory. Alternatively, switch to CPU processing if GPU resources are limited.

RdancerFlorence2SAM2GenerateMask Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI_Florence2SAM2
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Playground, enabling artists to harness the latest AI tools to create incredible art.