Is Mask Empty
Is Mask Empty is stricter than it looks — 'empty' means no solid white
- mask
- boolean
Is Mask Empty answers the question you ask after every segmentation pass: "did my mask actually find anything?" But like its sibling Is Image Empty, the definition of "empty" is narrower than you'd guess - and it's worth knowing before it quietly mislabels your masks.
How it works
The node returns True unless at least one pixel in the mask is exactly 1.0. That's the whole check: torch.any(mask == 1). Not "any non-zero pixel." Not "any pixel above 0.5." Exactly equal to 1. If every pixel of your mask is below 1.0 - a soft feathered mask peaking at 0.9, anti-aliased edges, a mask normalized into something other than strict 0-to-1 - this node says "empty" even though the mask clearly covers stuff. That's the trap, and it produces genuinely confusing downstream behavior: you wire the boolean into a "skip if empty" switch, the graph skips the inpaint, and you can't figure out why, because the mask looked full on the preview.
How it differs from its sibling
Compare it with Get Mask Dimensions, the other mask-prober in this pack: that one treats any non-zero pixel as content and returns its bounding box. This one wants a solid-white pixel specifically. Same pack, different philosophies, and the difference matters when you're deciding which to trust.
Why you'd reach for it
Detecting "the detector found nothing." Grounding/SAM/CLIPSeg-style nodes return an empty, all-zero mask when they draw a blank - and an all-zero mask trivially contains no 1.0 pixels, so this returns True and you can route the graph: skip the region, fall back to a whole-image pass, or retry. For the common case of "did segmentation produce anything at all," it works fine, because an empty mask is all zeros and holds no ones.
Inputs and outputs
One required input: mask (MASK). One output: boolean (BOOLEAN) - True when it considers the mask empty. Wire it into any boolean-route switch to branch on "mask exists vs. doesn't."
Install
It lives in the six-node ComfyUI_Accessories pack. ComfyUI Manager → search "ComfyUI_Accessories" → install → restart, or:
cd ComfyUI/custom_nodes && git clone https://github.com/var1ableX/ComfyUI_Accessories
No dependencies, no models.
Common issues
First, the pack-wide one: the current GitHub head doesn't import - a deleted GetRandomDimensions class is still imported in __init__.py, so the whole pack errors on startup. One-line fix in __init__.py or wait for upstream. Second, the threshold semantics above: if your masks are anti-aliased or non-normalized, expect false "empty" readings. Either make sure your mask has a solid-white core or use a different emptiness check. Third, unlike Get Mask Dimensions, this one scans the whole batch tensor rather than just frame zero - so a batch where any frame contains a white pixel reports non-empty, which is usually the behavior you want for a "did anything come back" gate.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| boolean | BOOLEAN | — |