Loading...
Implement Non-Maximum Suppression (NMS) for 2D point detections.
Given a list of detections, each represented as [x,y,score], and a distance threshold d, suppress detections that are within distance d of a higher-scoring detection.
Algorithm:
The Euclidean distance between two points (x1,y1) and (x2,y2) is: d=(x1−x2)2+(y1−y2)2
Return the surviving detections sorted by score in descending order. Each detection should be returned as [x,y,score] with values rounded to 4 decimal places.
detections = [[10, 10, 0.9], [12, 12, 0.8], [50, 50, 0.7], [11, 11, 0.6]] dist_threshold = 5.0
[[10, 10, 0.9], [50, 50, 0.7]]