Nodes/DOGMA Nodes/DOGMA v38 Adaptive Grouped Crops
ComfyUI Node

DOGMA v38 Adaptive Grouped Crops

The adapter node that turns planner output into the old family cropper

By axior·Created 4 months ago·Updated 3 days ago· 1
DOGMA v38 Adaptive Grouped Crops
  • image
  • mask
  • crops
  • crop_masks
  • stitch
  • info
category
kind
max_groups8
context_px160
target_long_side1792

DOGMAAdaptiveGroupedCropsV38 is a shim, and it's a useful one to understand because it shows how this pack is built: instead of rewriting the cropper every generation, the author keeps one battle-tested crop routine and writes thin adapters that translate each generation's vocabulary into it.

The idea

The v37 cropper (DOGMACategoryGroupedCropsV37) takes a family dropdown - literally one of vehicles, people, architecture, vegetation, street_objects, road_ground - and does occupancy-cell connected components, context expansion, and chunking of giant broad regions into model-sized windows. It doesn't know anything about planners or kinds.

The v38 planner doesn't know anything about families. It emits a category and a kind (OBJECT, STRUCTURE, SURFACE). V38 is the translation layer: it maps OBJECT → vehicles, STRUCTURE → architecture, SURFACE → road_ground, then hands off to the v37 routine with the numbers it wants.

So the v37 cropper's tuning for cars is being applied to anything countable, its architecture tuning to any structure, and its road-to-chunking path to any surface. That's a coarse mapping, and in practice it's fine, because those three buckets are where the geometry differs. A car and a person are both "an object with a silhouette"; a facade and a staircase are both "a thing you improve edges on"; asphalt and sky are both "a field you inject detail into and never re-imagine".

Inputs, outputs, and the none path

Required: image, mask, category, kind, plus max_groups (default 8), context_px (default 160), target_long_side (default 1792). Outputs: crops, crop_masks, stitch, info.

Note this is one mask (a MASK tensor, probably the union for that sector) whereas the v39/v40 croppers take masks plural and iterate instances. If your sector produced individual per-object masks, this node will flatten them.

category="none" is handled explicitly: it builds an all-zero mask the size of the image and calls the cropper with road_ground, max_groups=1, context_px=32, target_long_side=768. You get one small crop with an empty mask, which is the right answer - an inactive sector should produce no edit, not an error. That said, if you're on the v38 generation already, use DOGMAAdaptiveGroupedCropsV381 instead. It's the same node with a cleaner no-op that also catches the case where the cropper returns "no selected regions" on an active category. V38 lets that empty result through and you may end up with a zero-length crop list.

Install

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

Manager → DOGMA Nodes works too; restart after either way, since the nodes register at import. No Python dependencies declared at all (dependencies = []), which is unusual enough for a detailer pack to be worth repeating - the pain in this ecosystem is nearly always dependency conflicts at install time, and this pack sidesteps it. It does not ship or download models: you supply the segmenter, the VLM for planning, and FLUX.2 Klein for the local passes.

Common issues

A sector produces zero crops and the graph stalls. That's the V38 no-op gap described above - move to V381, or gate the branch with DOGMACategoryMaskGate so an unused category arrives with a zero mask.

Everything is treated like a car. The kind input must be literally OBJECT, STRUCTURE or SURFACE; anything else makes the node assume OBJECT. Check what your planner actually emitted - several of the earlier plan nodes default unknown kinds to OBJECT rather than erroring.

Giant flat surfaces come back in pieces. Intended. architecture, vegetation and road_ground regions larger than 1.35 × target_long_side get chunked into overlapping windows so each one fits the model's usable resolution. If you don't want the split, raise target_long_side - but you'll pay for it in VRAM and time.

CategoryDOGMA/Semantic Detailer

Inputs (7)

NameTypeDefaultDescription
imageIMAGE
maskMASK
categorySTRING
kindSTRING
max_groupsINT81–16
context_pxINT16032–512
target_long_sideINT1792768–3072

Outputs (4)

NameTypeDescription
cropsIMAGE
crop_masksMASK
stitchDOGMA_STITCH
infoSTRING