Nodes/comfyui_cv/CV Box IoU Matrix
ComfyUI Node

CV Box IoU Matrix

Intersection-over-union of every box in A against every box in B, as an (N,M) array. The generic primitive behind detection scoring against ground truth, frame-to-frame track association, de-duplicating two detectors, and 'drop anything overlapping this keep-out region' - the 'CV Polygon IoU (convex)' subgraph only does a single pair. Boxes are flattened across frames (use 'CV BBoxes To Array' if you need to know which frame a row came from). Empty input yields an empty matrix and never raises.

By bmad4ever·Created 3 months ago·Updated 2 days ago· 0
CV Box IoU Matrix
  • bboxes_a
  • bboxes_b
  • iou
  • best_index
  • best_iou
  • count_a
  • count_b
Categoryimage/CV

Inputs (2)

NameTypeDefaultDescription
bboxes_aBOUNDING_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. Becomes the ROWS of the matrix.
bboxes_bBOUNDING_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. Becomes the COLUMNS. Pass the same value on both sides to get the self-overlap matrix (its diagonal is 1.0).

Outputs (5)

NameTypeDescription
iouNPARRAY(N,M) float32 in [0,1]: intersection area / union area for each pair. 0.0 where the boxes do not touch.
best_indexNPARRAY(N,) int32: for each A box, the B box it overlaps most (-1 when it overlaps nothing at all).
best_iouNPARRAY(N,) float32: that best overlap. Threshold it to get the classic matched/unmatched split.
count_aINTNumber of A boxes (rows).
count_bINTNumber of B boxes (columns).