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

SEGS Filter (intersection)

Drop detections that overlap another set

By ltdrdata·Created 3 years ago·Updated 4 months ago· 3,242
SEGS Filter (intersection)
  • segs1
  • segs2
  • filtered_SEGS
ioa_threshold0.50

This one's a spatial filter that works across two sets of detections. You give it segs1 (the ones you're filtering) and segs2 (the ones to check against), and it keeps only the regions in segs1 that don't significantly overlap anything in segs2. Think "detect faces, but throw out any that land inside the already-handled area" - it's set subtraction by geometry.

Both inputs are SEGS, Impact Pack's detection container: a header plus one region per hit, each with a bounding box, a mask, a confidence, and a label. Where the plain SEGS filters (label, range, ordered) filter within one set, this one filters one set against another.

How it works

It measures overlap using Intersection over Area - IoA - between each region in segs1 and the regions in segs2. For a region in segs1, if its overlap with any segs2 region exceeds the threshold, it's considered "already covered" and dropped; if it stays under the threshold everywhere, it survives. So the output is the part of segs1 that sits clear of segs2. The ioa_threshold is the dial: lower means even slight overlap gets a region tossed (aggressive), higher means only heavy overlap counts (lenient). IoA specifically (overlap divided by the region's own area) means a small region mostly-inside a big segs2 region reads as strongly overlapping, which is usually what you want when segs2 is a coarse "keep-out" zone.

The inputs and output

  • segs1 (SEGS, required) - the detections being filtered. These are what you get back (a subset of them).
  • segs2 (SEGS, required) - the reference set. Regions in segs1 overlapping these get removed.
  • ioa_threshold (FLOAT, default 0.5, range 0–1) - how much overlap disqualifies a region. Lower = stricter.

Output is filtered_SEGS - the surviving subset of segs1. It's a normal SEGS; send it into a detailer, a preview, or another filter.

How to install it

Install Impact Pack and it's there. 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. Pack's by ltdrdata (ComfyUI-Manager's author), so it's a safe, standard install. No extra models for the filter itself.

Common issues & troubleshooting

The most common surprise is getting the sense backwards: this keeps the non-overlapping regions of segs1, so if you wanted the ones that do overlap, you've got the wrong node (or you need to rethink which set is which). Swap segs1 and segs2 if the wrong side is being filtered - the node only ever returns a subset of segs1, never of segs2. If nothing gets filtered out, your threshold is too high (raise the overlap needed to disqualify) or the two sets genuinely don't overlap; if everything vanishes, the threshold's too low or segs2 blankets the frame. And because IoA divides by the filtered region's area, tiny detections are easy to disqualify against a large reference - that's the intended behavior, but worth knowing if small faces keep disappearing.

CategoryImpactPack/Util

Inputs (3)

NameTypeDefaultDescription
segs1SEGS
segs2SEGS
ioa_thresholdFLOAT0.500–1

Outputs (1)

NameTypeDescription
filtered_SEGSSEGS