This commit is contained in:
Glenn Jocher 2019-11-07 19:32:33 -08:00
parent bd10fb35c7
commit d7f2c8ab72
1 changed files with 2 additions and 2 deletions

View File

@ -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