Mask_RCNN icon indicating copy to clipboard operation
Mask_RCNN copied to clipboard

model = MaskRCNN(mode='training', model_dir=DEFAULT_LOGS_DIR, config=config)

Open sai12092003 opened this issue 1 year ago • 1 comments

anyone who cleared this error


TypeError Traceback (most recent call last)

201 # define the model

--> 202 model = MaskRCNN(mode='training', model_dir=DEFAULT_LOGS_DIR, config=config) 203 # load weights (mscoco) and exclude the output layers 204 model.load_weights(COCO_WEIGHTS_PATH, by_name=True, exclude=["mrcnn_class_logits", "mrcnn_bbox_fc", "mrcnn_bbox", "mrcnn_mask"])

3 frames /usr/local/lib/python3.10/dist-packages/mrcnn/model.py in init(self, mode, config, model_dir) 1830 self.model_dir = model_dir 1831 self.set_log_dir() -> 1832 self.keras_model = self.build(mode=mode, config=config) 1833 1834 def build(self, mode, config):

/usr/local/lib/python3.10/dist-packages/mrcnn/model.py in build(self, mode, config) 1868 shape=[None, 4], name="input_gt_boxes", dtype=tf.float32) 1869 # Normalize coordinates -> 1870 gt_boxes = KL.Lambda(lambda x: norm_boxes_graph( 1871 x, K.shape(input_image)[1:3]))(input_gt_boxes) 1872 # 3. GT Masks (zero padded)

/usr/local/lib/python3.10/dist-packages/keras/src/utils/traceback_utils.py in error_handler(*args, **kwargs) 68 # To get the full stack trace, call: 69 # tf.debugging.disable_traceback_filtering() ---> 70 raise e.with_traceback(filtered_tb) from None 71 finally: 72 del filtered_tb

/usr/local/lib/python3.10/dist-packages/tensorflow/python/framework/type_spec.py in type_spec_from_value(value) 1002 3, "Failed to convert %r to tensor: %s" % (type(value).name, e)) 1003 -> 1004 raise TypeError(f"Could not build a TypeSpec for {value} of " 1005 f"unsupported type {type(value)}.") 1006

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

sai12092003 avatar Jan 06 '24 19:01 sai12092003

Hello, I'm having the same problem. Did you solve it? @sai12092003 Thanks:)

userwatch avatar Jun 05 '24 08:06 userwatch