Skip to content

fix {convert_format, clamp}_bounding_box #7229

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

Merged
merged 2 commits into from
Feb 13, 2023

Conversation

pmeier
Copy link
Collaborator

@pmeier pmeier commented Feb 13, 2023

This fixes two things that were missed in #7227 and #7228.

  1. Calling a kernel should always be done by a plain tensor. Thus, we unwrap datapoints. Otherwise we are in hot water, because internally we assume that this is the case:

    xyxy_boxes = convert_format_bounding_box(
    bounding_box.clone(), old_format=format, new_format=datapoints.BoundingBoxFormat.XYXY, inplace=True
    )

    Note that the call to convert_format_bounding_box will fail if bounding_box is a datapoint.BoundingBox here, since we unconditionally pass the old_format.

  2. After convert_format_bounding_box the format has to be updated and cannot be taken from the input by design

cc @vfdev-5 @bjuncek

Copy link
Member

@NicolasHug NicolasHug left a comment

Choose a reason for hiding this comment

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

Thanks Philip,

Just tried this on test_detection_preset() while putting back RandomIoUCrop(), and it looks like it worked properly. Let's merge!

@NicolasHug NicolasHug merged commit acabaf8 into pytorch:main Feb 13, 2023
@pmeier pmeier deleted the fix-clamp-convert-box branch February 13, 2023 14:35
facebook-github-bot pushed a commit that referenced this pull request Mar 28, 2023
Reviewed By: vmoens

Differential Revision: D44416268

fbshipit-source-id: 664c723e512d08c8bb2e32e8efefbabbe65b0122
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants