Nodes/ComfyUI_ObjectClear/ObjectClearBatch
ComfyUI Node

ObjectClearBatch

Cleaning up several objects in one pass

By smthemex·Created about a year ago·Updated 9 months ago· 33
ObjectClearBatch
  • mask1
  • mask2
  • mask

One photo, two objects to delete, one pass. That's what ObjectClearBatch is for: it takes two masks and merges them into a single batched mask, so you can strip a whole scene in a single sampler run instead of chaining removals one at a time. The README points you here explicitly for mask merging, and the pack's multi-image example workflow leans on it.

How it works

It's dumber than you'd think, and that's fine. ObjectClearBatch takes mask1 and mask2 (both plain MASK tensors), resizes mask2 to mask1's width and height, and concatenates them along the batch dimension. If one mask is a single frame and the other is a batch, it broadcasts the single mask so the counts line up. The output is one batched mask you can feed anywhere a mask belongs.

The workflow wires it like this: an ImageToMask (or mask node) per object → ObjectClearBatch → the merged mask goes into both ObjectClearVision (so the vision encoder sees the isolated objects) and ObjectClearSampler's mask input (so the removal happens over both regions). Pair it with an ImageBatch of the corresponding photos and you're removing several objects from several images in one go.

The limits, stated plainly

Two masks per node is a hard cap. Want three objects? Chain two ObjectClearBatch nodes - feed the first one's output into the second's mask1. Also note the merged mask inherits mask1's dimensions, so ordering matters if your masks are different sizes. And the batch counts have to match your image batch when they meet downstream, or the sampler's own batch-size check will complain.

Install

Same shared story as the whole pack: ComfyUI Manager (search "ObjectClear") or

cd ComfyUI/custom_nodes
git clone https://github.com/smthemex/ComfyUI_ObjectClear

restart, and download the model files from jixin0101/ObjectClear into checkpoints/vae/clip_vision/clip (full table in the ObjectClearLoader article). No extra dependencies - the pack's requirements are all things a working ComfyUI already has.

Honestly, this node is barely more than torch.cat with a resize. But that's the right shape for a utility node: it does exactly one thing, does it for batches, and saves you from building the mask concatenation yourself. When you're iterating on a multi-object removal, one less custom tensor chore is one less thing to get wrong.

CategoryObjectClear

Inputs (2)

NameTypeDefaultDescription
mask1MASK
mask2MASK

Outputs (1)

NameTypeDescription
maskMASK