Mask_RCNN icon indicating copy to clipboard operation
Mask_RCNN copied to clipboard

TypeError: Could not build a TypeSpec for KerasTensor(type_spec=TensorSpec(shape=(None, None, 4), dtype=tf.float32, name=None), name='tf.math.truediv/truediv:0', description="created by layer 'tf.math.truediv'") of unsupported type <class 'keras.engine.keras_tensor.KerasTensor'>.

Open Tomta10 opened this issue 3 years ago • 2 comments

2022-01-21 14:27:24.934343: I tensorflow/core/platform/cpu_feature_guard.cc:151] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX AVX2 To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. 2022-01-21 14:27:26.240526: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1525] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 2776 MB memory: -> device: 0, name: NVIDIA GeForce GTX 1050 Ti, pci bus id: 0000:01:00.0, compute capability: 6.1 Traceback (most recent call last): File "", line 3, in File "C:\Program Files\JetBrains\PyCharm 2019.3.3\plugins\python\helpers\pydev_pydev_bundle\pydev_umd.py", line 197, in runfile pydev_imports.execfile(filename, global_vars, local_vars) # execute the script File "C:\Program Files\JetBrains\PyCharm 2019.3.3\plugins\python\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "D:/data/PycharmProjects/Mask RCNN/Mask_RCNN-2.1/samples/balloon/balloon.py", line 334, in model = modellib.MaskRCNN(mode="training", config=config, File "D:\Mask_RCNN-master\Mask_RCNN-2.1\model.py", line 1768, in init self.keras_model = self.build(mode=mode, config=config) File "D:\Mask_RCNN-master\Mask_RCNN-2.1\model.py", line 1807, in build gt_boxes = KL.Lambda(lambda x: x / image_scale)(input_gt_boxes) File "C:\ProgramData\Anaconda3\envs\tensorflow\lib\site-packages\keras\utils\traceback_utils.py", line 67, in error_handler raise e.with_traceback(filtered_tb) from None File "C:\ProgramData\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\framework\type_spec.py", line 867, in type_spec_from_value raise TypeError(f"Could not build a TypeSpec for {value} of "

TypeError: Could not build a TypeSpec for KerasTensor(type_spec=TensorSpec(shape=(None, None, 4), dtype=tf.float32, name=None), name='tf.math.truediv/truediv:0', description="created by layer 'tf.math.truediv'") of unsupported type <class 'keras.engine.keras_tensor.KerasTensor'>.

I have a stubborn problem with this type error handling for a long time, please help me, thanks a lot.

Tomta10 avatar Jan 21 '22 06:01 Tomta10

i meet the same error,do you relsove it?

kungkook avatar Apr 12 '22 02:04 kungkook

I solved it by using this model, which should resolve these TF2 compatibility issues.

claudiotancredi avatar May 21 '22 07:05 claudiotancredi

I solved it by using this model, which should resolve these TF2 compatibility issues.

how did you solve that problem

KV619fF5 avatar Jun 23 '23 07:06 KV619fF5