实现nms算法的代码段。
import numpy as np
def py_cpu_nms(dets, thresh):
"""Pure Python NMS baseline."""
x1 = dets[:, 0]
y1 = dets[:, 1]
x2 = dets[:, 2]
y2 = dets[:, 3]
scores = dets[:, 4]
areas = (x2 - x1 + 1) * (y2 - y1 + 1)
#按照从小到大排序后返回下标,然后顺序取反,即从大到小对应的下标
order = scores.argsort()[::-1]
keep