updates
This commit is contained in:
parent
cb0f4bbfe7
commit
72680a5992
2
train.py
2
train.py
|
@ -459,7 +459,7 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
# Mutate
|
# Mutate
|
||||||
method = 3
|
method = 3
|
||||||
s = 0.3 # 20% sigma
|
s = 0.3 # 30% sigma
|
||||||
np.random.seed(int(time.time()))
|
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
|
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)
|
ng = len(g)
|
||||||
|
|
|
@ -798,9 +798,10 @@ def kmean_anchors(path='../coco/train2017.txt', n=9, img_size=(320, 640)):
|
||||||
|
|
||||||
# Evolve
|
# Evolve
|
||||||
wh = torch.Tensor(wh)
|
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'):
|
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)
|
fg = fitness(thr, wh, kg)
|
||||||
if fg > f:
|
if fg > f:
|
||||||
f, k = fg, kg.copy()
|
f, k = fg, kg.copy()
|
||||||
|
|
Loading…
Reference in New Issue