From 1dfc28527ffa36e5f12e82e9956265761c75f480 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 16 Jun 2020 16:19:58 -0700 Subject: [PATCH] AutoAnchor BPR to 4 significant figures --- utils/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/utils.py b/utils/utils.py index cc4369a..530cffd 100755 --- a/utils/utils.py +++ b/utils/utils.py @@ -66,7 +66,7 @@ def check_anchors(dataset, model, thr=4.0, imgsz=640): return (best > 1. / thr).float().mean() #  best possible recall bpr = metric(anchors.clone().cpu().view(-1, 2)) - print('Best Possible Recall (BPR) = %.3f' % bpr, end='') + print('Best Possible Recall (BPR) = %.4f' % bpr, end='') if bpr < 0.99: # threshold to recompute print('. Attempting to generate improved anchors, please wait...' % bpr) new_anchors = kmean_anchors(dataset, n=9, img_size=640, thr=4.0, gen=1000, verbose=False) @@ -733,7 +733,7 @@ def kmean_anchors(path='./data/coco128.yaml', n=9, img_size=640, thr=4.0, gen=10 k = k[np.argsort(k.prod(1))] # sort small to large x, best = metric(k, wh0) bpr, aat = (best > thr).float().mean(), (x > thr).float().mean() * n # best possible recall, anch > thr - print('thr=%.2f: %.3f best possible recall, %.2f anchors past thr' % (thr, bpr, aat)) + print('thr=%.2f: %.4f best possible recall, %.2f anchors past thr' % (thr, bpr, aat)) print('n=%g, img_size=%s, metric_all=%.3f/%.3f-mean/best, past_thr=%.3f-mean: ' % (n, img_size, x.mean(), best.mean(), x[x > thr].mean()), end='') for i, x in enumerate(k):