How could I get the loss acc val_loss val_acc info of a loaded model

Hi, suppose I train my model, by that time, I could see loss acc val_loss val_acc info, and I save it for later re-use, and comparison of result.
model = conv1(batches)
model.save_weights(model_path + ‘statefarm1.h5’)

While days after, I load the trained model,
model.load_weights(model_path + ‘statefarm1.h5’)
how could I get the previously loss acc val_loss val_acc info ? I means, once I retrain, the previous info in jupyter would loss.
Are these infos saved in statefarm1.h5, so I could later get them back ?
If not, what’s the recommended way of save these infos, and later re-get them back for comparison ?

1 Like

If you do model.save(...) instead of save_weights(), it also stores the state of the optimizer. (But I’m not sure if that state includes the previous loss and accuracy metrics.)

You need to save history object that is returned by the model.fit.

With Keras, you can use a callback function with the fit generator and output the validation loss or validation accuracy directly in the saved filename

filepath = 'weights.{epoch:02d}-{val_loss:.2f}.model’
history = model.fit_generator(
# (…) initial parameters,
callbacks=[ModelCheckpoint(filepath, monitor=‘val_acc’, save_best_only=True)]
)
You can take a look at : https://keras.io/callbacks/

thanks, @alexandrecc
how to save the history object to a file ? reading through the source code, have not find this.
And the properties of history, I only see val_loss and val_acc, not found loss, and acc.