本文整理汇总了Python中utils.cython_nms.soft_nms方法的典型用法代码示例。如果您正苦于以下问题:Python cython_nms.soft_nms方法的具体用法?Python cython_nms.soft_nms怎么用?Python cython_nms.soft_nms使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utils.cython_nms
的用法示例。
在下文中一共展示了cython_nms.soft_nms方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: soft_nms
# 需要导入模块: from utils import cython_nms [as 别名]
# 或者: from utils.cython_nms import soft_nms [as 别名]
def soft_nms(
dets, sigma=0.5, overlap_thresh=0.3, score_thresh=0.001, method='linear'
):
"""Apply the soft NMS algorithm from https://arxiv.org/abs/1704.04503."""
if dets.shape[0] == 0:
return dets, []
methods = {'hard': 0, 'linear': 1, 'gaussian': 2}
assert method in methods, 'Unknown soft_nms method: {}'.format(method)
dets, keep = cython_nms.soft_nms(
np.ascontiguousarray(dets, dtype=np.float32),
np.float32(sigma),
np.float32(overlap_thresh),
np.float32(score_thresh),
np.uint8(methods[method])
)
return dets, keep
示例2: soft_nms
# 需要导入模块: from utils import cython_nms [as 别名]
# 或者: from utils.cython_nms import soft_nms [as 别名]
def soft_nms(
dets, sigma=0.5, overlap_thresh=0.3, score_thresh=0.001, method='linear'
):
import utils.cython_nms as cython_nms
"""Apply the soft NMS algorithm from https://arxiv.org/abs/1704.04503."""
if dets.shape[0] == 0:
return dets, []
methods = {'hard': 0, 'linear': 1, 'gaussian': 2}
assert method in methods, 'Unknown soft_nms method: {}'.format(method)
dets, keep = cython_nms.soft_nms(
np.ascontiguousarray(dets, dtype=np.float32),
np.float32(sigma),
np.float32(overlap_thresh),
np.float32(score_thresh),
np.uint8(methods[method])
)
return dets, keep
示例3: soft_nms
# 需要导入模块: from utils import cython_nms [as 别名]
# 或者: from utils.cython_nms import soft_nms [as 别名]
def soft_nms(
dets, sigma=0.5, overlap_thresh=0.3, score_thresh=0.001, method='linear'
):
if dets.shape[0] == 0:
return dets
if dets.shape[1] > 5:
raise NotImplementedError('Need to handle tubes..')
methods = {'hard': 0, 'linear': 1, 'gaussian': 2}
assert method in methods, 'Unknown soft_nms method: {}'.format(method)
dets = cpu_soft_nms(
np.ascontiguousarray(dets, dtype=np.float32),
np.float32(sigma),
np.float32(overlap_thresh),
np.float32(score_thresh),
np.uint8(methods[method]))
return dets