SEGS to Bounding Boxes
SEGS Out, Native Bounding Boxes In — The Bridge Back to Vanilla ComfyUI
- segs
- bboxes
SEGS is a lovely container right up until you need to hand a detection to something that doesn't speak Impact Pack. ComfyUI has its own BOUNDING_BOX type now, shared by native nodes like SAM3 Detect and the detector nodes that lived outside this pack, and the two formats never talked to each other. SEGS to Bounding Boxes is the one-way adapter: take your detections and give them to the rest of ComfyUI as plain boxes.
What comes out
Give it SEGS, get a BOUNDING_BOX output called bboxes. Each box is a dict of x, y, width, height, label and score - the label and score carried straight over from the SEG they came from, so a YOLO face detection arrives labelled as a face with its confidence intact.
The interesting behaviour is with video, and it's worth understanding because it's where this node differs from "just take the bbox field". When a SEG holds one mask for all frames, the obvious approach breaks - one box can't describe a subject that moves. So for SEGS whose masks are per-frame, the node walks the frames and emits the box of where that frame's mask actually lies, cropped coordinates resolved back into image space. The output shape is one list of boxes per frame, which is what the native nodes expect for frame-indexed data.
If the masks aren't per-frame, each SEG contributes its single bbox as one entry. And this is the thing that catches people: Simple Detector for Video (SEGS) in Pivot SEGS mode deliberately holds one mask for all frames, so its boxes come out as a single list that gets used for every frame. That's correct behaviour, not a bug - the SEGS genuinely only knows one silhouette.
Inputs and outputs
segs- SEGS from anywhere: a detector, a filter,SAM3 Video Detector (SEGS), a mask converted to SEGS, whatever.- Output:
bboxes-BOUNDING_BOX, a list of boxes per frame.
Where to wire it: into SAM3 Detect, Create Bounding Boxes, mask-drawing or crop nodes that take the native type, or into Bounding Boxes to SEGS if you want to round-trip through some native processing and come back. It's also the cheapest way to debug a detector - print or assert on the boxes instead of squinting at masks.
What it does not do: keep the mask. Boxes are rectangles; everything about the silhouette is gone. If downstream needs a mask, stay in SEGS and use SEGSPreview.
Install
Part of Impact Pack, ImpactPack/Util.
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, then restart. Manager users search ComfyUI Impact Pack. On first launch the pack writes impact-pack.ini and downloads a default SAM checkpoint into models/sams - drop an empty file named skip_download_model in custom_nodes to skip that.
Note this node has no model dependency of its own, but if the SEGS you're converting came from a YOLO detector you're using UltralyticsDetectorProvider, which lives in the separately-installed Impact Subpack since v8.0. The base pack does not pull it in.
Semi-obvious gotcha
BOUNDING_BOX is a comparatively new type, and custom-node packs that predate it may not accept it, even if they theoretically take boxes. If a node refuses the wire, that's a version gap rather than a mistake in your graph. ComfyUI core moves fast here, so keep both ComfyUI and the pack current - the pack's own compatibility notes are full of "requires ComfyUI version X or later" for exactly this kind of structural change.
The other one: scores. Most SEGS carry a real confidence, but SEGS that were hand-built - from masks, from tiles, from bounding boxes you supplied - often carry 1.0 because there was never a model to score them. If you're filtering boxes downstream by score, expect everything from a mask-based pipeline to be a perfect 1.0 and filter by size or label instead.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| segs | SEGS | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| bboxes | BOUNDING_BOX | A list of boxes for each frame. Each box has x, y, width, height, label and score. |