DOGMA Object Cluster Crops v31 — Compact Adjacent Groups
Same whole-object rule, fewer and denser crops
- image
- reference_image
- masks
- crops
- reference_crops
- crop_masks
- stitch
- info
DOGMAObjectClusterCropsV31 is v27 with the grouping turned up and the crop count turned down. That's the whole delta, and it's a deliberate trade: fewer sampler calls on a slower model, bought by letting a crop contain a small crowd of adjacent instances instead of one clean object.
If you came here from the v27 page looking for a feature list, relax - every input has the same name, the same range and the same default. image, reference_image, masks, category, group_radius, context_px, max_source_side, target_long_side, max_crops, mask_threshold. Wiring is identical. What changed is what the node does with them.
What actually differs
The per-category object cap inside a single crop goes up: 4 for vehicles, 3 for people, architectural details, street furniture, faces and hands, 3 as the fallback (v27 was 3/2/2). Class docstring, verbatim: "compact grouping: several truly adjacent instances, never a scene-sized macro region."
Everything upstream of that is unchanged, and it's the part worth understanding. Masks are thresholded, sub-6-pixel specks dropped, anything covering more than 55% of the frame rejected as pathological, boxes deduplicated at ≥0.72 IoU so car and automobile don't become two jobs. Grouping is greedy over group_radius - a maximum bounding-box gap in pixels, not a merge radius you can crank to eat the street - and the crop is the union box plus context_px, snapped to /16, with the member masks rebuilt inside it.
Resizing is still whole-crop only. Long side to target_long_side, hard ceiling of 3.8 MP, max_source_side as an extra conservative ceiling, bicubic for the image and bilinear for the mask. The author's own comment on that field is clear about intent: "max_source_side is a resize ceiling, NEVER a split threshold." No tiles, ever.
Wire it like this
The intended upstream is a category planner - this generation of the pack pairs with a full-frame 4B audit that emits a category plus a SAM prompt. category is what selects the object cap, so an empty or misspelled category silently drops you into the 3-object default branch.
Downstream, crops (IMAGE list) and crop_masks (MASK list) go to your sample/crop model pair, reference_crops is the same rectangle sampled from reference_image, and stitch is the DOGMA_STITCH list - one dict per crop with x, y, width, height, source_width, source_height, group_id, noop, members, object_centric. Hand that to a stitch node and don't rebuild the coordinates by hand. info prints per-group lines like group 1: 2 object(s), source 812x640 -> model 812x640; NEVER split, which is your only diagnostic.
Install
ComfyUI Manager → DOGMA Nodes, or:
cd ComfyUI/custom_nodes
git clone https://github.com/axior/ComfyUI-DOGMA-Nodes
# restart ComfyUI
Zero Python dependencies. The README covers the pack's WAN VACE and sampler nodes only - this node ships undocumented, from the same dogma_semantic_v5641.py file as roughly forty other versions.
Gotchas worth knowing before you blame the model
Denser crops mean harder masks. Three strangers stuck in one crop with one prompt is exactly how you get a room full of clones - the classic ADetailer failure, and it's a crop-composition problem, not a sampler problem. If identity drift shows up on crowds, go back to v27's 2-object cap.
max_crops is your runtime. Each crop item is a separate pass through whatever you wire after it. Dropping from 8 to 5 roughly halves the work; raising the object cap reduces crop count, so v31 is usually the faster node even though each crop is bigger.
No-op output, again. No valid detections, or a detection set where nothing survives, returns a centred 768px crop with a zero mask and noop: True. Stitches skip it. Read info - it will say no valid individual object detections; safe no-op and you'll know the problem is upstream in SAM.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| reference_image | IMAGE | — | |
| masks | MASK | — | |
| category | STRING | — | |
| group_radius | INT | 800–512 | — |
| context_px | INT | 1600–768 | — |
| max_source_side | INT | 4096768–8192 | — |
| target_long_side | INT | 3072768–4096 | — |
| max_crops | INT | 81–16 | — |
| mask_threshold | FLOAT | 0.500.01–0.99 | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| crops | IMAGE | — |
| reference_crops | IMAGE | — |
| crop_masks | MASK | — |
| stitch | DOGMA_STITCH | — |
| info | STRING | — |