Nodes Browser
ComfyDeploy: How ComfyUI-MaskArbiter works in ComfyUI?
What is ComfyUI-MaskArbiter?
A node for ComfyUI that takes a list of masks and returns a single mask based on your criteria. For example, it can be used to mask the leftmost subject in an image containing more than one subject of the same class. The workflow below demonstrates the difference between Mask Arbiter (top) and traditional Grounding DINO masking (bottom.)
How to install it in ComfyDeploy?
Head over to the machine page
- Click on the "Create a new machine" button
- Select the
Edit
build steps - Add a new step -> Custom Node
- Search for
ComfyUI-MaskArbiter
and select it - Close the build step dialig and then click on the "Save" button to rebuild the machine
ComfyUI-MaskArbiter
A node for ComfyUI that takes a list of masks
and returns a single mask
based on your criteria.
For example, it can be used to mask the leftmost subject in an image containing more than one subject of the same class. The workflow below demonstrates the difference between Mask Arbiter (top) and traditional Grounding DINO masking (bottom.)
Installation
Simply drag the image above into ComfyUI and use ComfyUI Manager » Install Missing Custom Nodes.
[!NOTE] ComfyUI-MaskArbiter is packaged with a modified version of the GroundingDinoSAM2Segment node from ComfyUI-SAM2. This version of the node outputs a list of masks that you can feed into Mask Arbiter. It is called "GroundingDinoSAM2SegmentList."
Inputs
masks
: A list of masks to process with Mask Arbiter, such as the outputs of Segment Anything.sort_by
: The method of sorting yourmasks
. Possible options includeleftmost
(sort left to right),topmost
(sort top to bottom),innermost
(prioritize closest to center of your image),largest
(sort by pixel area occupied),initial
(do not sort),random
(sort randomly), andmerged
(combine all masks and merge into one.)reverse
: Reverses the mask list order after sorting. For example, if you sort byleftmost
and enablereverse
, you'll get the rightmost subject.index
: The individual mask to return after sorting, zero-indexed.
Outputs
MASK
: A mask of the selectedindex
after sorting.MASKS
: The entire mask list after sorting.
This script was adapted from the [txt2mask]
shortcode of Unprompted, my Automatic1111 extension.