Python 断言{';theano';,&';tensorflow';}断言错误中的u后端
我正在尝试运行,但出现以下错误:Python 断言{';theano';,&';tensorflow';}断言错误中的u后端,python,tensorflow,theano,keras,Python,Tensorflow,Theano,Keras,我正在尝试运行,但出现以下错误: Traceback (most recent call last): File "classifier_from_little_data_script_3.py", line 39, in <module> from keras import applications File "C:\Python35\lib\site-packages\keras\__init__.py", line 3, in <module>
Traceback (most recent call last):
File "classifier_from_little_data_script_3.py", line 39, in <module>
from keras import applications
File "C:\Python35\lib\site-packages\keras\__init__.py", line 3, in <module>
from . import activations
File "C:\Python35\lib\site-packages\keras\activations.py", line 3, in <module>
from . import backend as K
File "C:\Python35\lib\site-packages\keras\backend\__init__.py", line 36, in <module>
assert _backend in {'theano', 'tensorflow'}
AssertionError
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.
编辑2
我已将后端更改为tensorflow
,但出现以下错误:
Traceback (most recent call last):
File "classifier_from_little_data_script_3.py", line 39, in <module>
from keras import applications
File "C:\Python35\lib\site-packages\keras\__init__.py", line 3, in <module>
from . import activations
File "C:\Python35\lib\site-packages\keras\activations.py", line 3, in <module>
from . import backend as K
File "C:\Python35\lib\site-packages\keras\backend\__init__.py", line 36, in <module>
assert _backend in {'theano', 'tensorflow'}
AssertionError
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"
}
请注意
“后端”:“tensorflow”
与您的“后端”:“tf”
您能打印出您的keras.json
文件吗?@MarcinMożejko感谢您的回复。当然,请参见问题中的编辑1,因此您应该将tf
更改为tensorflow
。@MarcinMożejko请参见我问题中的编辑2,了解将后端更改为“tensorflow”时出现的错误。谢谢。谢谢你友好的回复。当我将后端更改为“tensorflow”时,请参见问题中的编辑2。谢谢。我看到了编辑,但我建议接受这个答案,然后打开另一个包含新错误详细信息的问题。是的,当然。我接受了答案,并在此处添加了一个新问题:。谢谢你的支持