All problems
Soft-NMS Decay
Problem
Run linear soft-NMS over boxes and scores.
Repeatedly pick the alive box with the highest score (ties by smaller index), record it as [index, score], then decay every remaining box with IoU > iou_threshold by score *= (1 - IoU), dropping boxes whose score falls below 0.001. Round the recorded scores to 4 decimal places.
Test cases
case 1
in: [[[0,0,2,2],[1,1,3,3],[10,10,12,12]],[0.9,0.8,0.7],0.1]
expected: [[0,0.9],[2,0.7],[1,0.6857]]
case 2
in: [[[0,0,2,2],[1,1,3,3]],[0.9,0.8],0.5]
expected: [[0,0.9],[1,0.8]]
case 3
in: [[[0,0,2,2],[0,0,2,2]],[0.9,0.8],0.5]
expected: [[0,0.9]]
case 4
in: [[],[],0.5]
expected: []
Starter codePython
def soft_nms(boxes, scores, iou_threshold):
# Your code here
pass4 test cases · run your code against them in the editor