DOGMA v39 Mask Preview
See the mask before you burn a GPU pass on it
- mask
- image
- info
Any debugging session on a masked pipeline starts the same way: work out whether the mask is actually there, actually where you think it is, and actually the size you think it is. DOGMAMaskPreviewV39 answers all three in one node, and - more usefully - it does so without falling over when the answer is "no".
What it does
Feed it a MASK, get an IMAGE you can watch in the preview, plus an info string. Internally it takes the max across the mask batch (so a batch of instance masks becomes one union), clamps to 0–1, and repeats that single channel into an RGB image - bright where selected, black where not. The info line reports how many masks arrived and what fraction of the frame the union covers: mask batch=7 | union coverage=12.84%.
That coverage percentage is the number to watch. On a category you expect to hit a fifth of the frame, 12% is plausible and 0.3% means your masker found something tiny - or the wrong thing entirely. It's the same instinct as trusting a detector's box count over its pretty preview.
The empty-batch thing is the real feature
Segmentation returns nothing sometimes. That's a normal, correct answer for "find the cats" on a photo with no cats - and several maskers emit an empty tensor in that shape, a batch dimension of zero, rather than an error.
Most preview and conversion nodes don't handle that. ComfyUI's core mask-to-image expands whatever it's given, so an empty batch produces nothing to look at, and anything downstream that does a reduce on the mask (mean, max) throws. You then get a red error box and spend ten minutes wondering what you broke, when the truthful answer was "there were no cats".
This node checks for the empty case first, and returns a correctly-sized black IMAGE with an info line reading empty mask batch=0 | coverage=0.00% | WxH. That's a legible "nothing found" instead of a stack trace. In a batch run over hundreds of images, that distinction is the difference between a graph that finishes and a graph that stops on image 47.
Inputs and outputs
mask in. image and info out. That's the entire node - no threshold, no colour, no batch handling options. Note that unlike a per-frame converter, it deliberately collapses the batch into one union frame, which is what you want when the question is "did the masker cover the object" rather than "how does instance 3 look".
Install
ComfyUI Manager → search DOGMA Nodes, or:
cd ComfyUI/custom_nodes
git clone https://github.com/axior/ComfyUI-DOGMA-Nodes
Restart. No dependencies and no weights - it's tensor reshaping and a preview output.
Where it bites
The union is lossy. Eight masks that overlap into one blob preview identically to one mask of the same shape, so if you need to see individual instances, don't rely on this - check the count in info instead, and if it looks low for how many objects you can see, the masker is under-detecting.
Second, there's no inversion. Bright means selected, in the pack's convention. Some people's mental model from other tools is the opposite - black for "this is the region", from the old inpaint-paint-a-mask workflow - so if a preview looks like a photo negative of what you expected, check which end you're reading.
Third: it's a preview, not an output node. Nothing is saved to disk. If you want the mask written out for a bug report, this feeds an image save, it doesn't replace one.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | MASK | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| info | STRING | — |