Nodes/ComfyUI Impact Pack/SEGS Filter (non max suppression)
ComfyUI Node Runs on cloud

SEGS Filter (non max suppression)

Clean up duplicate detections before you pay to refine them twice

By ltdrdata·Created 3 years ago·Updated 4 months ago· 3,242
SEGS Filter (non max suppression)
  • segs
  • filtered_SEGS
iou_threshold0.50

Object detectors love to fire twice at the same thing. Point a YOLO-style face or bbox detector at an image and it's common to get two or three overlapping boxes for what's obviously one face, each at slightly different confidence and position. Left alone, that means your Detailer processes the same spot on the image multiple times - wasted compute, and sometimes visibly different results from each pass fighting each other in the final composite. Non-max suppression (NMS) is the standard fix from object detection, and this node applies it to a SEGS collection: keep the highest-confidence box, drop anything that overlaps it too much.

How the threshold works

iou_threshold (default 0.5, range 0–1) measures overlap as Intersection over Union - how much two boxes share relative to their combined area. Set it low and the filter gets aggressive: even modestly-overlapping boxes get collapsed down to one, which risks merging two genuinely distinct, nearby detections (two faces close together in frame) into a single surviving box. Set it high and only near-identical duplicates get removed, so genuine dupes can survive alongside the real detection. 0.5 is the standard starting point from object-detection literature and a reasonable default here too - nudge down if duplicates are surviving, nudge up if you're losing detections that should both be kept.

The inputs and output

  • segs (SEGS) - the detection collection to filter.
  • iou_threshold (FLOAT, default 0.5, range 0–1, step 0.01) - the overlap cutoff.

Output is a single filtered_SEGS (SEGS) - the deduplicated collection, ready to feed into a Detailer.

Where it fits

Right after a detector, before anything expensive. Put this between BBOX Detector (SEGS) / SEGM Detector (SEGS) and your Detailer step so the Detailer only ever processes each real detection once. It's cheap and it's a straightforward win whenever your detector is prone to overlapping boxes - which is most YOLO-family detectors, at least occasionally.

Installing it

Bundled with the whole pack. Via ComfyUI Manager: search ComfyUI Impact Pack, Install, restart. Manually:

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

(portable: python_embeded\python.exe -m pip install -r requirements.txt), restart. This node itself needs no models - the actual detector upstream of it does, whichever provider you're using.

Common issues

This is textbook NMS, so the behavior isn't Impact-Pack-specific in any surprising way - no pack-specific gotchas beyond making sure it's wired in the right place (after the detector, before the Detailer). If you're losing detections you expect to keep, raise iou_threshold. If duplicate refinement passes are still showing up in your output, lower it. If neither helps, the problem probably isn't overlap at all - check whether your detector is genuinely finding two separate, correct detections that just happen to sit close together, in which case NMS is working as intended and the "duplicate" you're seeing is real.

CategoryImpactPack/Util

Inputs (2)

NameTypeDefaultDescription
segsSEGS
iou_thresholdFLOAT0.500–1

Outputs (1)

NameTypeDescription
filtered_SEGSSEGS