glenn-jocher commited on
Commit
93bbf1b
1 Parent(s): 31f3310

best possible recall fix

Browse files
Files changed (1) hide show
  1. utils/utils.py +2 -2
utils/utils.py CHANGED
@@ -53,8 +53,8 @@ def check_img_size(img_size, s=32):
53
 
54
  def check_best_possible_recall(dataset, anchors, thr):
55
  # Check best possible recall of dataset with current anchors
56
- wh = torch.tensor(np.concatenate([l[:, 3:5] * s for s, l in zip(dataset.shapes, dataset.labels)])) # width-height
57
- ratio = wh[:, None] / anchors.view(-1, 2)[None] # ratio
58
  m = torch.max(ratio, 1. / ratio).max(2)[0] # max ratio
59
  bpr = (m.min(1)[0] < thr).float().mean() # best possible recall
60
  mr = (m < thr).float().mean() # match ratio
 
53
 
54
  def check_best_possible_recall(dataset, anchors, thr):
55
  # Check best possible recall of dataset with current anchors
56
+ wh = torch.tensor(np.concatenate([l[:, 3:5] * s for s, l in zip(dataset.shapes, dataset.labels)])).float() # wh
57
+ ratio = wh[:, None] / anchors.view(-1, 2).cpu()[None] # ratio
58
  m = torch.max(ratio, 1. / ratio).max(2)[0] # max ratio
59
  bpr = (m.min(1)[0] < thr).float().mean() # best possible recall
60
  mr = (m < thr).float().mean() # match ratio