keras中的只读模式
我从这个链接克隆的人类姿态估计keras模型人体姿势估计keras
当我尝试在Google Colab上加载模型时,出现以下错误
码
from keras.models import load_modelmodel = load_model('model.h5')
错误
ValueError Traceback (most recent calllast)
<ipython-input-29-bdcc7d8d338b> in <module>()
1 from keras.models import load_model
----> 2 model = load_model('model.h5')
/usr/local/lib/python3.6/dist-packages/keras/engine/saving.py in load_model(filepath, custom_objects, compile)
417 f = h5dict(filepath, 'r')
418 try:
--> 419 model = _deserialize_model(f, custom_objects, compile)
420 finally:
421 if opened_new_file:
/usr/local/lib/python3.6/dist-packages/keras/engine/saving.py in _deserialize_model(f, custom_objects, compile)
219 return obj
220
--> 221 model_config = f['model_config']
222 if model_config is None:
223 raise ValueError('No model found in config.')
/usr/local/lib/python3.6/dist-packages/keras/utils/io_utils.py in __getitem__(self, attr)
300 else:
301 if self.read_only:
--> 302 raise ValueError('Cannot create group in read only mode.')
303 val = H5Dict(self.data.create_group(attr))
304 return val
ValueError: Cannot create group in read only mode.
有人可以帮我了解这种只读模式吗?如何加载此模型?
回答:
这是在Google Collab上为您创建的Git
gist示例:https
:
//gist.github.com/kolygri/835ccea6b87089fbfd64395c3895c01f
据我所理解:
您必须设置和定义模型的体系结构,然后使用model.load_weights(’alexnet_weights.h5’)。
这是一个有用的Github对话链接,希望可以帮助您更好地理解问题:https : //github.com/keras-
team/keras/issues/6937
以上是 keras中的只读模式 的全部内容, 来源链接: utcz.com/qa/399832.html