I am following the Coursera, Deep Learning course with Andrew Ng for object detection with YOLO algorithm, I am trying to run the algorithm on my PC using Windows and Anaconda Navigator, I installed Keras to run on TensorFlow backend. But when I typed the following:
import tensorflow as tf
from keras import backend as K
It showed me the following:
Using TensorFlow backend.
Traceback (most recent call last):
File "<ipython-input-8-0bcaeab92875>", line 2, in <module>
from keras import backend as K
File "C:\Users\AbanoubMamdouh\Anaconda3\lib\site-packages\keras\__init__.py", line 3, in <module>
from . import utils
File "C:\Users\AbanoubMamdouh\Anaconda3\lib\site-packages\keras\utils\__init__.py", line 6, in <module>
from . import conv_utils
File "C:\Users\AbanoubMamdouh\Anaconda3\lib\site-packages\keras\utils\conv_utils.py", line 9, in <module>
from .. import backend as K
File "C:\Users\AbanoubMamdouh\Anaconda3\lib\site-packages\keras\backend\__init__.py", line 89, in <module>
from .tensorflow_backend import *
File "C:\Users\AbanoubMamdouh\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py", line 24, in <module>
from ..utils.generic_utils import transpose_shape
ImportError: cannot import name 'transpose_shape'
Seems like it has a problem with this line in the tensorflow_backend.py file:
from ..utils.generic_utils import transpose_shape
Help would be much appreciated! Cheers
Try to uninstall tensorflow and keras and install keras using pip, it also installs tensorflow. It worked for me!!!
Probably a misconfiguration of the installed packages:
pip uninstall -y tensorflow keras tf-nightly keras-nightly
and then:
pip install tensorflow
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With