MCPcopy
hub / github.com/ultralytics/yolov5 / plot_evolve

Function plot_evolve

utils/plots.py:476–500  ·  view source on GitHub ↗
(evolve_csv='path/to/evolve.csv')

Source from the content-addressed store, hash-verified

474
475
476def plot_evolve(evolve_csv='path/to/evolve.csv'): # from utils.plots import *; plot_evolve()
477 # Plot evolve.csv hyp evolution results
478 evolve_csv = Path(evolve_csv)
479 data = pd.read_csv(evolve_csv)
480 keys = [x.strip() for x in data.columns]
481 x = data.values
482 f = fitness(x)
483 j = np.argmax(f) # max fitness index
484 plt.figure(figsize=(10, 12), tight_layout=True)
485 matplotlib.rc('font', **{'size': 8})
486 print(f'Best results from row {j} of {evolve_csv}:')
487 for i, k in enumerate(keys[7:]):
488 v = x[:, 7 + i]
489 mu = v[j] # best single result
490 plt.subplot(6, 5, i + 1)
491 plt.scatter(v, f, c=hist2d(v, f, 20), cmap='viridis', alpha=.8, edgecolors='none')
492 plt.plot(mu, f.max(), 'k+', markersize=15)
493 plt.title(f'{k} = {mu:.3g}', fontdict={'size': 9}) # limit to 40 characters
494 if i % 5 != 0:
495 plt.yticks([])
496 print(f'{k:>15}: {mu:.3g}')
497 f = evolve_csv.with_suffix('.png') # filename
498 plt.savefig(f, dpi=200)
499 plt.close()
500 print(f'Saved {f}')
501
502
503def plot_results(file='path/to/results.csv', dir=''):

Callers 2

mainFunction · 0.90
mainFunction · 0.90

Calls 3

fitnessFunction · 0.90
hist2dFunction · 0.85
plotMethod · 0.80

Tested by

no test coverage detected