Nodes/ComfyUI-SAM3/SAM3 Combine Boxes
ComfyUI Node

SAM3 Combine Boxes

Merge single boxes into one prompt SAM3 accepts

By PozzettiAndrea·Created 9 months ago·Updated 27 days ago· 557
SAM3 Combine Boxes
  • box_1
  • box_2
  • box_3
  • box_4
  • box_5
  • boxes_prompt

The box version of Combine Points, and it solves the same type mismatch. SAM3 Create Box gives you a single SAM3_BOX_PROMPT, but the segmentation nodes want the plural SAM3_BOXES_PROMPT. This node merges up to five individual boxes into that one bundle. Even if you've only got a single box, you still route it through here to get the type the segmentation nodes accept - it's the mandatory little adapter between Create Box and the real work.

The reason it takes several: you often want to segment more than one region with boxes, or fence off an area with a negative box while keeping a positive one. Bundling them lets SAM3 consider the whole set at once instead of you running separate passes.

How it works

Five optional inputs, box_1 through box_5, each accepting one SAM3_BOX_PROMPT. Wire in whatever you have and it collects them into a single SAM3_BOXES_PROMPT. Each box keeps the positive/negative flag it was created with, so one bundle can carry both include and exclude boxes. Unconnected inputs are ignored.

The inputs and outputs that matter

  • box_1box_5 (all optional, type SAM3_BOX_PROMPT) - the individual boxes to merge, each from a SAM3 Create Box node.

Output is boxes_prompt (SAM3_BOXES_PROMPT) - feed it into the box input of SAM3 Point Segmentation, or the positive_boxes input on SAM3 Text Segmentation or Video Segmentation. That plural type is what those nodes expect.

Worth knowing: the interactive SAM3 BBox Collector already outputs SAM3_BOXES_PROMPT directly, so if you drew your boxes on the image you skip this node entirely. Combine Boxes is specifically for the numeric path - assembling boxes you built with Create Box.

How to install it

Ships with the pack. Manager: search SAM3, install the highest 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

then restart. The sam3.pt model belongs in ComfyUI/models/sam3/ for the segmentation nodes. The README flags an experimental comfy-env/pixi one-click install.

Common issues & troubleshooting

Create Box won't connect to my segmentation node. By design - that's the singular-vs-plural type gap this node closes. Pass the box through here to convert SAM3_BOX_PROMPT into SAM3_BOXES_PROMPT, even for a single box.

Only five inputs - what if I need more boxes? Five is the cap here. If you genuinely need more regions, that's a sign you want the multi-region workflow (Multi-Region Collector → Multiprompt Segmentation) rather than stacking boxes.

A negative box isn't excluding anything. Check it was created with is_positive off in Create Box, and that you wired the bundle into an input that reads negatives. A box still flagged positive just adds another region to include.

Feels like an extra step for nothing. For hand-drawn boxes it is unnecessary - use the BBox Collector, which emits the plural type straight away. Combine Boxes only exists to serve the numeric Create Box route.

CategorySAM3/prompts

Inputs (5)

NameTypeDefaultDescription
box_1optSAM3_BOX_PROMPTConnect box prompts from SAM3CreateBox nodes. Combines multiple boxes into a single prompt for SAM3Segmentation.
box_2optSAM3_BOX_PROMPTConnect box prompts from SAM3CreateBox nodes. Combines multiple boxes into a single prompt for SAM3Segmentation.
box_3optSAM3_BOX_PROMPTConnect box prompts from SAM3CreateBox nodes. Combines multiple boxes into a single prompt for SAM3Segmentation.
box_4optSAM3_BOX_PROMPTConnect box prompts from SAM3CreateBox nodes. Combines multiple boxes into a single prompt for SAM3Segmentation.
box_5optSAM3_BOX_PROMPTConnect box prompts from SAM3CreateBox nodes. Combines multiple boxes into a single prompt for SAM3Segmentation.

Outputs (1)

NameTypeDescription
boxes_promptSAM3_BOXES_PROMPT