Skip to content
This repository was archived by the owner on Oct 31, 2023. It is now read-only.

modify senario where dataset has no mask provided #814

Merged
merged 2 commits into from
May 24, 2019
Merged

modify senario where dataset has no mask provided #814

merged 2 commits into from
May 24, 2019

Conversation

CoinCheung
Copy link
Contributor

Hi,

As reported in this issue, when there is no segmentation field in the json file (which I believe will be quite common in practice, since most people would like to use this codebase in the bbox detection task), there will be a error of index out of range in the boxlist indexing operations. I feel maybe this modification would allow to get rid of this error by not adding the filed of mask to the bboxlist object.

I am not sure whether this modification is in consistent with the designing spirit of this repo. If it is not proper to implement this modification, please let me know and I will delete this pr so that we can discuss another place where I feel maybe a little modification will make it better :)

@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label May 24, 2019
Copy link
Contributor

@fmassa fmassa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, this is indeed currently a limitation with the implementation of the dataset.

I have a comment that I think will make things simpler, can you look into addressing it?

masks = [obj["segmentation"] for obj in anno]
masks = SegmentationMask(masks, img.size, mode='poly')
target.add_field("masks", masks)
masks = [obj["segmentation"] for obj in anno if any(obj["segmentation"])]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe you could just add something similar to what is done for keypoints just below?

if anno and 'segmentation' in anno[0]:
    # rest of the code here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,

Thanks for this suggestion, I have modified the code as the keypoint part. Please add more comments if further modification is required.

Copy link
Contributor

@fmassa fmassa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@fmassa fmassa merged commit 38d08ca into facebookresearch:master May 24, 2019
Lyears pushed a commit to Lyears/maskrcnn-benchmark that referenced this pull request Jun 28, 2020
* modify senario where dataset has no mask provided

* change to check segmentation mask in the way of keypoint
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CLA Signed Do not delete this pull request or issue due to inactivity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants