Merged
Conversation
NicolasHug
approved these changes
Jul 11, 2023
Member
NicolasHug
left a comment
There was a problem hiding this comment.
Thanks Philip, LGTM if green. Admittedly I didn't review every single line but the summary makes sense to me.
We still have a bunch of occurrences of "spatial_size" in the tests (e.g. in the utils). I assume these will be gone once we finish porting the V2 tests to their new version?
facebook-github-bot
pushed a commit
that referenced
this pull request
Aug 25, 2023
Reviewed By: matteobettini Differential Revision: D48642265 fbshipit-source-id: 123d2a3157d4536ea9ac25e0192d54307b31ea1e
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The term "spatial size" was introduced together with v2 and is somewhat ambiguous. Its meaning is
.shape[-2:], i.e. height and width, for images, videos and masks.shape[-2:], i.e. height and width, of the corresponding image, video, or mask for bounding boxesTL;DR: This PR removes it.
Rename the
BoundingBox.spatial_sizeattribute as well as all of thespatial_sizeparameters in our bounding box kernels, e.g.vision/torchvision/transforms/v2/functional/_geometry.py
Lines 54 to 56 in 08c9938
to
canvas_size. That term is not perfect as well, but I feel it easier to interpret thanspatial_size. Another candidate isreference_size. LMK if you prefer that.Rename
F.get_spatial_sizeandquery_spatial_sizetoF.get_sizeandquery_size. There is a semantic slip in that name in the sense that it still returns thecanvas_sizefor bounding boxes. However, this is the same as before, whereF.get_spatial_sizereturned the size for images, masks, and videos.Remove the
.spatial_size,.num_channels, and.num_framesproperties from the image, mask, and video datapoint classes. They were exclusively used in theF.get_*functions. The functionality was moved there. They provided little convenience in the first place and keeping them public also clashes with make datapoint methods private #7733.Revert part of the changes that extract make_* functions out of make_*_loader #7717 introduced to the testing function
make_bounding_box. The function no longer takes asizeas positional and aspatial_sizeas optional keyword argument, but onlycanvas_sizeas positional argument. Meaning, the role thatsizepreviously filled was removed, since we never used that.cc @vfdev-5