資源簡(jiǎn)介
重寫覆蓋原模型中使用的 cpu_nms.pyx, 解決碰到的 ModuleNotFoundError: No module named 'utils.nms.cpu_nms' 報(bào)錯(cuò)
代碼片段和文件信息
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:
評(píng)論
共有 條評(píng)論