Save Plot Images

PHOTO EMBED

Thu Jul 28 2022 17:27:03 GMT+0000 (Coordinated Universal Time)

Saved by @mnis00014

def plot_performance_acc(hist, hist_second):
    plt.rcParams['figure.figsize'] = (15, 7)
    hist_ = hist.history
    epochs = hist.epoch
    
    hist_01 = hist_second.history
    
    # epochs_01 = hist_01.epoch
    epochs_01 = hist_second.epoch
    
    plt.subplot(1, 2, 1) # row 1, col 2 index 1
    plt.plot(epochs, hist_['accuracy'], label='Training Accuracy')
    plt.plot(epochs, hist_['val_accuracy'], label='Validation Accuracy')
    plt.plot(epochs_01, hist_01['accuracy'], label='Training Accuracy_01')
    plt.plot(epochs_01, hist_01['val_accuracy'], label='Validation Accuracy_01')
    plt.xlabel('Epochs')
    plt.ylabel('Accuracy')
    # plt.ylim([-0.001, 2.0])
    # plt.title('Training and validation accuracy')
    plt.legend(loc = 'lower right')
    plt.title('Training and validation Accuracy')
    # plt.savefig('foo.jpg')
    
    plt.subplot(1, 2, 2) # row 1, col 2 index 1
    plt.plot(epochs, hist_['loss'], label='Training loss')
    plt.plot(epochs, hist_['val_loss'], label='Validation loss')
    plt.plot(epochs_01, hist_01['loss'], label='Training loss_01')
    plt.plot(epochs_01, hist_01['val_loss'], label='Validation loss')
    plt.xlabel('Epochs')
    plt.ylabel('Loss')
    # plt.ylim([-0.001, 2.0])
    plt.legend(loc = 'upper right')
    
    plt.title('Training and validation loss')
    plt.tight_layout(2)
    fig1 = plt.gcf()
    plt.show()
    plt.draw()
    fig1.savefig('tessstttyyy.png', dpi=100)
    
content_copyCOPY