SAM3 Video Detector (SEGS)
Detect Once, Get Masks For Every Frame
- image_frames
- bbox_detector
- sam3_model
- SEGS
Detecting every frame of a video independently is how you get masks that flicker: one frame the face is found, the next it isn't, the third the mask jumps two pixels left. Tracking solves it by finding the thing once and following it. SAM3 Video Detector (SEGS) does exactly that - a box detector picks out your subjects in a single frame, SAM3 propagates masks through the rest, and you get back SEGS with a mask for every frame. Then the Impact Pack detailers can work per frame, which is how you detail a face across a whole clip.
The mechanism, step by step
You give it the frames as an image batch and a BBOX_DETECTOR - practically that's UltralyticsDetectorProvider from the Impact Subpack, or ONNXDetectorProvider from this pack. The node runs that detector on the first frame at your bbox_threshold. If it finds nothing there, it flips the batch, detects in the last frame, tracks backwards, and flips the resulting masks back into forward order. Nice touch: a subject that only appears midway through the shot still gets tracked.
Then SAM3 takes those first-frame boxes and propagates masks across all frames, one track per detected object. Each track's masks are merged into a single silhouette so the SEG gets one generous crop region covering everywhere the subject goes - which is what you want, since the crop region has to hold the whole track. The per-frame masks are then stacked into one cropped mask batch, thresholded at 0.5 internally, and the SEGS comes out with one SEG per tracked object.
Notice what's missing compared to SAM2 Video Detector (SEGS): there's no SAM threshold widget. SAM2 returns scores you can threshold; SAM3 returns masks. So bbox_threshold is the only score-ish knob you get, and it only applies to the first-frame detection. If a subject starts being tracked and then drifts, no slider will rescue it - that's a detector or crop problem.
The inputs that matter
image_frames- the video as an image batch. Load it, don't feed it a single frame.bbox_detector- what finds the objects to track. This is the one that decides what you're tracking; the SAM3 model decides how well the silhouette follows.sam3_model- must be a SAM3 model loaded throughSAMLoader (Impact). Feed it a SAM2 file and the node errors out telling you a SAM3 model is required.bbox_threshold- default 0.5. Objects the detector scores lower aren't tracked.crop_factor- default 3.0. How much wider than the tracked object each crop region is. Raise it for fast motion, since the region has to contain the whole track.drop_size- default 10. Objects smaller than this in pixels are dropped. Raise it to ignore background clutter in a crowd.
Output is a single SEGS. Wire it into Detailer (SEGS) or SEGSDetailer, then SEGSPaste - the per-frame mask batch is what makes the detailer process each frame rather than one averaged region. SEGS to Bounding Boxes is a good companion if you want per-frame boxes for native nodes; that node reads a frame's mask and gives you where it lies.
Getting the model
SAM3 needs ComfyUI 0.21.0 or later and a file whose name starts with sam3. Grab it:
cd ComfyUI
hf download Comfy-Org/sam3.1 checkpoints/sam3.1_multiplex_fp16.safetensors --local-dir models
That's 1.75 GB and lands in ComfyUI/models/checkpoints, where ComfyUI's own SAM3 nodes look, or you can put it in ComfyUI/models/sams. It's under the SAM License, so read it if you're doing anything commercial.
Good news on dependencies: SAM3 runs on ComfyUI's own implementation with no extra package. You do not need requirements-sam2.txt for this - that's only for SAM2 .pt models, and it's no longer installed by default because sam2 isn't on PyPI and pulling it can shuffle your torch build.
Installing the pack
cd ComfyUI/custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Impact-Pack
cd ComfyUI-Impact-Pack
pip install -r requirements.txt
Windows portable: ..\..\..\python_embeded\python.exe -m pip install -r requirements.txt. Restart. Manager users: search ComfyUI Impact Pack. The core pack does not include UltralyticsDetectorProvider - that's the separate ComfyUI-Impact-Subpack - so a YOLO-based bbox_detector needs a second install. First launch creates impact-pack.ini and downloads the default SAM checkpoint into models/sams unless you drop an empty skip_download_model file in custom_nodes.
Where it goes wrong
"A SAM3 model must be provided" - SAMLoader (Impact) gave you a SAM or SAM2 model, or sam_editor_model in impact-pack.ini points at the wrong file. Check the filename prefix.
Nothing tracked, empty SEGS - the detector found nothing in the first or last frame at your threshold. Lower bbox_threshold, or check the detector actually knows your subject class.
The track wanders off halfway - normal failure of box-prompted tracking. Shorter clips, a tighter crop_factor and a better detector for the specific class do more than any slider. This is also the difference between "SAM3 is magic" and "SAM3 is a tracker": it follows what you gave it, including mistakes.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| image_frames | IMAGE | The frames of the video, as a batch of images. | |
| bbox_detector | BBOX_DETECTOR | Finds the objects to track in the first frame. When it finds none there, the last frame is used and the video is tracked backwards. | |
| sam3_model | SAM_MODEL | A SAM3 model loaded through SAMLoader (Impact). | |
| bbox_threshold | FLOAT | 0.500–1 | Objects that the detector scores below this value are not tracked. |
| crop_factor | FLOAT | 3.01–100 | How much wider than the tracked object the crop region of each SEG is. |
| drop_size | INT | 101–16384 | Objects smaller than this many pixels in width or height are dropped. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| SEGS | SEGS | — |