From cf92235b8db7319e87c9e0d0c5d3920ee418aec8 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Mon, 30 Dec 2019 13:39:25 -0800 Subject: [PATCH] updates --- utils/utils.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/utils/utils.py b/utils/utils.py index da494056..3464a2fe 100755 --- a/utils/utils.py +++ b/utils/utils.py @@ -743,13 +743,12 @@ def kmean_anchors(path='data/coco64.txt', n=9, img_size=(288, 640)): # from uti wh = [] dataset = LoadImagesAndLabels(path, augment=True, rect=True, cache_labels=True) for s, l in zip(dataset.shapes, dataset.labels): - l = l[:, 3:5] * (s / max(s)) # image normalized to letterbox normalized wh - l = l.repeat(10, axis=0) # augment 10x - l *= np.random.uniform(img_size[0], img_size[1], size=(l.shape[0], 1)) # normalized to pixels (multi-scale) - wh.append(l) - wh = np.concatenate(wh, 0) # wh from cxywh + wh.append(l[:, 3:5] * (s / s.max())) # image normalized to letterbox normalized wh + wh = np.concatenate(wh, 0).repeat(10, axis=0) # augment 10x + wh *= np.random.uniform(img_size[0], img_size[1], size=(wh.shape[0], 1)) # normalized to pixels (multi-scale) # Kmeans calculation + print('Running kmeans...') k, dist = cluster.vq.kmeans(wh, n) # points, mean distance k = k[np.argsort(k.prod(1))] # sort small to large