我正在尝试运行此代码,但收到以下错误:
Traceback (most recent call last):
File "classifier_from_little_data_script_3.py", line 39, in <module>
from keras import applications
File "C:Python35libsite-packageskeras__init__.py", line 3, in <module>
from . import activations
File "C:Python35libsite-packageskerasactivations.py", line 3, in <module>
from . import backend as K
File "C:Python35libsite-packageskerasbackend__init__.py", line 36, in <module>
assert _backend in {'theano', 'tensorflow'}
AssertionError
我试图寻找此错误的原因,但找不到解决方案。如何解决此问题?
编辑 1
这是keras.json
文件:
{
"image_dim_ordering": "tf",
"epsilon": 1e-07,
"floatx": "float32",
"backend": "tf"
}
编辑 2
我已将后端更改为tensorflow
,但出现以下错误:
ValueError: The shape of the input to "Flatten" is not fully defined (got (None, None, 512). Make sure to pass a complete "input_shape" or "batch_input_shape" argument to the first layer in your model.
我在这里为第二次编辑添加了一个单独的问题。
谢谢。
你的keras.json应该看起来像这样
{
"image_data_format": "channels_last",
"epsilon": 1e-07,
"floatx": "float32",
"backend": "tensorflow"
}
请注意"backend" : "tensorflow"
与现有"backend" : "tf"
的差异