资源简介
重写覆盖原模型中使用的 cpu_nms.pyx, 解决碰到的 ModuleNotFoundError: No module named 'utils.nms.cpu_nms' 报错
代码片段和文件信息
import numpy as np
def mymax(a b):
if a >= b:
return a
else:
return b
def mymin(a b):
if a >= b:
return b
else:
return a
def cpu_nms(dets thresh):
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]
ndets = dets.shape[0]
suppressed = np.zeros((ndets) dtype=np.int)
keep = []
for _i in range(ndets):
i = order[_i]
if suppressed[i] == 1:
评论
共有 条评论