Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 属性错误:';非类型';对象没有属性';图像数据格式&x27;在keras resnet50中_Python 3.x_Tensorflow_Keras - Fatal编程技术网

Python 3.x 属性错误:';非类型';对象没有属性';图像数据格式&x27;在keras resnet50中

Python 3.x 属性错误:';非类型';对象没有属性';图像数据格式&x27;在keras resnet50中,python-3.x,tensorflow,keras,Python 3.x,Tensorflow,Keras,我正在尝试使用Resnet50模型进行培训 from keras import backend as K from keras_applications.resnet50 import ResNet50 from keras.layers import Input from keras.callbacks import ModelCheckpoint K.set_image_data_format('channels_last') K.set_image_dim_ordering('tf')

我正在尝试使用Resnet50模型进行培训

from keras import backend as K
from keras_applications.resnet50 import ResNet50
from keras.layers import Input
from keras.callbacks import ModelCheckpoint

K.set_image_data_format('channels_last')
K.set_image_dim_ordering('tf')

input_layer = Input(shape=(224, 224, 3))
model = ResNet50(include_top=True, weights=None, classes=2)
model.compile(optimizer='rmsprop', loss='binary_crossentropy', metrics=['accuracy'])
为什么会出现以下错误

Using TensorFlow backend.
Traceback (most recent call last):
File "model.py", line 42, in <module>
model = ResNet50(include_top=True, weights=None, input_tensor=input_layer, classes=2)
File "/home/mario/.local/lib/python3.6/site-packages/keras_applications/resnet50.py", line 209, in ResNet50
data_format=backend.image_data_format(),
AttributeError: 'NoneType' object has no attribute 'image_data_format'
使用TensorFlow后端。
回溯(最近一次呼叫最后一次):
文件“model.py”,第42行,在
模型=ResNet50(包括顶部=真,权重=无,输入张量=输入层,类别=2)
resnet50中的文件“/home/mario/.local/lib/python3.6/site packages/keras_applications/resnet50.py”,第209行
data\u format=后端.image\u data\u format(),
AttributeError:“非类型”对象没有“图像数据格式”属性

我遇到了类似的问题。它的工作原理是将
keras\u应用程序
更改为
keras.applications


他们在GitHub上有一个问题,但仍然没有解决:

我遇到了一个类似的问题。它的工作原理是将
keras\u应用程序
更改为
keras.applications


他们在GitHub上有一个问题,但仍然没有解决:

我也遇到了这个问题

请试试这个。它工作得很好:

from keras.applications.resnet50 import ResNet50

我也谈到了这个问题

请试试这个。它工作得很好:

from keras.applications.resnet50 import ResNet50

更新你的tensorflow和Keras!我有最新版本更新你的tensorflow和Keras!它很好用。我有最新的版本