From a0ef217842b74c6a65fedb7b367c0c40b95db1f0 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sun, 24 Nov 2019 20:10:39 -1000 Subject: [PATCH] updates --- utils/utils.py | 49 ++++++++++++++++++++++--------------------------- 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/utils/utils.py b/utils/utils.py index e6b39794..050e2392 100755 --- a/utils/utils.py +++ b/utils/utils.py @@ -902,30 +902,6 @@ def plot_evolution_results(hyp): # from utils.utils import *; plot_evolution_re plt.savefig('evolve.png', dpi=200) -def plot_results(start=0, stop=0): # from utils.utils import *; plot_results() - # Plot training results files 'results*.txt' - fig, ax = plt.subplots(2, 5, figsize=(14, 7)) - ax = ax.ravel() - s = ['GIoU', 'Objectness', 'Classification', 'Precision', 'Recall', - 'val GIoU', 'val Objectness', 'val Classification', 'mAP@0.5', 'F1'] - for f in sorted(glob.glob('results*.txt') + glob.glob('../../Downloads/results*.txt')): - results = np.loadtxt(f, usecols=[2, 3, 4, 8, 9, 12, 13, 14, 10, 11], ndmin=2).T - n = results.shape[1] # number of rows - x = range(start, min(stop, n) if stop else n) - for i in range(10): - y = results[i, x] - if i in [0, 1, 2, 5, 6, 7]: - y[y == 0] = np.nan # dont show zero loss values - ax[i].plot(x, y, marker='.', label=f.replace('.txt', '')) - ax[i].set_title(s[i]) - if i in [5, 6, 7]: # share train and val loss y axes - ax[i].get_shared_y_axes().join(ax[i], ax[i - 5]) - - fig.tight_layout() - ax[1].legend() - fig.savefig('results.png', dpi=200) - - def plot_results_overlay(start=0, stop=0): # from utils.utils import *; plot_results_overlay() # Plot training results files 'results*.txt', overlaying train and val losses s = ['train', 'train', 'train', 'Precision', 'mAP@0.5', 'val', 'val', 'val', 'Recall', 'F1'] # legends @@ -949,6 +925,25 @@ def plot_results_overlay(start=0, stop=0): # from utils.utils import *; plot_re fig.savefig(f.replace('.txt', '.png'), dpi=200) -def version_to_tuple(version): - # Used to compare versions of library - return tuple(map(int, (version.split(".")))) +def plot_results(start=0, stop=0): # from utils.utils import *; plot_results() + # Plot training results files 'results*.txt' + fig, ax = plt.subplots(2, 5, figsize=(14, 7)) + ax = ax.ravel() + s = ['GIoU', 'Objectness', 'Classification', 'Precision', 'Recall', + 'val GIoU', 'val Objectness', 'val Classification', 'mAP@0.5', 'F1'] + for f in sorted(glob.glob('results*.txt') + glob.glob('../../Downloads/results*.txt')): + results = np.loadtxt(f, usecols=[2, 3, 4, 8, 9, 12, 13, 14, 10, 11], ndmin=2).T + n = results.shape[1] # number of rows + x = range(start, min(stop, n) if stop else n) + for i in range(10): + y = results[i, x] + if i in [0, 1, 2, 5, 6, 7]: + y[y == 0] = np.nan # dont show zero loss values + ax[i].plot(x, y, marker='.', label=f.replace('.txt', '')) + ax[i].set_title(s[i]) + if i in [5, 6, 7]: # share train and val loss y axes + ax[i].get_shared_y_axes().join(ax[i], ax[i - 5]) + + fig.tight_layout() + ax[1].legend() + fig.savefig('results.png', dpi=200)