Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/313.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 断言{';theano';,&';tensorflow';}断言错误中的&#u后端_Python_Tensorflow_Theano_Keras - Fatal编程技术网

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。谢谢。我看到了编辑,但我建议接受这个答案,然后打开另一个包含新错误详细信息的问题。是的,当然。我接受了答案,并在此处添加了一个新问题:。谢谢你的支持