PixelLib icon indicating copy to clipboard operation
PixelLib copied to clipboard

fix bug - update 'deeplab.py' #180 #181

Open samscientist opened this issue 5 months ago • 0 comments

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'
    → change tensorflow.python.keras.layers to tensorflow.keras.layers
  • ValueError: A KerasTensor cannot be used as input to a TensorFlow function.
    (on code shape_before = tf.shape(x))
    → add Keras Layer subclass and use it to return the shape (x is KerasTensor and shape() is TensorFlow function)
  • AttributeError: 'KerasHistory' object has no attribute 'layer'
    → change tensorflow.python.keras.models to tensorflow.keras.models

Additionally, I'm on Apple Silicon with the versions below.

  • Python 3.12.4
  • tensorflow==2.17.0
  • pixellib==0.7.1

samscientist avatar Sep 10 '24 15:09 samscientist