From ef75f7313d5ce72e248d7581f749c3566a5fcaf3 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 16 Jun 2020 16:48:01 -0700 Subject: [PATCH] AutoAnchor n, imgsz bug fix --- utils/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/utils.py b/utils/utils.py index 530cffd..73d3d7f 100755 --- a/utils/utils.py +++ b/utils/utils.py @@ -69,7 +69,7 @@ def check_anchors(dataset, model, thr=4.0, imgsz=640): 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) + new_anchors = kmean_anchors(dataset, n=anchors.numel() // 2, img_size=imgsz, thr=thr, gen=1000, verbose=False) new_bpr = metric(new_anchors.reshape(-1, 2)) if new_bpr > bpr: anchors[:] = torch.tensor(new_anchors).view_as(anchors).type_as(anchors)