From 46da9fd26ce809607112fdbb3a31de36a33841de Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Fri, 22 Nov 2019 13:38:28 -1000 Subject: [PATCH] updates --- utils/utils.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/utils/utils.py b/utils/utils.py index a9f77a1c..2afd8290 100755 --- a/utils/utils.py +++ b/utils/utils.py @@ -691,6 +691,14 @@ def kmeans_targets(path='../coco/trainvalno5k.txt', n=9, img_size=416): # from k, dist = cluster.vq.kmeans(wh, n) # points, mean distance k = k[np.argsort(k.prod(1))] # sort small to large + # # Plot + # k, d = [None] * 20, [None] * 20 + # for i in tqdm(range(1, 21)): + # k[i-1], d[i-1] = cluster.vq.kmeans(wh, i) # points, mean distance + # fig, ax = plt.subplots(1, 2, figsize=(14, 7)) + # ax = ax.ravel() + # ax[0].plot(np.arange(1, 21), np.array(d) ** 2, marker='.') + # Measure IoUs iou = torch.stack([wh_iou(torch.Tensor(wh).T, torch.Tensor(x).T) for x in k], 0) biou = iou.max(0)[0] # closest anchor IoU