ayoolaolafenwa / PixelLib

Visit PixelLib's official documentation https://pixellib.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ImportError: cannot import name 'semantic_segmentation' from 'pixellib.semantic'

KeryMg opened this issue · comments

ImportError: cannot import name 'semantic_segmentation' from 'pixellib.semantic'

Hi, can you please provide more description. I will try and solve your issue.

commented

Hi, can you please provide more description. I will try and solve your issue.

I can provide.

the code:

import pixellib
from pixellib.semantic import semantic_segmentation 

the error:

C:\Anaconda3\lib\site-packages\pixellib\semantic\deeplab.py in <module>
     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:\Anaconda3\lib\site-packages\tensorflow\python\keras\layers\__init__.py)

Same issue.

Go to Pixellib folder -> semantic -> deeplab.py and replace this line from tensorflow.python.keras.layers import BatchNormalization with this one from keras.layers.normalization.batch_normalization import BatchNormalization

How can I access this Pixellib folder? I am having the same issue as described above but am afraid I do not know where and how to access the said folder

I got it. Never mind

How did you access the Pixellib folder? @GraceMinai