keras搬砖系列-Flatten ValueError
之前总是会出现,ValueError: The shape of the input to "Flatten" is not fully defined (got (0, 6, 80). Make sure to pass a complete "input_shape" or "batch_input_shape" argument to the first layer in your model.
我用的theano,而且我的.keras.json也改为了theano。
后面通过:
keras.backend.image_data_format()
发现为
'channels_last'。emmm,我也不知道,但是我的.keras.json为'channels_first'。不管他了。
解决方法:
from keras import backend as K
K.set_image_data_format('channels_first')
如果你是tensorflow的,所以你得设置为channels_last
channels_last