SAM3 Point Segmentation
Point-and-box masking when text isn't precise enough
- sam3_model
- image
- positive_points
- negative_points
- box
- mask
- mask_logits
- visualization
- boxes
- scores
Displayed as "SAM3 Point Segmentation," this is the node you reach for when a text prompt can't nail the exact thing you want. Text segmentation is great at "the dog," but useless at "that specific fold of fabric" or "just the left eye." Here you point at what you want - a foreground click or two, maybe a negative click to say not that - or draw a box around it, and SAM3 grows a precise mask from those hints. It's the classic interactive SAM workflow, the reason people fell for Segment Anything in the first place.
Where it fits: this is targeted selection feeding something else. You get a clean MASK, then that mask goes into inpainting, regional prompting, a composite, or an Impact Pack refinement chain. It's not a background remover - for plain subject-vs-background, BiRefNet is less fuss. It's for when you need surgical control over which pixels.
How it works
You feed it prompts - points and/or a box - and SAM3 predicts the mask that best explains them. Positive points say "include this region," negative points say "exclude this," and a box constrains the search to a rough area. The interesting knob is use_multimask: SAM models can return several candidate masks at different scales (the whole person, just the torso, just the shirt) and let you keep the best-scoring one. Turn it on when a single click is ambiguous about how much to grab.
The inputs and outputs that matter
Required are just sam3_model (from LoadSAM3Model) and image. Everything else is optional, and you supply the prompts through the pack's other nodes:
positive_points/negative_points(SAM3_POINTS_PROMPT) - include/exclude clicks, built by SAM3 Point Collector or Combine Points.box(SAM3_BOXES_PROMPT) - a bounding box from Create Box / BBox Collector to focus the mask.use_multimask(default on) - let SAM3 propose multiple candidate masks so it can pick the best fit.output_best_mask(default on) - return the single top-scoring mask rather than the stack.refinement_iterations(default0, up to 10) - extra passes to tighten the mask edge; bump it a little if boundaries look rough.offload_model(default off) - free VRAM after the run.
Outputs: mask (MASK) is the one you'll use. mask_logits (MASK) is the raw pre-threshold mask for advanced blending. visualization (IMAGE) is a preview overlay. boxes and scores (STRING) are the JSON box and confidence data.
How to install it
Ships with the pack. Manager: search SAM3, install the top version. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/PozzettiAndrea/ComfyUI-SAM3.git
cd ComfyUI-SAM3
pip install -r requirements.txt --upgrade
python install.py
restart, and make sure sam3.pt is in ComfyUI/models/sam3/ (the install.py step handles the download). The README notes an experimental comfy-env/pixi one-click path you may see kick in.
Common issues & troubleshooting
The mask grabs way more or less than you meant. That's the multimask ambiguity - one point can mean "the shirt" or "the whole person." Add a second positive point inside the object and a negative point on what you don't want, or keep use_multimask on with output_best_mask so SAM3 picks the sensible candidate.
Edges look ragged. Nudge refinement_iterations up a couple of steps. It's cheap and cleans boundaries without you re-clicking.
Nothing connects - where do the points come from? This node doesn't collect clicks itself. Feed it from SAM3 Point Collector (interactive), or build prompts numerically with SAM3 Create Point → Combine Points and Create Box. The box input wants the SAM3_BOXES_PROMPT type, so use BBox Collector or Combine Boxes, not a lone Create Box.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| sam3_model | SAM3_MODEL | SAM3 model loaded from LoadSAM3Model node | |
| image | IMAGE | Input image to perform segmentation on | |
| positive_pointsopt | SAM3_POINTS_PROMPT | Foreground points - segment objects at these locations. Connect from SAM3CombinePoints or SAM3PointCollector. | |
| negative_pointsopt | SAM3_POINTS_PROMPT | Background points - exclude these areas from segmentation. Connect from SAM3CombinePoints or SAM3PointCollector. | |
| boxopt | SAM3_BOXES_PROMPT | Box prompt to constrain segmentation region. Only first box is used. Connect from SAM3CombineBoxes. | |
| refinement_iterationsopt | INT | 00–10 | Number of refinement passes. Each pass feeds the mask back for cleaner edges. |
| use_multimaskopt | BOOLEAN | true | If True, generates 3 mask candidates at different granularities (subpart/part/whole). Better for ambiguous single clicks. If False, generates single mask directly - faster, good for multiple points. |
| output_best_maskopt | BOOLEAN | true | If True, automatically selects the highest-scoring mask. If False, outputs all mask candidates (3 if use_multimask=True) so you can choose. |
| offload_modelopt | BOOLEAN | false | Move model to CPU after segmentation to free VRAM (slower next run) |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| mask | MASK | — |
| mask_logits | MASK | — |
| visualization | IMAGE | — |
| boxes | STRING | — |
| scores | STRING | — |