matterport / Mask_RCNN

Mask R-CNN for object detection and instance segmentation on Keras and TensorFlow
Other
24.64k stars 11.7k forks source link

modellib.load_image_gt image mask shape mismatch #2817

Closed Ayshine closed 2 years ago

Ayshine commented 2 years ago

I am trying to run the cells in inspect_baloon_data.ipynb for the Mini Masks cells for the following code I noticed that my masks and images does not match after using load_image_gt function. I guess this may be the reason I get ValueError: operands could not be broadcast together with shapes (56,56) (1024,1024) (1024,1024) error when I ran visualize.display_instances(image, bbox, mask, class_ids, dataset.class_names) line. My question is how should I resolve this?

Screen Shot 2022-04-27 at 17 00 27

`

Malte-Weber commented 2 years ago

same issue, not sure if it pertains to this https://github.com/matterport/Mask_RCNN/issues/636 ?

Ayshine commented 2 years ago

I tried the add the lines as suggested on the issue you passed. It didn't work. I am trying baloon tutorial from the reference article on README on the repo. Should it just work fine?

Malte-Weber commented 2 years ago

Same here, I am working on getting this all fixed in the hopes to understand how to adapt the Mask RCNN. The broadcasting issue seems to be within the matrix multiplication. https://www.statology.org/operands-could-not-be-broadcast-together-with-shapes/ I will implement it and let you know if that resolves the issue. Besides, see #578 even, so it did not help me.

Have you come across the #2112? That is another one that stomps me right now.

Ayshine commented 2 years ago

I haven't seen that error. I hope you resolve them both. I would like to learn if you have any suggestions for this issue

Ayshine commented 2 years ago

Ok now I have the second issue you are facing too.

Malte-Weber commented 2 years ago

I found https://github.com/ahmedfgad/Mask-RCNN-TF2 which is seemingly more up to date. Working on something else, atm. Please reach out to me if you gain some insight into the matter.

Ayshine commented 2 years ago

Thanks for passing the link. Let me try that version and inform you if it works.

MGudik commented 2 years ago

I think its a leftover from a change. Before you could specify use_minimask=False.

Mini masks are used during training to minimize the load. A workaround is to specify the config

config.USE_MINI_MASK = False
original_image, image_meta, gt_class_id, gt_bbox, gt_mask = load_image_gt(
            self.dataset_val, config, image_id)
Ayshine commented 2 years ago

@Weber-AILand I tried the repo you suggested. I was able to run training and predictions of the kangaroo example they gave. I'll keep working on that. Thanks!