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

ValueError: Layer #391 (named "mrcnn_bbox_fc"), weight <tf.Variable 'mrcnn_bbox_fc/kernel:0' shape=(1024, 4) dtype=float32_ref> has shape (1024, 4), but the saved weight has shape (1024, 8). #10

Open
angyee opened this issue Jul 1, 2019 · 5 comments

Comments

@angyee
Copy link

angyee commented Jul 1, 2019

$ python3 main.py

Using TensorFlow backend.
2019-07-01 11:52:10.385753: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2019-07-01 11:52:10.408767: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 3600000000 Hz
2019-07-01 11:52:10.409344: I tensorflow/compiler/xla/service/service.cc:150] XLA service 0x22d6a50 executing computations on platform Host. Devices:
2019-07-01 11:52:10.409356: I tensorflow/compiler/xla/service/service.cc:158] StreamExecutor device (0): ,
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
WARNING:tensorflow:From /home/deepedge/mask_rcnn-master/mrcnn_serving_ready-master/model.py:771: to_float (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.cast instead.
Traceback (most recent call last):
File "main.py", line 108, in
model.load_weights(H5_WEIGHT_PATH, by_name=True)
File "/home/deepedge/mask_rcnn-master/mrcnn_serving_ready-master/model.py", line 2131, in load_weights
saving.load_weights_from_hdf5_group_by_name(f, layers)
File "/usr/local/lib/python3.6/dist-packages/keras/engine/saving.py", line 1149, in load_weights_from_hdf5_group_by_name
str(weight_values[i].shape) + '.')
ValueError: Layer #391 (named "mrcnn_bbox_fc"), weight <tf.Variable 'mrcnn_bbox_fc/kernel:0' shape=(1024, 4) dtype=float32_ref> has shape (1024, 4), but the saved weight has shape (1024, 8).
@bendangnuksung

@LeonSpark
Copy link

I got the same error, and modify the NUM_CLASSES to actual num of classes. NOT actual number of classes + 1(background)

@angyee
Copy link
Author

angyee commented Jul 3, 2019

in my case is solved, do download complete clone and make change in user_config.py and use it, use config.py as it is.

@vikiQiu
Copy link

vikiQiu commented Jul 8, 2019

I got the same error, and modify the NUM_CLASSES to actual num of classes. NOT actual number of classes + 1(background)

If set NUM_CLASSES as actual num of classes, it will raise error while training.
expected input_image_meta to have shape (44,) but got array with shape (45,)
Here my num of classes is 32.

@LeonSpark
Copy link

@vikiQiu In the config.py in this repo.
self.NUM_CLASSES = 1 + NUMBER_OF_CLASSES # Background + tags
So you need to set NUM_CLASSES to the acutal one while you are exporting trained model for tf serving with this repo. NOT for training.

@davidvirdeforshh
Copy link

I got the same error, and modify the NUM_CLASSES to actual num of classes. NOT actual number of classes + 1(background)

This worked for me. Thank you!

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

4 participants