Nodes/ComfyUI-SAM3/SAM3 Interactive Collector
ComfyUI Node

SAM3 Interactive Collector

SAM3's interactive collector

By PozzettiAndrea·Created 10 months ago·Updated 20 days ago· 572
SAM3 Interactive Collector
  • sam3_model_config
  • image
  • masks
  • visualization
  • multi_prompts
multi_prompts_store[]

Most SAM nodes make you wire up a prompt, queue the graph, stare at the result, then edit a JSON string and queue again. This one skips that whole loop. The SAM3 Interactive Collector shows your image on a canvas right inside the node, lets you click in positive and negative points or drag boxes, and has a Run button that segments instantly - no full workflow re-run needed.

It ships inside ComfyUI Speech Bubble Detector, a fork of the community's comfyui-sam3 aimed at manga/manhwa cleanup. Don't let the pack name fool you: the interactive collector is the pack's general-purpose masking node, and it's the one you'd reach for when you want to hand-pick which bubbles - or which anything - to mask without babysitting the graph.

How it works

The trick is that this node is an output node that owns the model. The other collectors in the pack (SAM3 Point/BBox/Multi-Region Collector) just emit prompt structures for downstream nodes to consume. This one takes a sam3_model_config and runs SAM3 itself.

First time through, it does the heavy lifting: builds the model, runs the image through the processor to get the image state, and caches all of it keyed to the node's id. That's the "queue the workflow once" requirement. After that, the Run button calls a custom API route (/sam3/interactive_segment_one) that reuses the cached state and runs predict_inst per prompt - so you can scrub a mask, click Run, see the overlay, adjust, click again, all without touching the queue. It picks the best mask per region (SAM3's multimask output, scored and argmax'd), composites everything into an overlay, and pastes the result back to full image size.

One thing worth knowing: when you draw a positive box, the pack treats it as a crop-lock - segmentation runs only inside that region, which is exactly what you want when a bubble overlaps art you'd rather it not swallow.

The inputs and outputs that matter

  • sam3_model_config - from the (Down)Load SAM3 Model node. The model auto-downloads to ComfyUI/models/sam3/sam3.safetensors on first use, so expect a multi-gigabyte download and some patience on the first queue.
  • image - the page to segment. Left-click adds positive points, shift/right-click negative, and you can drag boxes. The tooltip says it best: "Draw points/boxes on the canvas, then click Run for a live mask preview."
  • multi_prompts_store - a JSON string holding your regions. The canvas writes to it, but it's also the way programmatic prompts (like the pack's JSON Regions to SAM3 Boxes API helper) can feed in.

Outputs: masks (a MASK tensor, one per region) and visualization (the image with masks overlaid) are what you preview; multi_prompts is the structured SAM3_MULTI_PROMPTS object you can hand to the pack's main Speech Bubble Detector node if you want its text-prompt pass to pick up where your clicks left off.

Install

Easiest route is ComfyUI Manager - search Speech Bubble Detector. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/daminik124124-ops/ComfyUI-Speech-Bubble-Detector.git

Then restart ComfyUI. The pack pulls in comfy-env for its isolation/API plumbing. The one real gotcha from the README: don't install this side-by-side with the original comfyui-sam3 - node class names collide, and this fork is meant to replace it.

Common issues

  • "Model not loaded. Queue the workflow first (Ctrl+Enter)." This is the big one, and the error message is telling you the fix. The Run button only works after the graph has queued once, because that first queue builds the cached model state. Queue once, then go interactive.
  • First run is slow. Model download plus SAM3's backbone on a 1008px processor resolution. If you enabled compile on the loader, add a warm-up pass that can take minutes - it pays off on every click after.
  • VRAM warnings on big pages. The source explicitly flushs CUDA caches before the forward pass to dodge CUDA error: invalid argument on large images in low-VRAM mode. If you hit that, lowering the input resolution or letting the model sit in fp16 usually does it.
CategorySAM3

Inputs (3)

NameTypeDefaultDescription
sam3_model_configSAM3_MODEL_CONFIGSAM3 model config from LoadSAM3Model node.
imageIMAGEImage to segment. Draw points/boxes on the canvas, then click Run for a live mask preview.
multi_prompts_storeSTRING[]

Outputs (3)

NameTypeDescription
masksMASK
visualizationIMAGE
multi_promptsSAM3_MULTI_PROMPTS