PixelLib
PixelLib copied to clipboard
fix bug - update 'deeplab.py' #180 #181
With minor tweaks, the semantic segmentation is compatible with recent TensorFlow and Keras. The PixelLib project seems to be on a halt, but for anyone who steps here, I hope this helps.
The errors I faced were... (every job was held in semantic/deeplab.py
)
-
ImportError: cannot import name '...' from 'tensorflow.python.keras.layers'
→ changetensorflow.python.keras.layers
totensorflow.keras.layers
-
ValueError: A KerasTensor cannot be used as input to a TensorFlow function.
(on codeshape_before = tf.shape(x)
)
→ add Keras Layer subclass and use it to return the shape (x
is KerasTensor andshape()
is TensorFlow function) -
AttributeError: 'KerasHistory' object has no attribute 'layer'
→ changetensorflow.python.keras.models
totensorflow.keras.models
Additionally, I'm on Apple Silicon with the versions below.
- Python 3.12.4
- tensorflow==2.17.0
- pixellib==0.7.1