What is the difference between these two ways of saving keras machine learning model weights?

前端 未结 2 684
我在风中等你
我在风中等你 2021-02-14 13:46

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         


        
2条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-14 14:51

    HDF5 (.h5, .hdf5)

    As fundamentally explained here reference.wolfram.com/language/ref/format/HDF5.html

    HDF is an acronym for Hierarchical Data Format. HDF5 is HDF Version 5.

    Import["file.h5"] 
    

    imports an HDF5 file, returning the names of the datasets stored in the file.

    In Keras documents; as you can see here keras.io/api/models/model_saving_apis/

    model.save('my_model.h5')  # creates a HDF5 file 'my_model.h5'
    

    In Tensorflow documents; as you can see here tensorflow.org/tutorials/keras/save_and_load

    # Save the entire model to a HDF5 file.
    # The '.h5' extension indicates that the model should be saved to HDF5.
    model.save('my_model.h5')
    

    At fundamental level they are same thing. They cant create any difference.

提交回复
热议问题