This commit is contained in:
Glenn Jocher 2019-08-05 13:32:48 +02:00
parent f5248067dc
commit cd5b9d3fdc
1 changed files with 22 additions and 5 deletions

View File

@ -748,13 +748,12 @@ def plot_evolution_results(hyp): # from utils.utils import *; plot_evolution_re
plt.savefig('evolve.png', dpi=200) plt.savefig('evolve.png', dpi=200)
def plot_results(start=0, stop=0): # from utils.utils import *; plot_results2() def plot_results(start=0, stop=0): # from utils.utils import *; plot_results()
# Plot training results files 'results*.txt' # Plot training results files 'results*.txt'
fig, ax = plt.subplots(2, 5, figsize=(14, 7)) fig, ax = plt.subplots(2, 5, figsize=(14, 7))
ax = ax.ravel() ax = ax.ravel()
s = ['GIoU', 'Confidence', 'Classification', 'Precision', 'Recall', s = ['GIoU', 'Confidence', 'Classification', 'Precision', 'Recall',
'GIoU val', 'val Confidence', 'val Classification', 'mAP', 'F1'] 'val GIoU', 'val Confidence', 'val Classification', 'mAP', 'F1']
for f in sorted(glob.glob('results*.txt') + glob.glob('../../Downloads/results*.txt')): for f in sorted(glob.glob('results*.txt') + glob.glob('../../Downloads/results*.txt')):
results = np.loadtxt(f, usecols=[2, 4, 5, 9, 10, 13, 14, 15, 11, 12]).T results = np.loadtxt(f, usecols=[2, 4, 5, 9, 10, 13, 14, 15, 11, 12]).T
n = results.shape[1] # number of rows n = results.shape[1] # number of rows
@ -767,14 +766,32 @@ def plot_results(start=0, stop=0): # from utils.utils import *; plot_results2()
fig.savefig('results.png', dpi=200) 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
fig, ax = plt.subplots(1, 5, figsize=(14, 3.5))
ax = ax.ravel()
s = ['train', 'train', 'train', 'Precision', 'mAP', 'val', 'val', 'val', 'Recall', 'F1'] # legends
t = ['GIoU', 'Confidence', 'Classification', 'P-R', 'mAP-F1'] # titles
for f in sorted(glob.glob('results*.txt') + glob.glob('../../Downloads/results*.txt')):
results = np.loadtxt(f, usecols=[2, 4, 5, 9, 11, 13, 14, 15, 10, 12]).T
n = results.shape[1] # number of rows
x = range(start, min(stop, n) if stop else n)
for i in range(5):
ax[i].plot(x, results[i, x], marker='.', label=s[i])
ax[i].plot(x, results[i+5, x], marker='.', label=s[i+5])
ax[i].set_title(t[i])
ax[i].legend()
fig.tight_layout()
fig.savefig('results.png', dpi=200)
def plot_results_orig(start=0, stop=0): # from utils.utils import *; plot_results_orig() def plot_results_orig(start=0, stop=0): # from utils.utils import *; plot_results_orig()
# Plot training results files 'results*.txt' in original format # Plot training results files 'results*.txt' in original format
fig, ax = plt.subplots(2, 5, figsize=(14, 7)) fig, ax = plt.subplots(2, 5, figsize=(14, 7))
ax = ax.ravel() ax = ax.ravel()
s = ['GIoU/XY', 'Width/Height', 'Confidence', 'Classification', 'Train Loss', 'Precision', 'Recall', 'mAP', 'F1', s = ['GIoU/XY', 'Width/Height', 'Confidence', 'Classification', 'Train Loss', 'Precision', 'Recall', 'mAP', 'F1',
'Test Loss'] 'Test Loss']
for f in sorted(glob.glob('results*.txt') + glob.glob('../../Downloads/results*.txt')): for f in sorted(glob.glob('results*.txt') + glob.glob('../../Google Drive/results*.txt')):
results = np.loadtxt(f, usecols=[2, 3, 4, 5, 6, 9, 10, 11, 12, 13]).T results = np.loadtxt(f, usecols=[2, 3, 4, 5, 6, 9, 10, 11, 12, 13]).T
n = results.shape[1] # number of rows n = results.shape[1] # number of rows
x = range(start, min(stop, n) if stop else n) x = range(start, min(stop, n) if stop else n)