小编jog*_*gan的帖子

ValueError:您正在尝试将包含6层的权重文件加载到模型中,其值为0

我有一个简单的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)

python neural-network deep-learning keras

3
推荐指数
1
解决办法
2051
查看次数

标签 统计

deep-learning ×1

keras ×1

neural-network ×1

python ×1