Skip to content

Add JIT tests for box_area, box_iou, genaralized_box_iou #4472

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
Sep 29, 2021

Conversation

oke-aditya
Copy link
Contributor

@oke-aditya oke-aditya commented Sep 23, 2021

They are JIT scriptable and compatible, but it would be nice to test it I think.

cc @pmeier @NicolasHug @datumbox

@@ -999,6 +1015,14 @@ def gen_iou_check(box, expected, tolerance=1e-4):
expected = torch.tensor([[1.0, 0.9933, 0.9673], [0.9933, 1.0, 0.9737], [0.9673, 0.9737, 1.0]])
gen_iou_check(box_tensor, expected, tolerance=0.002 if dtype == torch.float16 else 1e-3)

def test_giou_jit(self):
box_tensor = torch.tensor([[0, 0, 100, 100], [0, 0, 50, 50], [200, 200, 300, 300]], dtype=torch.float)
Copy link
Contributor Author

@oke-aditya oke-aditya Sep 23, 2021

Choose a reason for hiding this comment

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

I remember adding the IoU tests, and calculating by hand an year ago. Great that they are still used! 😄
#2642

@oke-aditya
Copy link
Contributor Author

oke-aditya commented Sep 28, 2021

Hi @datumbox! Is this worth checking and adding (extra testing doesn't hurt in my opinion) ?
But let me know, I am happy to close otherwise 😃

Copy link
Contributor

@datumbox datumbox 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 for adding them.

Perhaps on a future PR we can rethink how we split the tests. If we didn't add them on separate classes, we could easier share code and use parametrize to pass the operator.

Copy link
Member

@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!

As @datumbox mentioned, we can probably refactor those tests to avoid some code duplication.

I've created an issue to track this down #4500

@fmassa fmassa merged commit b5d81f0 into pytorch:main Sep 29, 2021
@oke-aditya oke-aditya deleted the expt branch September 29, 2021 12:38
facebook-github-bot pushed a commit that referenced this pull request Sep 30, 2021
Summary: Co-authored-by: Francisco Massa <[email protected]>

Reviewed By: datumbox

Differential Revision: D31268017

fbshipit-source-id: 530047152deae83ef61b1a8ba26cf37039cf7c9d
cyyever pushed a commit to cyyever/vision that referenced this pull request Nov 16, 2021
Co-authored-by: Francisco Massa <[email protected]>
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.

5 participants