ssd_keras
ssd_keras copied to clipboard
can't load the weights from weights_SSD300.hdf5
When I run SSD.py file. Fail to run this code : model.load_weights('weights_SSD300.hdf5', by_name=True) It gives error: ValueError: Dimension 0 in both shapes must be equal, but are 64 and 3 for 'Assign_4' (op: 'Assign') with input shapes: [64,300,3,3], [3,3,3,64].
Seems the weights_SSD300.hdf5 doesn't match your model. Could you please help me with this. Thank you very much.
@xikaichen are you using the same setup as in README? Probsbly, something in Keras
or Tensorflow
has changed recently and that is the source of the problem.
I also tried to run SSD.py file, however I failed to run the same code : model.load_weights('weights_SSD300.hdf5', by_name=True)
It gives error: ValueError: Dimension 0 in both shapes must be equal, but are 64 and 3
I used TensorFlow v0.11.0 and Keras v1.1.2 as README describes.
I seem the weights_SSD300.hdf5 doesn't match your model as @xikaichen mentioned in above. Could you please help me with this. Thank you in advance.
hi, try to use python3. It might work On Sat, Feb 18, 2017 at 2:26 AM Yuki BAN [email protected] wrote:
I also tried to run SSD.py file, however I failed to run the same code : model.load_weights('weights_SSD300.hdf5', by_name=True)
It gives error: ValueError: Dimension 0 in both shapes must be equal, but are 64 and 3
I used TensorFlow v0.11.0 and Keras v1.1.2 as README describes.
I seem the weights_SSD300.hdf5 doesn't match your model as @xikaichen https://github.com/xikaichen mentioned in above. Could you please help me with this. Thank you in advance.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rykov8/ssd_keras/issues/37#issuecomment-280828382, or mute the thread https://github.com/notifications/unsubscribe-auth/AOJkoSuahmuI-InwzoQIKpzl9hE5tOGgks5rdp0HgaJpZM4L_bJH .
It was my mistake of setting up of .keras/keras.json
, thank you.
What was the mistake you were making @yukiB? I am facing the same error.
hi @anmolkalia,
Maybe your keras.json
is like this
{
"image_dim_ordering": "th",
"epsilon": 1e-07,
"floatx": "float32",
"backend": "tensorflow"
}
If it's that, you should alter mage_dim_ordering
to tf
.
Data's structure is different between th
(channels, conv_dim1, conv_dim2, conv_dim3) and tf
(conv_dim1, conv_dim2, conv_dim3, channels).
hi @anmolkalia @yukiB I meet a similar problem ,when i run a project using keras backened by tesorflow.When i load a weight .h5, it raised a error as follow:
ValueError: Dimension 0 in both shapes must be equal, but are 512 and 256 for 'Assign_12' (op: 'Assign') with input shapes: [512,768], [256,768].
I can't figure out .Could you please help me with is ,thanks!
I have similar problem. I implemented various autoencoders from keras blog. Saving and restoring weights for NN model always works ok. However saving/loading for conv-net causes random errors:
Can't load weights to model Dimension 0 in both shapes must be equal, but are 3 and 16 for 'Assign_2504' (op: 'Assign') with input shapes: [3,3,1,8], [16,1,3,3]
What's interesting is that sometimes shapes are [3,3,1,8], [16,1,3,3] and sometimes [16,1,3,3][3,3,1,8]. Even more interesting is that rarerly it works without any error.
Also I noticed that if I reuse existing model - loading weights works, still when creating model from scratch it causes errors. All code is run in Jupyter notebook within same jupyter session.
I've got same error in loading weights, which are dumped from my own ssd codes for keras 2.1.5 and tf 1.4.
anyone got the solution?
Dimension 0 in both shapes must be equal, but are 3 and 63 for 'Assign_879' (op: 'Assign') with input shapes: [3,3,512,60], [63,512,3,3].
@yusuke0324 I just got same error as yours. I just change the version to keras 2.1.4 & tensorflow-gpu 1.3.0. you can have a try