From c171e45cda2fe612284c28ed44a7baf0ec0cfa6e Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Fri, 21 Aug 2020 15:03:03 -0700 Subject: [PATCH] Update test.py with set() (#806) --- test.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test.py b/test.py index 9c652ca..3bcbbd8 100644 --- a/test.py +++ b/test.py @@ -172,9 +172,11 @@ def test(data, ious, i = box_iou(pred[pi, :4], tbox[ti]).max(1) # best ious, indices # Append detections + detected_set = set() for j in (ious > iouv[0]).nonzero(as_tuple=False): d = ti[i[j]] # detected target - if d not in detected: + if d.item() not in detected_set: + detected_set.add(d.item()) detected.append(d) correct[pi[j]] = ious[j] > iouv # iou_thres is 1xn if len(detected) == nl: # all targets already located in image