Assert _backend in {'theano', 'tensorflow'} AssertionError

I am 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 to find the cause of this error but could not find a solution. How can I fix this problem?

EDIT 1

This is the file keras.json

:

{
    "image_dim_ordering": "tf",
    "epsilon": 1e-07,
    "floatx": "float32",
    "backend": "tf"
}

      

EDIT 2

I changed backend to tensorflow

, but I get the following error:

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've added a separate question for a second edit here .

Thank.

+3


source to share


1 answer


your keras.json should look like this

{
    "image_data_format": "channels_last",
    "epsilon": 1e-07,
    "floatx": "float32",
    "backend": "tensorflow" 
}

      



Notice the difference "backend" : "tensorflow"

compared to what you have"backend" : "tf"

+1


source







All Articles