我正在尝试加载keras模型,但出现此错误
我正在使用此软件包:
Keras:2.2.4 Tensorflow:1.13.x Python 2.7.13 Raspbian GNU / Linux 9.8
使用TensorFlow后端。 现在正在加载模型...
WARNING:tensorflow:From /home/pi/.local/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version. Instructions for updating: Colocations handled automatically by placer. Traceback (most recent call last): File "test.py", line 14, in <module>
model = load_model('mobilenet_v2_3(trained).h5') File "/home/pi/.local/lib/python2.7/site-packages/keras/engine/saving.py", line 419, in load_model
model = _deserialize_model(f, custom_objects, compile) File "/home/pi/.local/lib/python2.7/site-packages/keras/engine/saving.py", line 225, in _deserialize_model
model = model_from_config(model_config, custom_objects=custom_objects) File "/home/pi/.local/lib/python2.7/site-packages/keras/engine/saving.py", line 458, in model_from_config
return deserialize(config, custom_objects=custom_objects) File "/home/pi/.local/lib/python2.7/site-packages/keras/layers/__init__.py", line 55, in deserialize
printable_module_name='layer') File "/home/pi/.local/lib/python2.7/site-packages/keras/utils/generic_utils.py", line 145, in deserialize_keras_object
list(custom_objects.items()))) File "/home/pi/.local/lib/python2.7/site-packages/keras/engine/network.py", line 1022, in from_config
process_layer(layer_data) File "/home/pi/.local/lib/python2.7/site-packages/keras/engine/network.py", line 1008, in process_layer
custom_objects=custom_objects) File "/home/pi/.local/lib/python2.7/site-packages/keras/layers/__init__.py", line 55, in deserialize
printable_module_name='layer') File "/home/pi/.local/lib/python2.7/site-packages/keras/utils/generic_utils.py", line 145, in deserialize_keras_object
list(custom_objects.items()))) File "/home/pi/.local/lib/python2.7/site-packages/keras/layers/core.py", line 735, in from_config
function = func_load(config['function'], globs=globs) File "/home/pi/.local/lib/python2.7/site-packages/keras/utils/generic_utils.py", line 235, in func_load
code = marshal.loads(raw_code)
ValueError:元帅数据错误(类型代码未知)