This commit is contained in:
Glenn Jocher 2019-07-21 19:18:15 +02:00
parent c9ed072cc7
commit 14cbd8c0ca
1 changed files with 6 additions and 6 deletions

View File

@ -328,7 +328,7 @@ def print_mutation(hyp, results):
with open('evolve.txt', 'a') as f: # append result with open('evolve.txt', 'a') as f: # append result
f.write(c + b + '\n') f.write(c + b + '\n')
x = np.unique(np.loadtxt('evolve.txt', ndmin=2), axis=0) # load unique rows x = np.unique(np.loadtxt('evolve.txt', ndmin=2), axis=0) # load unique rows
np.savetxt('evolve.txt', x[np.argsort(-fitness(x))] , '%11.3g') # save sort by fitness np.savetxt('evolve3.txt', x[np.argsort(-fitness(x))], '%11.3g') # save sort by fitness
os.system('gsutil cp evolve.txt gs://%s' % opt.bucket) # upload evolve.txt os.system('gsutil cp evolve.txt gs://%s' % opt.bucket) # upload evolve.txt
else: else:
with open('evolve.txt', 'a') as f: with open('evolve.txt', 'a') as f:
@ -410,14 +410,14 @@ if __name__ == '__main__':
# # Plot results # # Plot results
# import numpy as np # import numpy as np
# import matplotlib.pyplot as plt # import matplotlib.pyplot as plt
# a = np.loadtxt('evolve_1000val.txt') # a = np.loadtxt('evolve.txt')
# x = a[:, 2] * a[:, 3] # metric = mAP * F1 # x = fitness(a)
# weights = (x - x.min()) ** 2 # weights = (x - x.min()) ** 2
# fig = plt.figure(figsize=(14, 7)) # fig = plt.figure(figsize=(10, 10))
# for i in range(len(hyp)): # for i in range(len(hyp)):
# y = a[:, i + 5] # y = a[:, i + 5]
# mu = (y * weights).sum() / weights.sum() # mu = (y * weights).sum() / weights.sum()
# plt.subplot(2, 5, i+1) # plt.subplot(4, 5, i + 1)
# plt.plot(x.max(), mu, 'o') # plt.plot(x.max(), mu, 'o')
# plt.plot(x, y, '.') # plt.plot(x, y, '.')
# print(list(hyp.keys())[i],'%.4g' % mu) # print(list(hyp.keys())[i], '%.4g' % mu)