From 72680a599282462b40e3c9a748dd939241b34403 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Mon, 27 Jan 2020 16:52:40 -0500 Subject: [PATCH] updates --- train.py | 2 +- utils/utils.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/train.py b/train.py index ae4b3515..59240cca 100644 --- a/train.py +++ b/train.py @@ -459,7 +459,7 @@ if __name__ == '__main__': # Mutate method = 3 - s = 0.3 # 20% sigma + s = 0.3 # 30% sigma np.random.seed(int(time.time())) g = np.array([1, 1, 1, 1, 1, 1, 1, 0, .1, 1, 0, 1, 1, 1, 1, 1, 1, 1]) # gains ng = len(g) diff --git a/utils/utils.py b/utils/utils.py index b8e41df2..e7ce39e0 100755 --- a/utils/utils.py +++ b/utils/utils.py @@ -798,9 +798,10 @@ def kmean_anchors(path='../coco/train2017.txt', n=9, img_size=(320, 640)): # Evolve wh = torch.Tensor(wh) - f, ng = fitness(thr, wh, k), 1000 # fitness, generations + f, ng = fitness(thr, wh, k), 1000 # fitness, mutation probability, generations for _ in tqdm(range(ng), desc='Evolving anchors'): - kg = (k.copy() * (1 + np.random.random() * np.random.randn(*k.shape) * 0.30)).clip(min=2.0) + v = ((np.random.random(n) < 0.1) * np.random.randn(n) * 0.3 + 1) ** 2.0 # 0.1 mutation probability, 0.3 sigma + kg = (k.copy() * v).clip(min=2.0) fg = fitness(thr, wh, kg) if fg > f: f, k = fg, kg.copy()