From b6f9d9a68ac694eca823cf6f461e9217faa51151 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sat, 18 Jun 2022 13:54:55 +0200 Subject: [PATCH] `process_batch()` as numpy arrays (#8254) Avoid potential issues with deterministic ops. [ ] - verify for identical mAP to master --- val.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/val.py b/val.py index dc7f28f46882..f4f4bab7e92d 100644 --- a/val.py +++ b/val.py @@ -77,7 +77,7 @@ def process_batch(detections, labels, iouv): Returns: 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]) correct_class = labels[:, 0:1] == detections[:, 5] for i in range(len(iouv)): @@ -90,7 +90,7 @@ def process_batch(detections, labels, iouv): # matches = matches[matches[:, 2].argsort()[::-1]] matches = matches[np.unique(matches[:, 0], return_index=True)[1]] correct[matches[:, 1].astype(int), i] = True - return correct + return torch.tensor(correct, dtype=torch.bool, device=iouv.device) @torch.no_grad()