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

Support empty predictions when visualizing results #1166

Closed
wants to merge 4 commits into from
Closed

Support empty predictions when visualizing results #1166

wants to merge 4 commits into from

Conversation

yeliudev
Copy link

@yeliudev yeliudev commented Apr 7, 2020

This PR fixes a potential error when no predictions found in tools/visualize_json_results.py.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 7, 2020
@ppwwyyxx
Copy link
Contributor

ppwwyyxx commented Apr 7, 2020

What is the error without this PR?

@yeliudev
Copy link
Author

yeliudev commented Apr 7, 2020

The BoxMode.convert method would raise an IndexError when the shape of bbox becomes (0,), which may be caused by empty prediction or all the confidences are below conf_threshold.

Besides, maybe checking the shape of chosen instead of score is more reasonable, I'll create one more commit to fix that.

Sorry but I can not reproduce the bug because I've deleted the json file by mistake.

@ppwwyyxx
Copy link
Contributor

ppwwyyxx commented Apr 7, 2020

Does it work if you add bbox = bbox.reshape(-1, 4) to make it a ndarray of shape (0, 4) ?
It's reasonable to expect BoxMode.convert to produce a (0, 4) array when the input shape is (0, 4). If that's not working we can get it fixed.

@yeliudev
Copy link
Author

yeliudev commented Apr 7, 2020

Yes it works after reshaping bbox. I've tested it by using another json file and setting conf_threshold to 2.0. Thanks for your suggestion.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@ppwwyyxx has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@ppwwyyxx merged this pull request in b8f4eeb.

nanddalal pushed a commit to SironaMedical/nines-detectron2 that referenced this pull request Jun 5, 2020
Summary:
This PR fixes a potential error when no predictions found in `tools/visualize_json_results.py`.
Pull Request resolved: facebookresearch#1166

Reviewed By: rbgirshick

Differential Revision: D20888849

Pulled By: ppwwyyxx

fbshipit-source-id: a53d67a7f3ee63070defedb6ca3812d0ae5d6cc9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants