This commit is contained in:
Glenn Jocher 2019-12-30 12:01:52 -08:00
parent b636f7f7ab
commit 88579bd24e
1 changed files with 2 additions and 2 deletions

View File

@ -734,7 +734,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 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='data/coco64.txt', n=9, img_size=416): # from utils.utils import *; kmeans_targets()
# Produces a list of target kmeans suitable for use in *.cfg files # Produces a list of target kmeans suitable for use in *.cfg files
from utils.datasets import LoadImagesAndLabels from utils.datasets import LoadImagesAndLabels
from scipy import cluster from scipy import cluster
@ -762,7 +762,7 @@ def kmeans_targets(path='../coco/trainvalno5k.txt', n=9, img_size=416): # from
# Measure IoUs # Measure IoUs
iou = wh_iou(torch.Tensor(wh), torch.Tensor(k)) iou = wh_iou(torch.Tensor(wh), torch.Tensor(k))
biou = iou.max(0)[0] # closest anchor IoU biou = iou.max(0)[0] # closest anchor IoU
print('Best possible recall: %.3f' % (biou > 0.2635).float().mean()) # BPR (best possible recall) print('Best Possible Recall (BPR): %.3f' % (biou > 0.2635).float().mean()) # BPR (best possible recall)
# Print # Print
print('kmeans anchors (n=%g, img_size=%g, IoU=%.2f/%.2f/%.2f-min/mean/best): ' % print('kmeans anchors (n=%g, img_size=%g, IoU=%.2f/%.2f/%.2f-min/mean/best): ' %