Live Coding Non-Maximum Suppression (NMS) & Intersection over Union (IoU) represents the quintessential computer vision coding problem testing bounding-box coordinate geometry and greedy filtering algorithms; it comprises 2 stages: 1) Vectorized IoU Calculation: given boxes
A,B∈RM×4 (
[x1,y1,x2,y2]), leveraging numpy broadcasting to compute pairwise intersection coordinates (
xinter1=max(Ax1,Bx1)), yielding
IoU=Area(A)+Area(B)−Area(Intersection)Area(Intersection); 2) Greedy NMS Filtering: sorting boxes by confidence descending, iteratively appending the top box to the keep-list and discarding all remaining candidates with
IoU>threshold.