Nodes/DOGMA Nodes/DOGMA Insegne - Maschere e proposte Milano anni 70
ComfyUI Node

DOGMA Insegne - Maschere e proposte Milano anni 70

SAM proposes the sign surfaces, a VLM argues about each one

By axior·Created 6 months ago·Updated 2 days ago· 2
DOGMA Insegne - Maschere e proposte Milano anni 70
  • plan
  • sam_model
  • sam_clip
  • proposals
  • report
◄render_side1536►
◄context_px96►
◄max_regions24►
◄sam_threshold0.35►
◄min_confidence0.80►

"Insegne" is Italian for signage, and this node is the middle of a three-part chain that repairs signs, posters and painted lettering in old photographs - the pack's example being Milan in the 1970s. It takes a plan, searches the image for graphic-bearing surfaces with a promptable segmenter, then puts every candidate in front of a vision model and asks it to justify itself.

The two-stage design is the interesting part. A segmentation model returns geometry; it does not know what it found, and a mask over a brick wall, a window frame or an architectural ornament is geometrically indistinguishable from a mask over a shop sign. So the second stage shows the model a two-panel diagnostic card - your crop on the left, the same crop with the mask tinted cyan on the right - and asks for a judgement, a confidence, whatever text it can read, and an edit instruction. Anything the model will not defend at your confidence threshold comes back marked as needing verification instead of approved.

How it works

The plan arrives with rows already built: eight queries covering signs, road signs, posters, billboards, advertisements, graffiti and text, deduplicated, each with its own target ID. This node runs them through the pack's SAM mask search and then filters hard. Masks smaller than nine pixels or larger than 65% of the frame are dropped with a note. Duplicate detections are removed by overlap - if a candidate is 85% contained in one already kept, the bigger one wins, which is the correct direction: you want the whole sign surface, not a fragment of it.

One nice trick: if the matched query was text or graffiti, the mask is a letter-stroke shape and is expanded to the local writing area. A mask hugging the strokes of a word cannot accommodate a different word, so the node widens it to the surface the writing sits on.

Then the audit. Each candidate is cropped at render_side with context_px of surroundings, rendered as the two-panel card, and sent to the configured vision model with a long instruction that spells out the art direction and the traps - do not convert an ornament, bell, clock or window into signage; do not change a traffic sign's meaning; do not guess specific place names. Approval requires the model to say it is a graphic, with confidence at or above min_confidence, and to return a non-empty edit instruction. Malformed output is treated as not-approved, never as a crash.

Inputs and outputs

Required: plan (DOGMA_SIGN_PLAN, from the Insegne plan node), sam_model and sam_clip (lazy - only needed for automatic mode), render_side (1536), context_px (96), max_regions (24), sam_threshold (0.35), min_confidence (0.8).

Outputs: proposals (DOGMA_SIGN_JOBS) and report (STRING). The report carries the honest lines you want: omitted tiny masks, omitted oversized masks, duplicate suppressions, a budget notice when there were more candidates than max_regions, and per element either "pronto" or "da verificare / escluso in automatico" with the model's stated reason.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/axior/ComfyUI-DOGMA-Nodes

Or ComfyUI Manager → DOGMA Nodes, then restart. scipy>=1.10 is the pack's only pip dependency, but this node needs a SAM checkpoint as a MODEL + CLIP pair and the pack's VLM worker node (from comfyui_vlm_nodes) for the audits. If the VLM node is missing, the error names it and tells you which package to update - a small courtesy that saves a lot of guessing.

Where people get burned

The budget is a real budget. With max_regions at 24 and a street full of signage you will get a "surfaces deferred" note. Nothing is broken; raise the number if you are willing to wait, because every extra region is another VLM audit.

Manual mode is a different path. If the plan came from the manual branch, no SAM and no VLM run at all - your mask and your prompt are taken as-is. That is the escape hatch when the auto path keeps rejecting something you can plainly see.

Budget your VLM patience. One vision call per candidate, on top of the SAM search. On a dense photograph that is the slow part, and it is why the plan stage lets you narrow the queries before you get here.

CategoryDOGMA/Insegne 1.0.25

Inputs (8)

NameTypeDefaultDescription
planDOGMA_SIGN_PLAN—
sam_modelMODEL—
sam_clipCLIP—
render_sideINT1536512–2048—
context_pxINT9616–512—
max_regionsINT241–64—
sam_thresholdFLOAT0.350.05–0.95—
min_confidenceFLOAT0.800.5–1—

Outputs (2)

NameTypeDescription
proposalsDOGMA_SIGN_JOBS—
reportSTRING—