DOGMA Sector Masks v26 — Preserve Instances
Normalize three masks, delete nothing
- mask_1
- mask_2
- mask_3
- mask_1
- mask_2
- mask_3
- summary
Segmentation nodes hand you masks in whatever shape and size they feel like. Three separate passes over the same image will give you three masks that are almost the same dimensions, and a batch dimension you didn't ask for. Then your crop node needs them aligned or it produces offset garbage.
Sector Masks v26 is the cleanup step between the segmenter and the cropper. Its docstring is unusually blunt about what it doesn't do: Normalize three masks only. No deletion logic and no cross-category erasure.
What it does
You feed it mask_1/category_1, mask_2/category_2, mask_3/category_3 - three pairs. For each mask it:
- adds a batch dimension to bare 2-D masks and unions any multi-layer mask with a max,
- resizes to the largest canvas among the three (bilinear) if the sizes disagree,
- zeroes the mask entirely if the category string is empty or reads
none,__none__orunused, - clamps to 0–1,
- computes the coverage percentage of pixels above 0.5 for the report.
Outputs are the three masks back out (now guaranteed co-registered and same-size) plus a summary string with one line per sector: category, coverage, and the reminder preserve all existing instances.
Why "no deletion" is the headline
The explicit negation in the docstring tells you what the earlier generations of this pipeline were doing: making the masks mutually exclusive by erasing overlapping pixels from the lower-priority category. It's a reasonable-sounding move that fails in the field - a car whose wing mirror overlaps a pedestrian's elbow gets a hole punched in it, and the resulting repair has a bite out of the door. It's also why the pack carries a whole family of DOGMAProtectedMasks* nodes.
v26's answer is to not solve that problem here. The masks stay intact and overlapping, and the crop stage handles the spatial grouping - its non-overlapping ownership windows mean the same semantic pixels aren't edited twice, without either mask being mutilated. If you've been fighting mystery holes in masks produced by an older DOGMA workflow, this is the generational fix.
The zeroing rule is the other half of the design: a slot whose planner fell through to none gets an empty mask rather than a pass-through of the whole frame. Inactive slots are inert, not dangerous.
Inputs and outputs
Six inputs, all required, all wired from the segmenter and the planner: three MASKs, three STRING categories. Four outputs: mask_1, mask_2, mask_3, summary. Nothing to configure - no threshold, no mode. If you want a union of categories, that's DOGMAResizeMaskToImageV15; this node deliberately keeps them separate.
Why three? Because the pack's DOGMASectorPlanV26 plans exactly three non-destructive targets and lays them out across its six-slot interface. The four-sector variant is DOGMASectorMasks4V354.
Install
Manager → search DOGMA Nodes → install → restart ComfyUI. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/axior/ComfyUI-DOGMA-Nodes
Nothing to install beyond the pack: no external Python dependencies, no model downloads. It registers under DOGMA/Semantic Detailer, next to the two dozen other nodes in this pipeline, which is why searching "sector masks" in the node list will show you several generations at once - v26 here, plus the four-sector 4V354. Pick by slot count.
The pack is axior's in-house machinery, from the studio side of a Milan production team doing commercial AI work with big masked-inpaint chains. The "don't erase, group instead" pivot reads like a decision made after a client spotted a missing wing mirror.
Troubleshooting
Masks line up but the edges are fuzzy. Expected - the resize is bilinear, so if your segmenter ran at reduced resolution (which is what DOGMASAMInputResizeV37 is for), enlarging the mask back up softens the boundary. Thresholding downstream mostly hides it; a tight cutout won't.
A whole sector came back empty. Check the category string. Anything reading none/unused is intentionally zeroed, and an upstream planner with no match in that slot will pass exactly that.
All three masks identical. You wired the same mask to all three inputs, which the summary will tell you - identical coverage percentages, three lines. It's a cheap sanity check; read the summary before you debug the sampler.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| mask_1 | MASK | — | |
| category_1 | STRING | — | |
| mask_2 | MASK | — | |
| category_2 | STRING | — | |
| mask_3 | MASK | — | |
| category_3 | STRING | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| mask_1 | MASK | — |
| mask_2 | MASK | — |
| mask_3 | MASK | — |
| summary | STRING | — |