Save and load weights in keras

前端 未结 3 874
逝去的感伤
逝去的感伤 2020-11-30 20:56

Im trying to save and load weights from the model i have trained.

the code im using to save the model is.

TensorBoard(log_dir=\'/output\')
model.fit_         


        
3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-30 21:23

    For loading weights, you need to have a model first. It must be:

    existingModel.save_weights('weightsfile.h5')
    existingModel.load_weights('weightsfile.h5')     
    

    If you want to save and load the entire model (this includes the model's configuration, it's weights and the optimizer states for further training):

    model.save_model('filename')
    model = load_model('filename')
    

提交回复
热议问题