diff --git a/utils/utils.py b/utils/utils.py index a4c331a2..f21e2285 100755 --- a/utils/utils.py +++ b/utils/utils.py @@ -669,7 +669,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 kmeans_targets(path='../coco/trainvalno5k.txt', n=9, img_size=416): # from utils.utils import *; kmeans_targets() +def kmeans_targets(path='../coco/trainvalno5k.txt', n=9, img_size=512): # from utils.utils import *; kmeans_targets() # Produces a list of target kmeans suitable for use in *.cfg files from utils.datasets import LoadImagesAndLabels from scipy import cluster @@ -679,7 +679,7 @@ def kmeans_targets(path='../coco/trainvalno5k.txt', n=9, img_size=416): # from for s, l in zip(dataset.shapes, dataset.labels): l[:, [1, 3]] *= s[0] # normalized to pixels l[:, [2, 4]] *= s[1] - l[:, 1:] *= img_size / max(s) # nominal img_size for training + l[:, 1:] *= img_size / max(s) * random.uniform(0.99, 1.01) # nominal img_size for training wh = np.concatenate(dataset.labels, 0)[:, 3:5] # wh from cxywh # Kmeans calculation