-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Fix convert_bounding_box_format when passing strings #8265
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/vision/8265
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New Failure, 2 Unrelated FailuresAs of commit a7a0d52 with merge base 81e2831 (): NEW FAILURE - The following job has failed:
FLAKY - The following job failed but was likely due to flakiness present on trunk:
BROKEN TRUNK - The following job failed but was present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
@@ -3398,6 +3398,23 @@ def test_transform(self, old_format, new_format, format_type): | |||
make_bounding_boxes(format=old_format), | |||
) | |||
|
|||
@pytest.mark.parametrize(("old_format", "new_format"), old_new_formats) | |||
def test_strings(self, old_format, new_format): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opted to add a whole new test instead of re-purposing some of the existing ones, because in order for it to be a proper non-regression test, we need to validate the output values here. In main
, we can pass strings, there's no failure: but the results are wrong, and the current existing tests cannot assert that properly.
@@ -214,6 +214,11 @@ def convert_bounding_box_format( | |||
if not torch.jit.is_scripting(): | |||
_log_api_usage_once(convert_bounding_box_format) | |||
|
|||
if isinstance(old_format, str): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't update the type annotations of convert_bounding_box_format
because it would make torchscript unhappy. If mypy fails, I'll silence it. I think it means that torchscript won't support passing strings as the format, but who cares
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Reviewed By: vmoens Differential Revision: D55062797 fbshipit-source-id: 776e1cd156ad5e4a857e7ea1ecbf0b7933a35f87
Fixes #8258
convert_bounding_box_format()
is supposed to accept strings, but it was silently wrong