Nodes/ComfyUI Impact Pack/SEGS to Mask List
ComfyUI Node Runs on cloud

SEGS to Mask List

One mask per detected region

By ltdrdata·Created 3 years ago·Updated 4 months ago· 3,242
SEGS to Mask List
  • segs
  • MASK

You've detected some regions and now you want their masks - separately, one per region - so you can process each on its own. That's this node. It takes a SEGS and returns a MASK list, where each item is the mask of one detected thing. Faces, hands, whatever your detector found, each as its own mask ready to be looped over.

Backing up: a SEGS is Impact Pack's container for detections. A detector returns it - a header plus one "SEG" per hit, each holding a bounding box, a mask, a confidence, and a label. The mask is the pixel-accurate area of that detection. This node's whole job is to hand those masks back to you as ComfyUI-native MASK data, unpacked into a list.

How it works

It iterates the SEGS and emits each region's mask as a separate list item. Because it's a list, downstream nodes execute once per mask - so a Save or a mask-op node runs independently on each face/hand/region rather than on a merged blob. That's the key difference from its sibling SEGS to Mask Batch, which stacks the same masks into a single batched MASK tensor. List when you want per-item iteration; batch when a node wants them stacked. Same masks, different packaging.

The input and output

  • segs (SEGS, required) - the detections whose masks you want. That's the only input.

Output is MASK as a list - one mask per detected region. Route it into whatever consumes masks per-item: mask math, Mask List to Masks (to convert to a batch), a compositing step, or a mask preview.

How to install it

It's part of Impact Pack - one install gets you the lot. ComfyUI Manager: search ComfyUI Impact Pack, Install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Impact-Pack

then pip install -r requirements.txt inside ComfyUI's Python env (portable: python_embeded\python.exe -m pip ...), restart. The pack is by ltdrdata, who also wrote ComfyUI-Manager, so it's a trusted, mainstream install. This node needs no models of its own; the detector feeding it might (SAM auto-downloads to ComfyUI/models/sams; YOLO detectors are in the separate Impact Subpack).

Common issues & troubleshooting

The usual snag is list-versus-batch. If a downstream node expects a single batched mask and you feed it this list, it'll either process only the first item or complain - swap to SEGS to Mask Batch, or insert Mask List to Masks to convert. Going the other way, if a node wants to iterate and you handed it a batch, you need the list, which is exactly what this node gives you. Beyond that: an empty SEGS produces an empty list, which is the detector finding nothing rather than a fault here. And remember these masks are the detected silhouettes at their native resolution - if you need them dilated or blurred before use, that's Dilate Mask / Gaussian Blur Mask, not something this node does.

CategoryImpactPack/Util

Inputs (1)

NameTypeDefaultDescription
segsSEGS

Outputs (1)

NameTypeDescription
MASKMASK