ComfyUI Node
kubakub regions from sam3
Find facade parts automatically and get one named mask per object, ready for regions from masks. Uses SAM 3.1 (core SAM3 Detect) with text prompts (one line per kind of object, every hit its own mask), points from the KJNodes Points Editor (one object per positive point) and boxes. Points and boxes get a second pass on a crop at full resolution (detail), so small facade parts keep their edges. Optionally saves every mask as <name>.png into a project Masks folder.
kubakub regions from sam3
- model
- image
- clip
- bboxes
- scope
- boxes
- masks
- names
- preview
- report
◄prompts►
◄point_modeone region per point►
◄threshold0.50►
◄refine_iterations2►
◄detailtrue►
◄drop_groupstrue►
◄min_area64►
◄positive_coords—►
◄negative_coords—►
◄point_names►
◄save_folder►
◄overwritefalse►
Categorykubakub/2d/regions
Inputs (18)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | SAM 3.1: Load Checkpoint with sam3.1_multiplex_fp16. | |
| image | IMAGE | The matrix or render to segment (first image of a batch). | |
| prompts | STRING | One line per kind of object: 'name = text' or just 'text'. ':N' caps the hits (default 50). Every hit becomes a mask name_01, name_02 ... in reading order. | |
| point_mode | COMBO | one region per point | one region per point: each positive point is its own object (negative points apply to all). all points one region: core behaviour, one object from all points. |
| threshold | FLOAT | 0.500–1 | Text detection confidence. |
| refine_iterations | INT | 20–5 | SAM decoder refinement passes (core). |
| detail | BOOLEAN | true | Points and boxes: segment again on a crop around the object, so the 1008 px model input covers the object instead of the whole 4K frame. |
| drop_groups | BOOLEAN | true | Text: drop hits that cover two or more other hits of the same prompt (SAM often adds one mask for the whole row). |
| min_area | INT | 640–10000000 | Masks smaller than this (pixels) are dropped. |
| clipopt | CLIP | The CLIP output of the same Load Checkpoint; needed for text prompts. | |
| positive_coordsopt | STRING | Points JSON (KJNodes Points Editor positive_coords, in image pixels or normalized). | |
| negative_coordsopt | STRING | Points that must stay outside (Points Editor negative_coords). | |
| bboxesopt | BBOX | Boxes (Points Editor bbox, xyxy); one object per box. | |
| point_namesopt | STRING | Names for the point objects in click order, then the boxes (bboxes first, then boxes). Missing: point_01.., box_01.. | |
| scopeopt | MASK | Masks are clipped to this; objects mostly outside it are dropped. | |
| save_folderopt | STRING | Optional: write every mask as <name>.png (white on black, image size) into this folder, e.g. the project Masks folder. | |
| overwriteopt | BOOLEAN | false | Replace existing PNGs of the same name in save_folder. |
| boxesopt | BOUNDING_BOX | [object Object] | Boxes from core nodes (the bboxes output of SAM3 Detect, in image pixels); one object per box, added after the Points Editor boxes. Of a batch, the boxes of the first image are used. |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| masks | MASK | One mask per object (batch), same order as names. |
| names | STRING | One name per line; plug into regions from masks. |
| preview | IMAGE | The found objects coloured and numbered over the image. |
| report | STRING | Every object with its size in pixels, how it was found and its score, plus notes (dropped hits, saved files). |