glenn-jocher commited on
Commit
c171e45
1 Parent(s): b42e8a5

Update test.py with set() (#806)

Browse files
Files changed (1) hide show
  1. test.py +3 -1
test.py CHANGED
@@ -172,9 +172,11 @@ def test(data,
172
  ious, i = box_iou(pred[pi, :4], tbox[ti]).max(1) # best ious, indices
173
 
174
  # Append detections
 
175
  for j in (ious > iouv[0]).nonzero(as_tuple=False):
176
  d = ti[i[j]] # detected target
177
- if d not in detected:
 
178
  detected.append(d)
179
  correct[pi[j]] = ious[j] > iouv # iou_thres is 1xn
180
  if len(detected) == nl: # all targets already located in image
 
172
  ious, i = box_iou(pred[pi, :4], tbox[ti]).max(1) # best ious, indices
173
 
174
  # Append detections
175
+ detected_set = set()
176
  for j in (ious > iouv[0]).nonzero(as_tuple=False):
177
  d = ti[i[j]] # detected target
178
+ if d.item() not in detected_set:
179
+ detected_set.add(d.item())
180
  detected.append(d)
181
  correct[pi[j]] = ious[j] > iouv # iou_thres is 1xn
182
  if len(detected) == nl: # all targets already located in image