SEGS Filter By Label
Keep only the faces, drop the hands
- segs
- filtered_segs
A good detector doesn't just find things, it names them. Impact Pack's SEGS stream carries a label on every segment - face, person, hand, whatever the model you're using calls its classes. XJSegsFilterByLabel is the node that lets you keep or drop segments based on those labels, so you can point a detector at a whole scene and then tell the workflow "actually, only touch the faces."
Mechanically it's simple and predictable. You give it a comma-separated list of labels, and it keeps segments whose label matches (mode include) or keeps everything except matches (mode exclude). Two edge behaviors are worth knowing, because they're easy to trip over:
- If you leave
labelsempty,includereturns no segments (an empty SEGS) whileexcludereturns everything. That asymmetry is intentional, but it's also how you accidentally delete all your detections. - Matching is exact and case-sensitive -
Facewill not matchface. And the labels depend entirely on your detector model's vocabulary, so check what it actually emits before writing filters.
The filtered_segs output stays a proper SEGS tuple, keeping the original image shape metadata, so it feeds straight back into an Impact Pack Detailer or into further SEGS nodes.
The interface:
segs- SEGS in.labels- comma-separated strings, e.g.face, person.mode-include(default) orexclude.- Output:
filtered_segs.
Where it earns its place: in a detailer workflow where you don't want every detection processed. Detectors find hands, and hands cost a detail pass each; filtering them out before the Detailer node saves both time and the risk of mangling them. It also composes well with the pack's SEGS Count - filter by label, then count what survived, to build gating logic off the result.
Install is the shared pack routine:
cd ComfyUI/custom_nodes
git clone https://github.com/alexjx/ComfyUI-XJNodes
Restart ComfyUI, find it under XJNodes/segs, or use ComfyUI Manager and search "ComfyUI-XJNodes". No model files, empty requirements.txt - it only needs Impact Pack around to provide SEGS in the first place.
The honest caveat: this is a small personal-use pack, and the exact behavior at the edges (empty labels, case sensitivity) is only discoverable by testing. It's a ten-minute check once, and the filter is reliable after that.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| segs | SEGS | — | |
| labels | STRING | — | |
| modeopt | COMBO | include | 2 options: include, exclude |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| filtered_segs | SEGS | — |