m_m*_*gaj 1 python-3.x keras tensorflow
我正在尝试使用 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'])
Run Code Online (Sandbox Code Playgroud)
为什么会出现以下错误?
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'
Run Code Online (Sandbox Code Playgroud)
小智 5
我也遇到了这个问题。
请尝试这个。它运作得很好:
from keras.applications.resnet50 import ResNet50
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6893 次 |
| 最近记录: |