简体   繁体   English

无法从“keras.backend”导入名称“theano_backend”

[英]cannot import name 'theano_backend' from 'keras.backend'

I am trying to run the following:我正在尝试运行以下内容:

from keras.backend import theano_backend

But I get this error:但我得到这个错误:

Traceback (most recent call last):

  File "<ipython-input-64-39e623866e51>", line 1, in <module>
    from keras.backend import theano_backend

ImportError: cannot import name 'theano_backend' from 'keras.backend' (C:\Users\Dr. Sunil Singla\anaconda3\lib\site-packages\keras\backend.py)

I cloned this repo: https://github.com/titu1994/DenseNet.git and attempted to run it on my image data.我克隆了这个 repo: https://github.com/titu1994/DenseNet.git并尝试在我的图像数据上运行它。

The latest Keras versions are just a wrapper on top of tf.keras, they are not the multi-backend keras you are expecting.最新的 Keras 版本只是 tf.keras 之上的包装,它们不是您期望的多后端 keras。

For this code to work, you should downgrade Keras to a version that is still multi-backend, like 2.2.x versions.要使此代码正常工作,您应该将 Keras 降级到仍然是多后端的版本,例如 2.2.x 版本。 I think 2.3.x still have multiple backends too, but versions 2.4 are TensorFlow only.我认为 2.3.x 仍然有多个后端,但 2.4 版本只有 TensorFlow。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM