Skip to content

Commit

Permalink
best possible recall fix
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher committed Jun 13, 2020
1 parent 31f3310 commit 93bbf1b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 93bbf1b

Please sign in to comment.