ayoolaolafenwa / PixelLib

Visit PixelLib's official documentation https://pixellib.readthedocs.io/en/latest/
MIT License
1.05k stars 265 forks source link

from pixellib.tune_bg import alter_bg errror #139

Open gk765 opened 2 years ago

gk765 commented 2 years ago

I am getting below error after executing the above command

import pixellib from pixellib.tune_bg import alter_bg

ImportError Traceback (most recent call last) C:\Users\GIRISH~1\AppData\Local\Temp/ipykernel_14768/2708208855.py in 1 import pixellib ----> 2 from pixellib.tune_bg import alter_bg

~\anaconda3\lib\site-packages\pixellib\tune_bg__init__.py in 2 import numpy as np 3 from PIL import Image ----> 4 from pixellib.semantic.deeplab import Deeplab_xcep_pascal 5 from pixellib.semantic import obtain_segmentation 6 import cv2

~\anaconda3\lib\site-packages\pixellib\semantic__init__.py in 2 import numpy as np 3 from PIL import Image ----> 4 from .deeplab import Deeplab_xcep_pascal 5 from .deeplab import Deeplab_xcep_ade20k 6 import cv2

~\anaconda3\lib\site-packages\pixellib\semantic\deeplab.py in 13 from tensorflow.python.keras.layers import Add 14 from tensorflow.python.keras.layers import Dropout ---> 15 from tensorflow.python.keras.layers import BatchNormalization 16 from tensorflow.python.keras.layers import Conv2D 17 from tensorflow.python.keras.layers import DepthwiseConv2D

ImportError: cannot import name 'BatchNormalization' from 'tensorflow.python.keras.layers' (C:\Users\GIRISH MAURYA\anaconda3\lib\site-packages\tensorflow\python\keras\layers__init__.py)

onyekaokonji commented 2 years ago

Hi!

Had the same challenge but solved by installing an older version of Tensorflow, specifically 2.5.0.