论文(CVPR2017): 《Improving Object Detection With One Line of Code》
Github链接: https://github.com/bharatsingh430/soft-nms
论文给出的关于soft-nms的伪代码如下:
上图中,绿色框中,似乎给人的错觉,好像不淘汰bbox,实际上并不是这样的。在原作者给出的源代码中,删除了置信度小于threshold(0.001)的bbox,见https://github.com/bharatsingh430/soft-nms/blob/master/lib/nms/cpu_nms.pyx,如下图:
# if box score falls below threshold, discard the box by swapping with last box
# update N
if boxes[pos, 4] < threshold:
boxes[pos,0] = boxes[N-1, 0]
boxes[pos,1] = boxes[N-1, 1]
boxes[pos,2] = boxes[N-1, 2]
boxes[pos,3] = boxes[N-1, 3]
boxes[pos,4] = boxes[N-1, 4]
N = N - 1
pos = pos - 1