Nodes Browser

ComfyDeploy: How ComfyUI-MaskBatchPermutations works in ComfyUI?

What is ComfyUI-MaskBatchPermutations?

Permutes a mask batch to present possible additive combinations. Passing a mask batch (e.g. out of [a/SEGS to Mask Batch](https://github.com/ltdrdata/ComfyUI-Impact-Pack)) will return a new mask batch representing all the possible combinations of the included masks. So, a mask batch with two mask sections, 'A' and 'B', will return a batch containing an empty mask, an empty mask & A, an empty mask & B, and an empty mask & A & B.

How to install it in ComfyDeploy?

Head over to the machine page

  1. Click on the "Create a new machine" button
  2. Select the Edit build steps
  3. Add a new step -> Custom Node
  4. Search for ComfyUI-MaskBatchPermutations and select it
  5. Close the build step dialig and then click on the "Save" button to rebuild the machine

ComfyUI-MaskBatchPermutations

Provides two nodes, Permute Mask Batch and Combinatorial Detailer.

Permute Mask Batch

Passing a mask batch (e.g. out of SEGS to Mask Batch) will return a new mask batch representing all the possible combinations of the included masks. So, a mask batch with two masks, "A" and "B, will return a new batch containing an empty mask, an empty mask & A, an empty mask & B, and an empty mask & A & B.

example workflow

An image embedding a workflow showing this node being used with a mask batch with three items. This image contains an embedded workflow.

Combinatorial Detailer

Similar to Permute Mask Batch but accepts a mask batch, a base image, and then a batch of candidate images (for example, the batched outputs of several separate detailer passes using different prompts or seeds). Provides a batch of images representing the possible combinations of the base image, masks and candidates. Be advised that this can create very large batches - a set of masks representing three regions and with two candidate images will generate (2 + 1)<sup>3</sup> combinations (27) as each mask area will present with either the base image, or one of the two candidates.

example workflow

In this example, I have given both detailers deliberately divergent prompts to make it clearer in the example output what is going on. An image embedding a workflow showing this node being used with a mask batch with three items and two candidates.

why?

"Automatic" face detailing without direct operator intervention usually works well, but occasionally it wrecks an otherwise good face. Instead of having to hand compose them back together in something like GIMP and fix the metadata, I decided to create this instead.