Skip to content

Area calculation in TorchVision Object Detection Finetuning Tutorial #2173

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

Closed
Himanshunitrr opened this issue Jan 18, 2023 · 1 comment
Closed
Labels
module: vision Torchvision issues

Comments

@Himanshunitrr
Copy link

Himanshunitrr commented Jan 18, 2023

I see that at https://pytorch.org/tutorials/intermediate/torchvision_tutorial.html,

area = (boxes[:, 3] - boxes[:, 1]) * (boxes[:, 2] - boxes[:, 0]) but shouldn't it be something like area = ((boxes[:, 3] - boxes[:, 1]) + 1) * ((boxes[:, 2] - boxes[:, 0]) + 1) for calculating areas? If I am wrong, can someone explain me why is it so. Thanks in advance !

cc @datumbox @nairbv

Himanshunitrr added a commit to Himanshunitrr/tutorials that referenced this issue Jan 18, 2023
@svekars svekars added the module: vision Torchvision issues label Jan 18, 2023
@NicolasHug
Copy link
Member

Thanks for the report @Himanshunitrr

In torchvision, we compute the area without the +1 offset:

https://github.com/pytorch/vision/blob/5dd95944c609ac399743fa843ddb7b83780512b3/torchvision/ops/boxes.py#L219-L235

You can find more context in this thread: pytorch/vision#826 (comment)

I don't think we'll change the computation to add the +1 now, so I think we can close this issue (and the PR)

CC @svekars I don't have the permission to close :)

@svekars svekars closed this as completed Feb 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: vision Torchvision issues
Projects
None yet
Development

No branches or pull requests

3 participants