[英]assert _backend in {'theano', 'tensorflow'} AssertionError
I'm trying to run this code , but getting the following error: 我正在尝试运行此代码 ,但收到以下错误:
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
I tried looking for a reason for this error, but couldn't find a solution. 我试图找出这个错误的原因,但找不到解决方案。 How can I fix this issue? 我该如何解决这个问题?
EDIT 1 编辑1
This is the keras.json
file: 这是keras.json
文件:
{
"image_dim_ordering": "tf",
"epsilon": 1e-07,
"floatx": "float32",
"backend": "tf"
}
EDIT 2 编辑2
I have changed the backend to tensorflow
, but get the following error: 我已将后端更改为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.
I have added a separate question for the second edit, here . 我在这里为第二次编辑添加了一个单独的问题。
Thanks. 谢谢。
your keras.json should look like this 你的keras.json应该是这样的
{
"image_data_format": "channels_last",
"epsilon": 1e-07,
"floatx": "float32",
"backend": "tensorflow"
}
Notice the difference "backend" : "tensorflow"
versus what you have "backend" : "tf"
注意区别"backend" : "tensorflow"
与你的"backend" : "tf"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.