From ee7cba65a5637a1d857b43743deee3aa55e371da Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sat, 2 May 2020 09:20:19 -0700 Subject: [PATCH] kmeans() cleanup --- utils/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/utils.py b/utils/utils.py index a317b6ee..010f16de 100755 --- a/utils/utils.py +++ b/utils/utils.py @@ -690,7 +690,7 @@ def coco_single_class_labels(path='../coco/labels/train2014/', label_class=43): shutil.copyfile(src=img_file, dst='new/images/' + Path(file).name.replace('txt', 'jpg')) # copy images -def kmean_anchors(path='../coco/train2017.txt', n=12, img_size=(320, 1024), thr=0.10, gen=1000): +def kmean_anchors(path='./data/coco64.txt', n=9, img_size=(320, 1024), thr=0.20, gen=1000): # Creates kmeans anchors for use in *.cfg files: from utils.utils import *; _ = kmean_anchors() # n: number of anchors # img_size: (min, max) image size used for multi-scale training (can be same values) @@ -717,7 +717,7 @@ def kmean_anchors(path='../coco/train2017.txt', n=12, img_size=(320, 1024), thr= # Get label wh wh = [] - dataset = LoadImagesAndLabels(path, augment=True, rect=True, cache_labels=True) + dataset = LoadImagesAndLabels(path, augment=True, rect=True) nr = 1 if img_size[0] == img_size[1] else 10 # number augmentation repetitions for s, l in zip(dataset.shapes, dataset.labels): wh.append(l[:, 3:5] * (s / s.max())) # image normalized to letterbox normalized wh