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

dense_1 shape problem #2

Open
lucci17 opened this issue Nov 27, 2020 · 1 comment
Open

dense_1 shape problem #2

lucci17 opened this issue Nov 27, 2020 · 1 comment

Comments

@lucci17
Copy link

lucci17 commented Nov 27, 2020

When I run the resnet module, I meet a problem with the shape of layer.Here is the output:
Traceback (most recent call last):
File "PredictFromCamera.py", line 89, in
video_capture(_args)
File "PredictFromCamera.py", line 26, in video_capture
model, labels_map, int_to_labels_map = load_model(args.data_root, args.model, args.snapshot)
File "/media/bongos/Seagate1/tensorflow/lego_detector/Predict.py", line 252, in load_model
model.load_weights(os.path.join(snapshot_path, snapshot), by_name=True)
File "/home/bongos/venv/lib/python3.5/site-packages/keras/engine/network.py", line 1163, in load_weights
reshape=reshape)
File "/home/bongos/venv/lib/python3.5/site-packages/keras/engine/saving.py", line 1149, in load_weights_from_hdf5_group_by_name
str(weight_values[i].shape) + '.')
ValueError: Layer #176 (named "dense_1"), weight <tf.Variable 'dense_1/kernel:0' shape=(100352, 38) dtype=float32_ref> has shape (100352, 38), but the saved weight has shape (2048, 38).

My environment is tensorflow-gpu 1.12.0, Keras 2.2.4, Keras-Applications 1.0.7, Keras-Preprocessing 1.0.9
Can you help me with the problem?

@kirill-sidorchuk
Copy link
Owner

Hi Lucci,
Thank you for reporting. The issue has something to do with global average pooling, which appears to be absent from the model. I will take a look.

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

2 participants