add warning to plot_results()

This commit is contained in:
Glenn Jocher 2020-04-11 11:04:10 -07:00
parent 7be71b02e2
commit b574f765ce
1 changed files with 15 additions and 12 deletions

View File

@ -966,18 +966,21 @@ def plot_results(start=0, stop=0, bucket='', id=()): # from utils.utils import
else: else:
files = glob.glob('results*.txt') + glob.glob('../../Downloads/results*.txt') files = glob.glob('results*.txt') + glob.glob('../../Downloads/results*.txt')
for f in sorted(files): for f in sorted(files):
results = np.loadtxt(f, usecols=[2, 3, 4, 8, 9, 12, 13, 14, 10, 11], ndmin=2).T try:
n = results.shape[1] # number of rows results = np.loadtxt(f, usecols=[2, 3, 4, 8, 9, 12, 13, 14, 10, 11], ndmin=2).T
x = range(start, min(stop, n) if stop else n) n = results.shape[1] # number of rows
for i in range(10): x = range(start, min(stop, n) if stop else n)
y = results[i, x] for i in range(10):
if i in [0, 1, 2, 5, 6, 7]: y = results[i, x]
y[y == 0] = np.nan # dont show zero loss values if i in [0, 1, 2, 5, 6, 7]:
# y /= y[0] # normalize y[y == 0] = np.nan # dont show zero loss values
ax[i].plot(x, y, marker='.', label=Path(f).stem, linewidth=2, markersize=8) # y /= y[0] # normalize
ax[i].set_title(s[i]) ax[i].plot(x, y, marker='.', label=Path(f).stem, linewidth=2, markersize=8)
if i in [5, 6, 7]: # share train and val loss y axes ax[i].set_title(s[i])
ax[i].get_shared_y_axes().join(ax[i], ax[i - 5]) 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])
except:
print('Warning: Plotting error for %s, skipping file' % f)
fig.tight_layout() fig.tight_layout()
ax[1].legend() ax[1].legend()