PixelLib icon indicating copy to clipboard operation
PixelLib copied to clipboard

not useful

Open LT1st opened this issue 1 year ago • 0 comments

To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags. Traceback (most recent call last): File "D:\0code\IR_dataset\align\gen_seg_deeplab3.py", line 7, in segment_image = semantic_segmentation() ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\lutao.conda\envs\seg\Lib\site-packages\pixellib\semantic_init_.py", line 26, in init self.model = Deeplab_xcep_pascal() ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\lutao.conda\envs\seg\Lib\site-packages\pixellib\semantic\deeplab.py", line 205, in Deeplab_xcep_pascal shape_before = tf.shape(x) ^^^^^^^^^^^ File "C:\Users\lutao.conda\envs\seg\Lib\site-packages\tensorflow\python\util\traceback_utils.py", line 153, in error_handler raise e.with_traceback(filtered_tb) from None File "C:\Users\lutao.conda\envs\seg\Lib\site-packages\keras\src\backend\common\keras_tensor.py", line 92, in tf_tensor raise ValueError( ValueError: A KerasTensor cannot be used as input to a TensorFlow function. A KerasTensor is a symbolic placeholder for a shape and dtype, used when constructing Keras Functional models or Keras Functions. You can only use it as input to a Keras layer or a Keras operation (from the namespaces keras.layers and keras.operations). You are likely doing something like:

x = Input(...)
...
tf_fn(x)  # Invalid.

What you should do instead is wrap tf_fn in a layer:

class MyLayer(Layer):
    def call(self, x):
        return tf_fn(x)

x = MyLayer()(x)

LT1st avatar Feb 25 '24 13:02 LT1st