Loading... # 1. 只保存和使用模型结构,不包含配置和权重 ```python json_string = model.to_json() open('my_model_architecture.json','w').write(json_string) from keras.models import model_from_json model = model_from_json(open('my_model_architecture.json').read()) #保存成yaml文件 yaml_string = model.to_yaml() open('my_model_architectrue.yaml','w').write(yaml_string) from keras.models import model_from_yaml model = model_from_yaml(open('my_model_architecture.yaml').read()) ``` # 2. 只保存和使用权重 ```python #利用HDF5进行保存 model.save_weights('my_model_weights.h5') model.load_weights('my_model_weights.h5') ``` # 3.保存和使用模型、权重、配置 ```python model.save('filepath.h5') import keras.models import load_model model = load_model('filepath.h5') ``` Last modification:August 5, 2021 © Allow specification reprint Support Appreciate the author AliPayWeChat Like 如果觉得我的内容对你有用,请随意赞赏
One comment
有点6啊