dim_ordering: One of {“th”, “tf”}. “tf” mode means that the images should have shape (samples, height, width, channels), “th” mode means that the images should have shape (samples, channels, height, width). 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”.
即
dim_ordering=‘th’ 对应的输入是 [samples][channels][rows][cols];
dim_ordering=“tf” 对应的输入是 [samples][rows][cols][channels]。
不同版本的Keras使用不同的命令:
from keras import backend as K
低版本K.image_data_format() == 'channels_first'
高版本K.image_dim_ordering() == 'th'