Nodes/DOGMA Nodes/DOGMA Audit Sector Plan v31 — 4B Audit + SAM Fallbacks
ComfyUI Node

DOGMA Audit Sector Plan v31 — 4B Audit + SAM Fallbacks

One 4B audit, three sectors, and fallback masks when SAM finds nothing

By axior·Created 4 months ago·Updated 3 days ago· 1
DOGMA Audit Sector Plan v31 — 4B Audit + SAM Fallbacks
  • 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
planner_text

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.

CategoryDOGMA/Semantic Detailer

Inputs (2)

NameTypeDefaultDescription
planner_textSTRING
mask_referenceIMAGE

Outputs (25)

NameTypeDescription
plan_previewSTRING
category_1STRING
sam_prompt_1STRING
sam_threshold_1FLOAT
category_2STRING
sam_prompt_2STRING
sam_threshold_2FLOAT
category_3STRING
sam_prompt_3STRING
sam_threshold_3FLOAT
category_4STRING
sam_prompt_4STRING
sam_threshold_4FLOAT
category_5STRING
sam_prompt_5STRING
sam_threshold_5FLOAT
category_6STRING
sam_prompt_6STRING
sam_threshold_6FLOAT
audit_masks_2MASK
audit_hints_2STRING
audit_masks_3MASK
audit_hints_3STRING
audit_masks_4MASK
audit_hints_4STRING