AttributeError:模块“keras.backend”没有属性“common”

Sai*_*Sai 7 python keras tensorflow keras-2 tensorflow2.0

我尝试执行一些项目。但我有一个attribute error. 我检查了我的 Tensorflow 和 Keras 版本。

Name: tensorflow
Version: 2.3.1
Name: Keras
Version: 2.4.3
Summary: Deep Learning for humans
python 3.8.2 
Run Code Online (Sandbox Code Playgroud)

代码在这里。

self.dim_ordering = K.common.image_dim_ordering()
Run Code Online (Sandbox Code Playgroud)

错误信息:

self.dim_ordering = K.common.image_dim_ordering()
AttributeError: module 'keras.backend' has no attribute 'common'
Run Code Online (Sandbox Code Playgroud)

可以用 K.image_data_format()代替 吗k.common.image_dim_ordering()

Vid*_*esh 9

是的。使用就可以了k.image_data_format()

在 Keras v2 中,该方法已重命名为 image_data_format