我有一个类似的问题,并以此方式解决了
以JSON
格式存储 graph\architecture
,以h5
格式存储weights
import json
# lets assume `model` is main model
model_json = model.to_json()
with open("model_in_json.json", "w") as json_file:
json.dump(model_json, json_file)
model.save_weights("model_weights.h5")
然后需要先load model
以在模型中create
graph\architecture
和load_weights
from keras.models import load_model
from keras.models import model_from_json
import json
with open('model_in_json.json','r') as f:
model_json = json.load(f)
model = model_from_json(model_json)
model.load_weights('model_weights.h5')
0
我从这个链接克隆的人类姿态估计keras模型人体姿势估计keras
当我尝试在Google Colab上加载模型时,出现以下错误
码
错误
有人可以帮我了解这种只读模式吗?如何加载此模型?