Nodes/comfyui_cv/CV NMS Boxes
ComfyUI Node

CV NMS Boxes

Non-maximum suppression over any BOUNDING_BOX value: drops boxes that overlap a higher-scoring box by more than the IoU threshold. cv2's NMS is otherwise only reachable inside 'YOLO Detect Decode', so anything that produces overlapping regions - two detectors merged, a lowered confidence threshold, 'Masks to BBoxes' on a noisy segmentation, 'Match Template Multi-Scale' across scales - has no way to de-duplicate. Suppression runs INSIDE each per-frame group, never across frames. Empty input yields empty outputs and never raises.

By bmad4ever·Created 3 months ago·Updated 2 days ago· 0
CV NMS Boxes
  • bboxes
  • scores
  • class_ids
  • bboxes
  • kept_indices
  • count
  • removed
nms_threshold0.45
score_threshold0.00
top_k0
eta1.00
Categoryimage/CV

Inputs (7)

NameTypeDefaultDescription
bboxesBOUNDING_BOX[object Object]Core BOUNDING_BOX data: per-frame lists of {x, y, width, height} dicts - compatible with Draw BBoxes, Crop By Bounding Boxes, Image Crop, etc. Boxes are suppressed within each per-frame group independently.
nms_thresholdFLOAT0.450–1Maximum IoU a kept box may have with a higher-scoring one. Lower suppresses more aggressively; 1.0 keeps everything. Measure the actual overlaps with 'CV Box IoU Matrix' if you are unsure what to set.
score_thresholdFLOAT0.000–1Boxes scoring below this are dropped before suppression. 0.0 keeps them all.
scoresoptNPARRAYOptional (N,) confidences, in the flattened box order ('CV BBoxes To Array' emits exactly this). Omitted, each box's own 'score' key is used, defaulting to 1.0 - with no scores at all NMS keeps the first box of each overlapping cluster.
class_idsoptNPARRAYOptional (N,) class indices. WIRED, suppression runs per class (boxes of different classes never suppress each other) - that is the switch, there is no boolean widget. 'CV BBoxes To Array' emits 'label_ids' for this.
top_koptINT00–100000Keep at most this many boxes per group after suppression (0 = no limit), highest score first.
etaoptFLOAT1.000.01–10Adaptive-threshold coefficient of cv2's NMS: the IoU threshold is multiplied by this after each iteration. 1.0 (the default) keeps it constant.

Outputs (4)

NameTypeDescription
bboxesBOUNDING_BOXCore BOUNDING_BOX data: per-frame lists of {x, y, width, height} dicts - compatible with Draw BBoxes, Crop By Bounding Boxes, Image Crop, etc. The survivors, keeping the original per-frame nesting and every extra key.
kept_indicesNPARRAY(K,) int32 indices of the survivors into the FLATTENED input order - feed it to 'CV Take By Index' to keep any parallel array (masks, embeddings, areas) in step.
countINTNumber of boxes kept.
removedINTHow many boxes were dropped (suppressed or below 'score_threshold'). 0 means NMS changed nothing.