0

I load the Keras model I have been training with 150 epochs

tbCallBack = tensorflow.keras.callbacks.TensorBoard(log_dir='./Graph', histogram_freq=0, write_graph=True, write_images=True)


my_model.fit(X_train, X_train,
                     epochs=200, 
                     batch_size=100,
                     shuffle=True,
                     validation_data = (X_test, X_test),
                     callbacks=[tbCallBack]
               )

# Save the model
my_model.save('my_model.hdf5')

Then, I will load the Keras model

my_model = load_model("my_model.hdf5")

Is there a way to load all the epochs logs (loss, accuracy.. ) ?

Alex
  • 1,447
  • 7
  • 23
  • 48

1 Answers1

1

You can use the keras callback called CSVLogger.

According to the documentation, it streams the results from each epoch into a csv file.

This is the code from the documentation of it.

from keras.callbacks import CSVLogger

csv_logger = CSVLogger('training.log')
model.fit(X_train, Y_train, callbacks=[csv_logger])

You can then manipulate it as a normal CSV file, for your needs.

Rachayita Giri
  • 487
  • 5
  • 17
  • 1
    Thank you. I guess there is no way to restore the logs from the model I've already trained, right? – Alex Nov 12 '19 at 16:15
  • If you used tensorboard for that model, maybe this answer will work for you: https://stackoverflow.com/a/42358524/6590393 . It has the option of losses per epoch too. – Rachayita Giri Nov 12 '19 at 16:20