我遇到了ValueError: Layer weight shape (3, 3, 3, 64) not compatible with provided weight shape (64, 3, 3, 3)
中描述的相同错误使用时:
K.set_image_dim_ordering('tf')
我收到此错误
Traceback (most recent call last):
File "<input>", line 1, in <module>
AttributeError: module 'keras.backend' has no attribute 'set_image_dim_ordering'
当我使用其他解决方案时:
from keras.utils.conv_utils import convert_kernel
reshaped_weights = convert_kernel(weights)
model.layers[k].set_weights(reshaped_weights)
我收到此错误:
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "<input>", line 11, in load_model_weights
File "/home/khawkha/.virtualenvs/DeepMS/lib/python3.6/site-packages/keras/utils/conv_utils.py", line 78, in convert_kernel
raise ValueError('Invalid kernel shape:', kernel.shape)
ValueError: ('Invalid kernel shape:', (0,))
keras版本:“ 2.3.1” Tensorflow版本:1.15.0
答案 0 :(得分:-2)