I saw two ways of saving the weights of a keras model.
First way;
checkpointer = ModelCheckpoint(filepath=\"weights.hdf5\", verbose=1, save_best_only=Tru
No, there is no difference performance-wise. These are just two different ways of how and especially when the model shall be saved. Using model.save_weights
requires to especially call this function whenever you want to save the model, e.g. after the training or parts of the training are done. Using ModelCheckpoint
is much more convenient if you are still developing a model. Using this way, keras
can save a checkpoint of your model after each training epoch, so that you can restore the different models; or you can set save_best_only=True
so that keras
will overwrite the latest checkpoint only if the performance has improved, so that you end with the best performing model.
To summarize it: these are just two different ways of doing two different things. It depends on your use case and needs, what's the best.