Unverified 提交 669f707d authored 作者: Glenn Jocher's avatar Glenn Jocher 提交者: GitHub

`process_batch()` as numpy arrays (#8254)

Avoid potential issues with deterministic ops. [ ] - verify for identical mAP to master
上级 d6051382
...@@ -77,7 +77,7 @@ def process_batch(detections, labels, iouv): ...@@ -77,7 +77,7 @@ def process_batch(detections, labels, iouv):
Returns: Returns:
correct (Array[N, 10]), for 10 IoU levels correct (Array[N, 10]), for 10 IoU levels
""" """
correct = torch.zeros(detections.shape[0], iouv.shape[0], dtype=torch.bool, device=iouv.device) correct = np.zeros((detections.shape[0], iouv.shape[0])).astype(bool)
iou = box_iou(labels[:, 1:], detections[:, :4]) iou = box_iou(labels[:, 1:], detections[:, :4])
correct_class = labels[:, 0:1] == detections[:, 5] correct_class = labels[:, 0:1] == detections[:, 5]
for i in range(len(iouv)): for i in range(len(iouv)):
...@@ -90,7 +90,7 @@ def process_batch(detections, labels, iouv): ...@@ -90,7 +90,7 @@ def process_batch(detections, labels, iouv):
# matches = matches[matches[:, 2].argsort()[::-1]] # matches = matches[matches[:, 2].argsort()[::-1]]
matches = matches[np.unique(matches[:, 0], return_index=True)[1]] matches = matches[np.unique(matches[:, 0], return_index=True)[1]]
correct[matches[:, 1].astype(int), i] = True correct[matches[:, 1].astype(int), i] = True
return correct return torch.tensor(correct, dtype=torch.bool, device=iouv.device)
@torch.no_grad() @torch.no_grad()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论