Nodes/ComfyUI Impact Pack/SEGS Filter (range)
ComfyUI Node Runs on cloud

SEGS Filter (range)

Keep only detections whose size or position falls in a window

By ltdrdata·Created 3 years ago·Updated 4 months ago· 3,242
SEGS Filter (range)
  • segs
  • filtered_SEGS
  • remained_SEGS
target
modetrue
min_value0
max_value67108864

Detectors are enthusiastic. Point a face detector at a crowd photo and it'll flag the two faces you care about plus a smudge in the background and a pattern in someone's shirt. SEGS Filter (range) lets you throw out the junk by an absolute rule: keep only detections whose area, dimensions, position, or confidence fall between a minimum and a maximum you set. It's the cleanup pass that stops your detailer from wasting a full sampling pass re-rendering a false positive.

How it works

For every SEG in the incoming bundle, it reads the metric you chose and checks whether that value sits inside [min_value, max_value]. The ones that pass go out one socket, the ones that fail go out the other. That's it - no generation, no model, just a numeric gate on the detections.

The key contrast is with SEGS Filter (ordered), which ranks detections against each other and takes the top N. Range doesn't care about ranking - it's a hard threshold. "Anything with confidence under 60 is a false positive, drop it" is a range job. "The three biggest regardless of size" is an ordered job.

The inputs and outputs that matter

  • segs (SEGS) - the detections to filter.
  • target - the metric to test. Options include area(=w*h), width, height, box coordinates x1/y1/x2/y2 (filter by position in the frame), length_percent, and confidence(0-100).
  • mode (default on) - whether the range keeps what's inside it or what's outside it. If your results are exactly inverted, this is the toggle.
  • min_value and max_value - the window. The max defaults high enough (67,108,864) to be effectively "no upper bound" for an area filter, so a common pattern is to set only a sensible minimum and leave the max alone.

Two outputs: filtered_SEGS (the keepers) and remained_SEGS (the rejects). Both are live - you can route the rejects somewhere else instead of dropping them.

How to install it

Comes with the pack. ComfyUI Manager: search ComfyUI Impact Pack, Install, restart.

Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Impact-Pack
cd ComfyUI-Impact-Pack
pip install -r requirements.txt

Use ComfyUI's Python for the pip step, then restart. No models required - this node only reads numbers off existing SEGS.

Common issues & troubleshooting

Everything got filtered out, or nothing did. Check mode first - it flips the whole meaning of the range. Then sanity-check your units: area is width×height in pixels, so a "minimum area" of 100 is basically nothing (a 10×10 region), while a face crop might be tens of thousands. If you're guessing, wire the raw SEGS to a SEGS Preview to see the actual sizes before setting the threshold.

Confidence filtering doesn't behave. This node's confidence target is on a 0–100 scale, not the 0–1 scale you set on the detector. A detector threshold of 0.5 is 50 here. Mixing those up is the usual reason a confidence range does nothing.

You meant "the biggest few," not "bigger than X." That's a ranking task - use SEGS Filter (ordered). Range and ordered look interchangeable until the number of detections varies between images, at which point a fixed threshold and a fixed rank behave very differently.

CategoryImpactPack/Util

Inputs (5)

NameTypeDefaultDescription
segsSEGS
targetCOMBO9 options: area(=w*h), width, height, x1, y1, x2, +3
modeBOOLEANtrue
min_valueINT00–9223372036854776000
max_valueINT671088640–9223372036854776000

Outputs (2)

NameTypeDescription
filtered_SEGSSEGS
remained_SEGSSEGS