Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

ImportError: cannot import name 'get_config' in keras_squeezenet

I’m trying to import keras_squeezenet into my project, but I’m getting this error:

Traceback (most recent call last):
  File "C:/Users/belog/drone_sees/train_model.py", line 3, in <module>
    from keras_squeezenet import SqueezeNet
  File "C:\Users\belog\AppData\Local\Programs\Python\Python36\lib\site-packages\keras_squeezenet\__init__.py", line 1, in <module>
    from keras_squeezenet.squeezenet import SqueezeNet
  File "C:\Users\belog\AppData\Local\Programs\Python\Python36\lib\site-packages\keras_squeezenet\squeezenet.py", line 2, in <module>
    from keras import backend as K
  File "C:\Users\belog\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\__init__.py", line 25, in <module>
    from keras import models
  File "C:\Users\belog\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\models.py", line 19, in <module>
    from keras import backend
  File "C:\Users\belog\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\backend.py", line 36, in <module>
    from tensorflow.python.eager.context import get_config
ImportError: cannot import name 'get_config'

Here is the import code:

import cv2
import numpy as np
from keras_squeezenet import SqueezeNet
from keras.optimizers import Adam
from keras.utils import np_utils
from keras.layers import Activation, Dropout, Convolution2D, GlobalAveragePooling2D
from keras.models import Sequential
import tensorflow as tf

How to fix this error? (I’m using keras-squeezenet==0.4).

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

try upgrading tensorflow:

pip install --upgrade tensorflow
pip install --upgrade tensorflow-gpu
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading