Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loading weights error in the testing step, after a successful transfer learning training #64

Open
0xzhou opened this issue Feb 23, 2021 · 0 comments

Comments

@0xzhou
Copy link

0xzhou commented Feb 23, 2021

Hi, Thank you very much for the nice code and instructions.
I use your ResNet18 model as an image encoder in training a VAE. I can train with your ResNet18 model with the pretrained weights. But when I want to test the trained model by loading the saved weights, I got the following errors. Could you please give me some advice on fixing it?

Traceback (most recent call last): File "test_MMI.py", line 123, in <module> main(arg_parser.parse_test_arguments(sys.argv[1:])) File "test_MMI.py", line 62, in main model.load_weights(weights_path) File "/home/zmy/anaconda3/envs/tfk-3dvae/lib/python3.6/site-packages/tensorflow/python/keras/engine/network.py", line 1516, in load_weights saving.load_weights_from_hdf5_group(f, self.layers) File "/home/zmy/anaconda3/envs/tfk-3dvae/lib/python3.6/site-packages/tensorflow/python/keras/engine/saving.py", line 810, in load_weights_from_hdf5_group layer, weight_values, original_keras_version, original_backend) File "/home/zmy/anaconda3/envs/tfk-3dvae/lib/python3.6/site-packages/tensorflow/python/keras/engine/saving.py", line 468, in preprocess_weights_for_loading weights = convert_nested_model(weights) File "/home/zmy/anaconda3/envs/tfk-3dvae/lib/python3.6/site-packages/tensorflow/python/keras/engine/saving.py", line 444, in convert_nested_model original_backend=original_backend)) File "/home/zmy/anaconda3/envs/tfk-3dvae/lib/python3.6/site-packages/tensorflow/python/keras/engine/saving.py", line 468, in preprocess_weights_for_loading weights = convert_nested_model(weights) File "/home/zmy/anaconda3/envs/tfk-3dvae/lib/python3.6/site-packages/tensorflow/python/keras/engine/saving.py", line 456, in convert_nested_model original_backend=original_backend)) File "/home/zmy/anaconda3/envs/tfk-3dvae/lib/python3.6/site-packages/tensorflow/python/keras/engine/saving.py", line 468, in preprocess_weights_for_loading weights = convert_nested_model(weights) File "/home/zmy/anaconda3/envs/tfk-3dvae/lib/python3.6/site-packages/tensorflow/python/keras/engine/saving.py", line 444, in convert_nested_model original_backend=original_backend)) File "/home/zmy/anaconda3/envs/tfk-3dvae/lib/python3.6/site-packages/tensorflow/python/keras/engine/saving.py", line 549, in preprocess_weights_for_loading if K.int_shape(layer.weights[0]) != weights[0].shape: IndexError: list index out of range

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant