ComfyUI Node
BD Parts Refine
Cluster tagged masks by pairwise IoU. Per cluster, pick a canonical tag (shortest label = most general) and merge geometry (union or keep_largest). Use to dedupe SAM3 outputs from synonymous VLM descriptors (e.g. 'shoe' + 'sneaker' + 'left shoe' → one entry). Optional max_parts caps the kept count by area (largest first). Optional debug overlay paints each refined mask with a unique color.
BD Parts Refine
- masks
- image
- refined_masks
- refined_labels
- debug_overlay
- summary
◄labels►
◄iou_threshold0.70►
◄merge_strategyunion►
◄max_parts0►
◄min_pixels64►
◄output_debug_vizfalse►
Category🧠BrainDead/Segmentation
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| masks | MASK | MASK batch (B, H, W) — one per input prompt. | |
| labels | STRING | Parallel labels, one per line. Auto-named part_NN if shorter than batch. | |
| iou_threshold | FLOAT | 0.700–1 | Masks with IoU above this merge into one cluster. Lower = more aggressive dedup. 0.7 is a good starting point. |
| merge_strategy | COMBO | union | union: pixel-wise max across cluster (more inclusive). keep_largest: pick the cluster member with the most pixels (cleaner edges). |
| max_parts | INT | 00–64 | Cap total refined parts (largest area kept). 0 = no cap. |
| min_pixels | INT | 641–10000000 | Drop masks smaller than this before clustering. Filters noise/false-positives from low-confidence prompts. |
| imageopt | IMAGE | Optional source IMAGE — required if output_debug_viz=True. | |
| output_debug_vizopt | BOOLEAN | false | Render a color-coded overlay of the refined masks on the source image. Requires `image` wired. |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| refined_masks | MASK | — |
| refined_labels | STRING | — |
| debug_overlay | IMAGE | — |
| summary | STRING | — |