`process_batch()` as numpy arrays (#8254)
Browse filesAvoid potential issues with deterministic ops.
[ ] - verify for identical mAP to master
val.py
CHANGED
@@ -77,7 +77,7 @@ def process_batch(detections, labels, iouv):
|
|
77 |
Returns:
|
78 |
correct (Array[N, 10]), for 10 IoU levels
|
79 |
"""
|
80 |
-
correct =
|
81 |
iou = box_iou(labels[:, 1:], detections[:, :4])
|
82 |
correct_class = labels[:, 0:1] == detections[:, 5]
|
83 |
for i in range(len(iouv)):
|
@@ -90,7 +90,7 @@ def process_batch(detections, labels, iouv):
|
|
90 |
# matches = matches[matches[:, 2].argsort()[::-1]]
|
91 |
matches = matches[np.unique(matches[:, 0], return_index=True)[1]]
|
92 |
correct[matches[:, 1].astype(int), i] = True
|
93 |
-
return correct
|
94 |
|
95 |
|
96 |
@torch.no_grad()
|
|
|
77 |
Returns:
|
78 |
correct (Array[N, 10]), for 10 IoU levels
|
79 |
"""
|
80 |
+
correct = np.zeros((detections.shape[0], iouv.shape[0])).astype(bool)
|
81 |
iou = box_iou(labels[:, 1:], detections[:, :4])
|
82 |
correct_class = labels[:, 0:1] == detections[:, 5]
|
83 |
for i in range(len(iouv)):
|
|
|
90 |
# matches = matches[matches[:, 2].argsort()[::-1]]
|
91 |
matches = matches[np.unique(matches[:, 0], return_index=True)[1]]
|
92 |
correct[matches[:, 1].astype(int), i] = True
|
93 |
+
return torch.tensor(correct, dtype=torch.bool, device=iouv.device)
|
94 |
|
95 |
|
96 |
@torch.no_grad()
|