ComfyUI > Nodes > Masquerade Nodes > Prune By Mask

ComfyUI Node: Prune By Mask

Class Name

Prune By Mask

Category
Masquerade Nodes
Author
BadCafeCode (Account age: 485days)
Extension
Masquerade Nodes
Latest Updated
2024-06-19
Github Stars
0.34K

How to Install Masquerade Nodes

Install this extension via the ComfyUI Manager by searching for Masquerade Nodes
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter Masquerade Nodes 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

Prune By Mask Description

Filter images based on mask pixel value average of at least 0.5 to optimize workflow and focus on relevant data.

Prune By Mask:

The Prune By Mask node is designed to filter out images in a batch that do not meet a specific masking criterion. Specifically, it evaluates the average pixel value of the associated mask for each image and retains only those images whose masks have an average pixel value of at least 0.5. This functionality is particularly useful in scenarios where you need to ensure that only images with significant masked regions are processed further, thereby optimizing the workflow and focusing on relevant data. By using this node, you can streamline your image processing tasks and ensure that only the most pertinent images are included in subsequent operations.

Prune By Mask Input Parameters:

image

This parameter represents the batch of images that you want to filter. Each image in the batch will be evaluated based on its associated mask to determine if it meets the pruning criteria. The images should be in a format compatible with the node's processing capabilities.

mask

This parameter represents the batch of masks corresponding to the images. Each mask is used to evaluate the average pixel value, and only those images whose masks have an average pixel value of at least 0.5 will be retained. The masks should be in a format compatible with the node's processing capabilities.

Prune By Mask Output Parameters:

image

The output is a batch of images that have passed the pruning criteria. These are the images whose associated masks have an average pixel value of at least 0.5. This filtered batch can then be used for further processing or analysis.

Prune By Mask Usage Tips:

  • Ensure that the masks accurately represent the regions of interest in your images to make the most out of the pruning process.
  • Use this node to preprocess your image batches before applying more computationally intensive operations, thereby saving time and resources.
  • Combine this node with other mask-based operations to create a robust image processing pipeline that focuses on relevant data.

Prune By Mask Common Errors and Solutions:

Mask tensor shape mismatch

  • Explanation: This error occurs when the shape of the mask tensor does not match the shape of the image tensor.
  • Solution: Ensure that each mask in the batch corresponds to an image of the same dimensions.

Invalid mask values

  • Explanation: This error occurs when the mask contains values outside the expected range (0 to 1).
  • Solution: Verify that the mask values are normalized between 0 and 1 before passing them to the node.

Empty output batch

  • Explanation: This error occurs when none of the images meet the pruning criteria, resulting in an empty output batch.
  • Solution: Check the average pixel values of your masks to ensure that they are correctly calculated and meet the threshold of 0.5. Adjust the masks if necessary.

Prune By Mask Related Nodes

Go back to the extension to check out more related nodes.
Masquerade Nodes
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.