浏览代码

Allow `multi_label` option for NMS with PyTorch Hub (#4728)

* Allow specifying multi_label option for NMS when using torch hub

* Reformat

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
modifyDataloader
Jean-Baptiste Martin GitHub 3 年前
父节点
当前提交
1cad0ce2c7
找不到此签名对应的密钥 GPG 密钥 ID: 4AEE18F83AFDEB23
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. +3
    -1
      models/common.py

+ 3
- 1
models/common.py 查看文件

@@ -278,6 +278,7 @@ class AutoShape(nn.Module):
conf = 0.25 # NMS confidence threshold
iou = 0.45 # NMS IoU threshold
classes = None # (optional list) filter by class
multi_label = False # NMS multiple labels per box
max_det = 1000 # maximum number of detections per image

def __init__(self, model):
@@ -337,7 +338,8 @@ class AutoShape(nn.Module):
t.append(time_sync())

# Post-process
y = non_max_suppression(y, self.conf, iou_thres=self.iou, classes=self.classes, max_det=self.max_det) # NMS
y = non_max_suppression(y, self.conf, iou_thres=self.iou, classes=self.classes,
multi_label=self.multi_label, max_det=self.max_det) # NMS
for i in range(n):
scale_coords(shape1, y[i][:, :4], shape0[i])


正在加载...
取消
保存