python keras Convolution2D 层无法正常工作并得到错误的结果

python keras Convolution2D layer works not correctly and gets a wrong result

from keras.models import Sequential
from keras.layers import Convolution2D
model = Sequential()
model.add(Convolution2D(64, 3, 3, border_mode='same', input_shape=(3, 256, 256)))

This example 说:

now model.output_shape == (None, 64, 256, 256)

但是在我的控制台中,我得到了结果 model.output_shape == (None, 3, 256, 64) 我相信一定有其他人得到了同样的错误结果,有人解决了这个问题吗?

link you give说:

dim_ordering: 'th' or 'tf'. In 'th' mode, the channels dimension (the depth) is at index 1, in 'tf' mode is it at index 3. It defaults to the image_dim_ordering value found in your Keras config file at ~/.keras/keras.json. If you never set it, then it will be "tf".

所以你的 input_shape 就像 theano 的一样,你的输出看起来像你的后端是 tensorflow。如果您想像这样使用它,请将您的 convolution2D 层更改为:

model.add(Convolution2D(64, 3, 3, border_mode='same', input_shape=(3, 256, 256), dim_ordering='th'))

或更改图像,使输入形状为 (256,256,3)

你的问题表述不是很清楚,你没有提供太多信息,顺便说一句,显示非常激进。