Closed jyuan1322 closed 7 years ago
It shows the shape of pre-trained weight provided is not the same as the shape of weight the layer needs, I'm not sure where the problem occurs, but I guess it could be the backend you use(tensorflow or theano) and the configuration of image_dim_ordering(th or tf).
Try this:
If this does not work, please show us the complete error message, including in which line the error occurs. It will help us find out where the problem occurs.
Ah, it works now - I was using tensorflow as my backend. If theano is a requirement, it would be great if that can be added to the dependencies in the readme file, in case anyone else has the same issue. Thanks for your help!
Great, hope this repo can give you some help. I will update the dependencies, thanks for your advice.
Hi, I am having the exact same error. And the keras.json file already exists, and has the exact same line as you described above. My keras version is 2.0.3.
Do you know what would be the problem? Thanks!
Traceback (most recent call last):
File "Deconvnet-keras.py", line 526, in <module>
main()
File "Deconvnet-keras.py", line 514, in main
layer_name, feature_to_visualize, visualize_mode)
File "Deconvnet-keras.py", line 418, in visualize
deconv_layers.append(DConvolution2D(model.layers[i]))
File "Deconvnet-keras.py", line 59, in __init__
)(input)
File "/Users/AriaW/anaconda2/lib/python2.7/site-packages/keras/engine/topology.py", line 558, in __call__
self.set_weights(self._initial_weights)
File "/Users/AriaW/anaconda2/lib/python2.7/site-packages/keras/engine/topology.py", line 1158, in set_weights
'provided weight shape ' + str(w.shape))
ValueError: Layer weight shape (3, 64, 3, 3) not compatible with provided weight shape (3, 3, 3, 64)
Hi, This is a backend problem, because the weight shapes of tensorflow and theano are different. Make sure you are using theano backend. I will test the code with keras 2.0.3 and then give you a reply
I am sure I am using the theano backend.
Downgrading keras to 1.1 did solve this. Thanks!
Hi! I am getting the following error when running the code:
ValueError: Layer weight shape (3, 64, 3, 3) not compatible with provided weight shape (3, 3, 3, 64)
I wonder if this has to do with compatibility between different versions of Keras? I am using 1.2.2, although I tried switching to 1.1.0 as well, and it didn't appear to resolve it.