Skip to content

Instantly share code, notes, and snippets.

@aurotripathy
Last active December 3, 2019 23:17
Show Gist options
  • Save aurotripathy/a542493ecd7aad237323878ab11a3943 to your computer and use it in GitHub Desktop.
Save aurotripathy/a542493ecd7aad237323878ab11a3943 to your computer and use it in GitHub Desktop.
plot of Top1/Top5 validation accuracy for ImageNet training
import json
from pudb import set_trace
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
with open('good_run_raport.json') as json_file:
data = json.load(json_file)
print("top 5")
val_top5 = data['epoch']['val.top5']
print(val_top5)
print(len(val_top5))
print("top 1")
val_top1 = data['epoch']['val.top1']
print(val_top1)
print(len(val_top1))
# Plots
epochs = np.arange(len(val_top1))
val_acc_top1 = val_top1
val_acc_top5 = val_top5
fig, ax = plt.subplots()
ax.plot(epochs, val_acc_top1, 'k--', label='Top1')
ax.plot(epochs, val_acc_top5, 'k:', label='Top5')
ax.set(xlabel='epochs (s)', ylabel='Validation accuracy',
title='Validation accuracy over {} epochs'.format(len(val_top1)))
ax.grid()
legend = ax.legend(loc='lower right', shadow=False, fontsize='x-large')
fig.savefig("/dockerx/val_plot.png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment