SEGS to Mask Batch
Every detected region stacked into one MASK
- segs
- MASK
Takes a SEGS and gives you back the masks of every detected region as a single batched MASK. Same idea as SEGS to Mask List, but stacked into one batch tensor instead of handed over as separate list items - which is what a lot of ComfyUI's mask and image nodes actually want to consume.
If SEGS is new to you: it's Impact Pack's data type for detections. A detector (face/hand YOLO, SAM, a segmenter) returns a SEGS - a header plus one "SEG" per hit, each carrying a bounding box, a mask, a confidence, and a label. This node reaches in, grabs each region's mask, and stacks them.
How it works
It collects the mask from each SEG and packs them all into one batched MASK - think of it as a stack of N mask frames, one per detection. That batch flows through downstream nodes as a unit. The contrast to know is with SEGS to Mask List: the list version emits the same masks as separate items so nodes iterate over them one at a time; the batch version stacks them so nodes treat the whole set together. Which you want depends entirely on the next node. Batch is the right call when you're heading into something that processes a mask batch in one shot - a batched composite, or a node that expects MASK batch shape.
The input and output
segs(SEGS, required) - the detections to convert. Only input.
Output is a single MASK (batched - all regions stacked). Feed it wherever a batched mask belongs, or run it through Masks to Mask List if you later need per-item iteration.
How to install it
Bundled with Impact Pack. Through ComfyUI Manager: search ComfyUI Impact Pack, Install, restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Impact-Pack
then pip install -r requirements.txt in ComfyUI's Python environment (portable build uses python_embeded\python.exe -m pip), restart. Pack's by ltdrdata, the ComfyUI-Manager author - safe and mainstream. No models needed for this node; the detector upstream may pull one (SAM auto-downloads to ComfyUI/models/sams, YOLO detectors sit in the separate Impact Subpack).
Common issues & troubleshooting
Watch the batch/list distinction - it's the one thing that bites. Hand a batch to a node that wanted a list and it'll process the stack as a single unit or throw a shape error; swap in SEGS to Mask List or use Masks to Mask List to split it. There's also a subtle geometry point: these masks are full-frame masks sized to the source image, so stacking assumes every detection shares that frame - which they do when they come from one detector run on one image. Feed it a SEGS whose regions came from differently-sized sources and the batch can't line up. In normal single-image detection you'll never hit that. Empty SEGS in, empty batch out - that's the detector finding nothing, not a failure of this node.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| segs | SEGS | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MASK | MASK | — |