Explore Library
Code QuizIntermediate

Non-Maximum Suppression Filter

Spot the comparison mistake that keeps overlapping duplicate detections.

Codepython
def nms(boxes, scores, iou_thresh):
    idxs = sorted(range(len(scores)), key=lambda i: scores[i], reverse=True)
    keep = []
    while idxs:
        cur = idxs.pop(0)
        keep.append(cur)
        idxs = [i for i in idxs if iou(boxes[cur], boxes[i]) > iou_thresh]
    return keep

What is the bug in this NMS loop?