如何调用softnms
时间: 2023-05-25 20:03:15 浏览: 118
1. 安装Python软件包:在命令行窗口下输入如下命令:
```
pip install soft-nms
```
2. 导入软件包:在Python文件中导入软件包
```
from soft_nms import soft_nms
```
3. 调用函数:使用以下代码行之一调用函数
```
```
boxes = [[10, 20, 30, 40], [15, 25, 35, 45], [40, 50, 60, 70]]
scores = [0.9, 0.8, 0.7]
# 使用默认值调用soft_nms函数
new_boxes, new_scores, new_indices = soft_nms(boxes, scores)
# 指定阈值和参数调用soft_nms函数
new_boxes, new_scores, new_indices = soft_nms(boxes, scores, sigma=0.5, threshold=0.3)
```
这个例子使用默认sigma值(0.5)和默认threshold值(0.1)调用soft_nms函数来处理一个3个方框的列表、一个置信度向量和一个IoU阈值:
```
soft_nms.nearest_neighbor(boxes, scores, Nt=0.3)
```
这个例子调用Nearest Neighbor Soft NMS函数(即soft_nms.nearest_neighbor),并指定IoU门阈值(Nt=0.3)。
阅读全文
相关推荐











