Your question is Non-Maximum Suppression for Boxes. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Given a list of 2D bounding boxes and a list of confidence scores of equal length, implement Non-Maximum Suppression (NMS). Each box is represented as [x1, y1, x2, y2], where (x1, y1) is the top-left corner and (x2, y2) is the bottom-right corner. Return the indices of the boxes kept after suppressing boxes whose Intersection over Union (IoU) with a higher-scoring box is greater than a given threshold.
def non_max_suppression(boxes, scores, iou_threshold):