Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: Exception encountered when calling layer "mrcnn_bbox" (type Reshape). #3047

Open
liaokaiyao opened this issue Aug 3, 2024 · 1 comment

Comments

@liaokaiyao
Copy link

Error creating MaskRCNN model: Exception encountered when calling layer "mrcnn_bbox" (type Reshape).

Tried to convert 'shape' to a tensor and failed. Error: None values not supported.

Call arguments received by layer "mrcnn_bbox" (type Reshape):
• inputs=tf.Tensor(shape=(1, None, 324), dtype=float32)
Traceback (most recent call last):
File "test.py", line 67, in
model = modellib.MaskRCNN(mode="inference", model_dir=MODEL_DIR, config=config)
File "/home/chenx2/liao/mrcnn/mrcnn/model.py", line 1839, in init
self.keras_model = self.build(mode=mode, config=config)
File "/home/chenx2/liao/mrcnn/mrcnn/model.py", line 2037, in build
fpn_classifier_graph(rpn_rois, mrcnn_feature_maps, input_image_meta,
File "/home/chenx2/liao/mrcnn/mrcnn/model.py", line 953, in fpn_classifier_graph
mrcnn_bbox = KL.Reshape((s[1], num_classes, 4), name="mrcnn_bbox")(x)
File "/home/chenx2/miniconda3/envs/igibson1/lib/python3.8/site-packages/keras/src/utils/traceback_utils.py", line 70, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/home/chenx2/miniconda3/envs/igibson1/lib/python3.8/site-packages/tensorflow/python/framework/op_def_library.py", line 571, in _ExtractInputsAndAttrs
raise ValueError(
ValueError: Exception encountered when calling layer "mrcnn_bbox" (type Reshape).

Tried to convert 'shape' to a tensor and failed. Error: None values not supported.

Call arguments received by layer "mrcnn_bbox" (type Reshape):
• inputs=tf.Tensor(shape=(1, None, 324), dtype=float32)

@518789Adf
Copy link

s = K.int_shape(x)
if s[1]==None:
mrcnn_bbox = KL.Reshape((-1, num_classes, 4), name="mrcnn_bbox")(x)
else:
mrcnn_bbox = KL.Reshape((s[1], num_classes, 4), name="mrcnn_bbox")(x)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants