Browse Source

best possible recall fix

5.0
Glenn Jocher 4 years ago
parent
commit
93bbf1b87a
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      utils/utils.py

+ 2
- 2
utils/utils.py View File

@@ -53,8 +53,8 @@ def check_img_size(img_size, s=32):

def check_best_possible_recall(dataset, anchors, thr):
# Check best possible recall of dataset with current anchors
wh = torch.tensor(np.concatenate([l[:, 3:5] * s for s, l in zip(dataset.shapes, dataset.labels)])) # width-height
ratio = wh[:, None] / anchors.view(-1, 2)[None] # ratio
wh = torch.tensor(np.concatenate([l[:, 3:5] * s for s, l in zip(dataset.shapes, dataset.labels)])).float() # wh
ratio = wh[:, None] / anchors.view(-1, 2).cpu()[None] # ratio
m = torch.max(ratio, 1. / ratio).max(2)[0] # max ratio
bpr = (m.min(1)[0] < thr).float().mean() # best possible recall
mr = (m < thr).float().mean() # match ratio

Loading…
Cancel
Save