idxs2= np.where(ious < threshold)[0]#np.where函数idxs = idxs[idxs2 + 1]#注意这个+1returnkeep#定义一个soft_nms函数defsoft_nms(dets, thresh=0.3, sigma=0.5):#score大于thresh的才能存留下来,当设定的thresh过低,存留下来的框就很多,所以要根据实际情况调参'''input: dets: dets是(n,5)的ndar...
[i, 4] pos = i + 1 #softNMS迭代 while pos < N: x1 = boxes[pos, 0] y1 = boxes[pos, 1] x2 = boxes[pos, 2] y2 = boxes[pos, 3] s = boxes[pos, 4] area = (x2 - x1 + 1) * (y2 - y1 + 1) iw = (min(tx2, x2) - max(tx1, x1) + 1) if iw > 0: ih...