Count Elts in SEGS
How many regions did the detector find?
- segs
- INT
It counts. You give it a SEGS, it tells you how many regions are inside as a plain integer. "Elts" is short for elements - the individual detections. If your detector found three faces, this outputs 3. That's the entire node.
The reason it exists is logic. A SEGS is Impact Pack's bundle of detections (a header plus one "SEG" per hit, each with a bounding box, mask, confidence, and label), and once you're building conditional or looping workflows you frequently need to branch on how many things were detected. Zero faces? Skip the detailer. More than one? Handle each. Exactly one? Fast path. You can't make that decision without a number, and this is the node that produces it.
How it works
It reads the SEGS and returns the length of its element list as an INT. No filtering, no thresholding - it counts whatever's in the SEGS at that point in the graph, so where you place it matters. Put it after a SEGS filter and you're counting what survived the filter; put it right after the detector and you're counting raw detections. That's the useful bit: pair it with a filter (label, range, non-max-suppression) and the count reflects exactly the subset you care about.
The input and output
segs(SEGS, required) - the detections to count. Only input.
Output is one INT. It's built to feed Impact Pack's logic nodes: wire it into ImpactCompare (is the count > 0?), an ImpactConditionalBranch, or a loop's stop condition. It also just works as a readout if you convert it to a display, when you want to know how many hits a detector is producing.
How to install it
Part of Impact Pack, one install. ComfyUI Manager: search ComfyUI Impact Pack, Install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Impact-Pack
then pip install -r requirements.txt in ComfyUI's Python env (portable: python_embeded\python.exe -m pip ...), restart. The pack is ltdrdata's - the same maintainer as ComfyUI-Manager - so it's mainstream and trusted. This node needs nothing beyond the pack; whatever detector produces the SEGS may need its own model.
Common issues & troubleshooting
Nothing really breaks here, but two things to keep straight. The count is of SEGS elements, not pixels or masks or batch frames - if a single detection has a big mask, it still counts as one. And placement is everything: if you're getting a surprising number, check whether a filter sits between the detector and this node, because you're counting post-filter. To actually act on the count you'll need the rest of the logic family (Compare, a conditional branch), since a bare INT on its own doesn't change anything - this node reports, it doesn't decide.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| segs | SEGS | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| INT | INT | — |