keras "image_dim_ordering" 配置不工作

keras "image_dim_ordering" configuration not working

我一直在尝试将keras图像暗淡顺序从tensorflow顺序更改为theano顺序。我修改了 ~/.keras/keras.json 文件,"image_dim_ordering": "th" 行不起作用,但是 "backend": "theano" 行配置有效。

{
"floatx": "float32",
"epsilon": 1e-07,
"backend": "theano",
"image_dim_ordering": "th"  
}

当我在程序开头添加backend.image_dim_ordering('th')时,权重加载出现了新问题。我确定权重使用的是 theano 后端,并且是 "th" 顺序。

ValueError: Layer weight shape (3,3,3,64) not compatible with provided weight shape(64,3,3,3)

程序开头没有 backend.image_dim_ordering('th') 的原始错误:

Exception: Layer weight shape (3, 3, 640, 64) not compatible with provided weight shape (64, 3, 3, 3)

我用的是python 2.7.12,win7和Ubuntu 16.04系统都有这个问题

使用 set_image_dim_ordering 而不是 image_dim_ordering。后者只获取数据排序格式,不设置:

import keras.backend as K
K.set_image_dim_ordering('th')