deep-learning-with-python-cn
deep-learning-with-python-cn copied to clipboard
第13章 用序列化保存模型 导出模型代码有误
在json部分中,导入和导出代码一样的,没有读取json文件的代码,只有保存json文件的,我找到了作者的原文,里面有代码,https://machinelearningmastery.com/save-load-keras-deep-learning-models/
json_file = open('model.json', 'r') loaded_model_json = json_file.read() json_file.close() loaded_model = model_from_json(loaded_model_json)
loaded_model.load_weights("model.h5") print("Loaded model from disk")