Human-Action-Recognition-with-Keras
Human-Action-Recognition-with-Keras copied to clipboard
ValueError: Layer weight shape (3, 3, 224, 64) not compatible with provided weight shape (64, 3, 3, 3)
Using Theano backend. (Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0) (Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0) (Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0) (Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0) (Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0) (Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0) (Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0) (Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0) (Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0) (Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0) (Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0) (Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0) (Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0) Traceback (most recent call last): File "HumanActionRecognition.py", line 110, in model.layers[k].set_weights(weights) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/keras/engine/topology.py", line 985, in set_weights 'provided weight shape ' + str(w.shape)) ValueError: Layer weight shape (3, 3, 224, 64) not compatible with provided weight shape (64, 3, 3, 3)
I have the same problem!!! ValueError: Layer weight shape (3, 3, 224, 64) not compatible with provided weight shape (64, 3, 3, 3)
Have you solved the problem? I had set Theano backend.
Check whether "image_dim_ordering" in "~/.keras/keras.json" is "th". I had the same problem when this value was "tf".
Have you solved the problem? I am also facing same problem.. ValueError: Layer weight shape (3, 3, 223, 64) not compatible with provided weight shape (64, 3, 3, 3)
I have the same problem, trying to load 2 saved trained models I get: ValueError: Optimizer weight shape (32, 32, 128) not compatible with provided weight shape (128, 128, 32) Any solution?
I have the same problem, have you solved it?
@ecemseymen, yes I did. Tensorflow's default is a single model when loading. If you want to load several models you have to rename them. For example:
model0 = load_model('D:\Python\models/model0.hdf5') # load compiled model
model0.name = 'model0' # Rename model to avoid "model_0" conflict 3 times . names should be unique
for layer in model0.layers: # this line is necessary if you don't want to re-train the model
layer.trainable=False
model1 = load_model('D:\Python\models/model1.hdf5')
model1.name = 'model1'
for layer in model1.layers: # freeze model weigths
layer.trainable=False
model3 = load_model('D:\Python\models/model3.hdf5')
model3.name = 'model3'
for layer in model3.layers:
layer.trainable=False
then the rest of your code........ I hope it helps.
i have same error. I am using keras 2.2.4. Have you solved the problem?
[Solved] I changed some think like:
for k in range(f.attrs['nb_layers']):
if k >= len(model.layers):
# we don't look at the last (fully-connected) layers in the savefile
break
g = f['layer_{}'.format(k)]
weights = [g['param_{}'.format(p)] for p in range(g.attrs['nb_params'])]
layer = model.layers[k]
#model.layers[k].set_weights(weights)
if layer.__class__.__name__ in ['Conv1D', 'Conv2D', 'Conv3D', 'AtrousConvolution2D']:
weights[0] = np.transpose(weights[0], (2, 3, 1, 0))
layer.set_weights(weights)
f.close()
Hi, I noticed that in row 36 the pre-trained model whole_model.h5 is used. I can't find it in your depository. Anyone ones where to find it? Thanks.
I have the same problem, have you solved it?
Make sure you have set image_data_format to channels_first