我有一个简单的keras模型。保存模型后。我无法加载模型。这是我实例化模型并尝试加载权重后得到的错误:
Using TensorFlow backend.
Traceback (most recent call last):
File "test.py", line 4, in <module>
model = load_model("test.h5")
File "/usr/lib/python3.7/site-packages/keras/engine/saving.py", line 419, in load_model
model = _deserialize_model(f, custom_objects, compile)
File "/usr/lib/python3.7/site-packages/keras/engine/saving.py", line 258, in _deserialize_model
.format(len(layer_names), len(filtered_layers))
ValueError: You are trying to load a weight file containing 6 layers into a model with 0 layers
Run Code Online (Sandbox Code Playgroud)
用于实例化模型并使用model.load_weights进行模型汇总。当我使用print(model)打印模型时,我什么也没有
Traceback (most recent call last):
File "test.py", line 7, in <module>
print(model.summary())
AttributeError: 'NoneType' object has no attribute 'summary'
Run Code Online (Sandbox Code Playgroud)
这是我的网络:
from keras.models import Sequential …Run Code Online (Sandbox Code Playgroud)