ValueError: You are trying to load a weight file containing 428 layers into a model with 114 layers.
See original GitHub issueI have trained a segmentation model, the backbone is densenet201 with pretrained model, the decoder is FPN But, when I load saved weight for predicting,raise error as below:
Traceback (most recent call last):
File "test.py", line 62, in <module>
main()
File "test.py", line 57, in main
apply_predict()
File "test.py", line 27, in apply_predict
model.load_weights("models/densenet201_fpn_w.h5")
File "/home/jiangd/.conda/envs/tf110/lib/python3.5/site-packages/keras/engine/network.py", line 1166, in load_weights
f, self.layers, reshape=reshape)
File "/home/jiangd/.conda/envs/tf110/lib/python3.5/site-packages/keras/engine/saving.py", line 1030, in load_weights_from_hdf5_group
str(len(filtered_layers)) + ' layers.')
ValueError: You are trying to load a weight file containing 428 layers into a model with 114 layers.
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Loading saved model fails with ValueError You are trying to ...
Loading saved model fails with ValueError You are trying to load a weight file containing 1 layers into a model with 0 layers...
Read more >ValueError: You are trying to load a weight file containing 6 ...
It seems models with InputLayer are not serialized to HDF5 correctly. Upgrade your Tensorflow and Keras to the latest version. Fix the ...
Read more >You are trying to load a weight file containing 0 layers into a ...
I'am currently using keras 2.1.5 in anaconda(windows). This is the error when I'am trying to load the weights file available online into VGG16...
Read more >You are trying to load a weight file containing 0 layers into a ...
ValueError : You are trying to load a weight file containing 0 layers into a model with 16 layers. ... 428: 'barrow, garden...
Read more >tensorflow/python/keras/engine/training.py | Fossies
If the model has multiple outputs, 499 you can use a different loss on each ... 744 raise ValueError('Your model contains layers that...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Now I am working on adopting all models for
tf.keras(you can check in tf.keras branch), after that I am going to make some tutorials with training/inferenceTo load model use:
Hope this helps.