DOGMA Audit Sector Plan v31 — 4B Audit + SAM Fallbacks
One 4B audit, three sectors, and fallback masks when SAM finds nothing
- mask_reference
- plan_preview
- category_1
- sam_prompt_1
- sam_threshold_1
- category_2
- sam_prompt_2
- sam_threshold_2
- category_3
- sam_prompt_3
- sam_threshold_3
- category_4
- sam_prompt_4
- sam_threshold_4
- category_5
- sam_prompt_5
- sam_threshold_5
- category_6
- sam_prompt_6
- sam_threshold_6
- audit_masks_2
- audit_hints_2
- audit_masks_3
- audit_hints_3
- audit_masks_4
- audit_hints_4
This is the node that makes the v31 pipeline a system rather than a pile of parts. A single small vision-language model - in this pack's usage, a Qwen3-VL 4B-class model - looks at the whole frame once and writes two kinds of line: which categories matter (TARGET|people), and where it thinks the visible defects are (DEFECT|people|x1|y1|x2|y2|priority|hint, with the box in normalised 0-1000 coordinates).
DOGMAAuditSectorPlanV31 parses that text and emits 25 outputs: a plan_preview, six slots of category_N / sam_prompt_N / sam_threshold_N, and then per-sector fallback pairs - audit_masks_2 + audit_hints_2, _3, _4.
Why the outputs look like that
The first 19 outputs deliberately mirror the older 6-slot layout, with the three real sectors sitting in slots 2, 3 and 4. That's not cosmetic: it means a workflow wired against the v26/v27 planner keeps working when you swap this node in. Slot 1 and slots 5-6 stay as __none__ placeholders. If you're starting fresh, you can ignore them entirely and use the per-sector masks and hints, which is where the new behaviour lives.
Those fallback masks are the point. SAM is good at countable objects and bad at "the third car's rear wheel is fused into the bumper" - a defect is not an object, and a grounded segmenter asked for "car" will happily return the whole car. So the audit provides tight boxes around the defects it claims to see, and those become masks when you need them. The coordinates are clamped to 0-1000, scaled to your mask_reference image, and grown by a ~1.2% safety ring so the interaction sits inside the region. The hints ride along as strings (P4: front wheel merged with fender) and can be fed into a prompt composer.
If the TARGET| lines are malformed or missing, the node doesn't give up - it scores the defect categories by priority and infers the top three. Bad model output degrades into a usable plan instead of an empty one.
Wiring
planner_text from your VLM node, mask_reference fed with the image you want the defect masks sized against (the frame the audit saw). Per sector: category_N and sam_prompt_N + sam_threshold_N into your grounded segmenter, audit_masks_N as an alternative or additional mask source, audit_hints_N into DOGMAActiveLocalPromptV31. Then crops, Klein, stitch. The thresholds are recall-biased on purpose (0.11 for vehicles and people) - the pack would rather over-detect and dedupe later than miss a broken car.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/axior/ComfyUI-DOGMA-Nodes
Or Manager → DOGMA Nodes, restart. No pip dependencies whatsoever, which is worth knowing because the models are the real install: a Qwen3-VL 4B for the audit, a grounded SAM for masks, FLUX.2 Klein 9B for the local passes. That stack is what makes DOGMAAfterMasksVRAMCleanup worth having - the audit and the inpainter don't need to coexist in VRAM.
Common issues
Everything in plan_preview is __none__. The parser only accepts specific vocabularies. Text/signage categories are dropped by design (glyph rewriting is worse than blur), and so are broad surfaces - road, sky, grass, wall, floor, background. If your VLM insists the world's problems are all asphalt, this planner will refuse to help.
Boxes in the wrong place. The audit boxes are a VLM's guess at localisation, which is exactly where small VLMs are weakest. They're a fallback, not ground truth; treat SAM masks as primary and these as insurance for the case where segmentation finds nothing.
A sector with masks but no hints, or hints but no masks. Normal and expected - the two streams are independent. An empty mask with hints means "the model saw a problem and couldn't box it".
Hints applied to the wrong crop. The consumer prompt is instructed to apply a hint only if it's visible in that crop, but that's an instruction, not a guarantee. Short, specific hints survive the trip better than long ones.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| planner_text | STRING | — | |
| mask_reference | IMAGE | — |
Outputs (25)
| Name | Type | Description |
|---|---|---|
| plan_preview | STRING | — |
| category_1 | STRING | — |
| sam_prompt_1 | STRING | — |
| sam_threshold_1 | FLOAT | — |
| category_2 | STRING | — |
| sam_prompt_2 | STRING | — |
| sam_threshold_2 | FLOAT | — |
| category_3 | STRING | — |
| sam_prompt_3 | STRING | — |
| sam_threshold_3 | FLOAT | — |
| category_4 | STRING | — |
| sam_prompt_4 | STRING | — |
| sam_threshold_4 | FLOAT | — |
| category_5 | STRING | — |
| sam_prompt_5 | STRING | — |
| sam_threshold_5 | FLOAT | — |
| category_6 | STRING | — |
| sam_prompt_6 | STRING | — |
| sam_threshold_6 | FLOAT | — |
| audit_masks_2 | MASK | — |
| audit_hints_2 | STRING | — |
| audit_masks_3 | MASK | — |
| audit_hints_3 | STRING | — |
| audit_masks_4 | MASK | — |
| audit_hints_4 | STRING | — |