Nodes/ComfyUI-XJNodes/SEGS Filter By Label
ComfyUI Node

SEGS Filter By Label

Keep only the faces, drop the hands

By alexjx·Created 10 months ago·Updated 4 months ago· 0
SEGS Filter By Label
  • segs
  • filtered_segs
labels
modeinclude

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 labels empty, include returns no segments (an empty SEGS) while exclude returns everything. That asymmetry is intentional, but it's also how you accidentally delete all your detections.
  • Matching is exact and case-sensitive - Face will not match face. 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) or exclude.
  • 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.

CategoryXJNodes/segs

Inputs (3)

NameTypeDefaultDescription
segsSEGS
labelsSTRING
modeoptCOMBOinclude2 options: include, exclude

Outputs (1)

NameTypeDescription
filtered_segsSEGS