Skip to content

Instantly share code, notes, and snippets.

@karolzak
Last active January 18, 2019 13:01
Show Gist options
  • Save karolzak/27834b49431d848ee3e08e94f272f5e3 to your computer and use it in GitHub Desktop.
Save karolzak/27834b49431d848ee3e08e94f272f5e3 to your computer and use it in GitHub Desktop.
plotting training history for keras unet implementation
import numpy as np
import matplotlib.pyplot as plt
def plot_segm_history(history):
# summarize history for iou
plt.figure(figsize=(12,6))
plt.plot(history.history['iou'], linewidth=3)
plt.plot(history.history['val_iou'], linewidth=3)
plt.suptitle('iou metric', fontsize=20)
plt.ylabel('iou', fontsize=20)
plt.xlabel('epoch', fontsize=20)
#plt.yticks(np.arange(0.3, 1, step=0.02), fontsize=35)
#plt.xticks(fontsize=35)
plt.legend(['train', 'test'], loc='center right', fontsize=15)
plt.show()
# summarize history for loss
plt.figure(figsize=(12,6))
plt.plot(history.history['loss'], linewidth=3)
plt.plot(history.history['val_loss'], linewidth=3)
plt.suptitle('loss', fontsize=20)
plt.ylabel('loss', fontsize=20)
plt.xlabel('epoch', fontsize=20)
#plt.yticks(np.arange(0, 0.2, step=0.005), fontsize=35)
#plt.xticks(fontsize=35)
plt.legend(['train', 'test'], loc='center right', fontsize=15)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment