Nodes/DOGMA Nodes/DOGMA SAMCoverageLazy v1.0.11
ComfyUI Node

DOGMA SAMCoverageLazy v1.0.11

Don't load a segmentation model for a category that isn't there

By axior·Created 6 months ago·Updated 16 days ago· 2
DOGMA SAMCoverageLazy v1.0.11
  • image
  • model
  • clip
  • previous
  • candidates
  • search_report
◄category—►
◄query_hint—►
◄mode▾►
◄threshold0.25►
◄max_instances32►
◄max_queries3►
◄recovery_views4►
◄refine_iterations0►
◄after—►

In a graph that maps over eight categories, the expensive part isn't the segmentation - it's arriving at the segmentation. Loading SAM 3, warming it up, then discovering the presence check already said this category is absent is wasted work, and it's multiplied across every slot in your batch.

This node is v1.0.10's SAMCoverage, with two inputs marked lazy. That one word is the whole feature.

How it works

ComfyUI's lazy inputs let a node decide at execution time whether an upstream input needs to be computed at all. Here model and clip are declared lazy, and the node's check_lazy_status asks a simple question first: is this category inactive? If it is - empty, none, or filtered out by the pack's canonicaliser and active-slot rules - the node returns "I need nothing," the SAM 3 model loader upstream never runs, and the category costs you nothing but a report line.

If the category is live, the node requests model and clip, and then hands the whole call straight through to DOGMASAMCoverage v1.0.10. It's a wrapper, not a reimplementation: same text-conditioned SAM 3 search, same 32-detections-per-category cap with four reserved overlapping recovery views, same mask preservation without box clipping or shape-ratio rejection.

The other change is a default: refine_iterations drops from 4 to 0. That means raw text-detector masks with no refinement passes - cheaper, and the setting the pack's own 1.0.11 workflow settled on. It's adjustable back up to 5 if your masks need it.

One practical consequence worth knowing: the lazy model load only helps when the upstream nodes are lazy too. If your loader is a plain SAM loader with a hard connection, ComfyUI will still evaluate it. Lazy inputs propagate the skip; they don't override a forced dependency.

The inputs and outputs

  • image - one source image, as usual. A batch raises.
  • category and query_hint - what to look for, and the noun list to search with.
  • model and clip - the SAM 3 model and its text encoder, both lazy.
  • mode - global or local_recovery; recovery needs previous, the DOGMA_REVIEW from the first pass, and refuses if the category or image size doesn't match.
  • threshold (0.25 default), max_instances (32, up to 64), max_queries (3), recovery_views (4), refine_iterations (0) - the search budget.
  • candidates (DOGMA_CANDIDATES) → the audit node → DOGMA ReviewBatch v1.0.11.
  • search_report (STRING) - detections examined, invalid ones dropped, non-duplicate masks kept, cumulative cap. If your category came back empty you want this string on screen.

Install

Manager → search DOGMA Nodes, or:

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

Restart. The pack's own Python requirement is scipy>=1.10; the real dependency is a ComfyUI current enough to have SAM 3 (SAM3_Detect) and lazy-input support - the pack says so in its 1.0.8 notes, and v1.0.11 is built on top of that assumption. SAM 3 on Windows wants Triton, which is the usual place people get stuck.

When to use this instead of SAMCoverage v1.0.10

Use the lazy version when you're running a batch of category slots, several of which are expected to come back absent - a night render where the "vehicles" slot is empty, a street scene with no signage. That's exactly the case the pack built it for, and it's the difference between a graph that idles and one that spins up a segmentation model eight times to do nothing.

Stick with DOGMASAMCoverage v1.0.10 when you want the 4-pass refinement default, or when you're matching an existing 1.0.10 workflow - the two nodes produce the same candidates and search_report pair, so swapping between them is a one-wire change, but only if you also remember the different refine_iterations default. And as always with this pack: the search is bounded. The report says it out loud. Objects outside the budget stay unsearched, and their pixels stay untouched.

CategoryDOGMA/v1.0.11

Inputs (13)

NameTypeDefaultDescription
imageIMAGE—
modelMODEL—
clipCLIP—
categorySTRING—
query_hintSTRING—
modeCOMBO2 options: global, local_recovery
thresholdFLOAT0.250.05–0.9—
max_instancesINT328–64—
max_queriesINT31–4—
recovery_viewsINT40–4—
refine_iterationsINT00–5—
previousoptDOGMA_REVIEW—
afteroptSTRING—

Outputs (2)

NameTypeDescription
candidatesDOGMA_CANDIDATES—
search_reportSTRING—