-
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
remove spatial_size #7734
remove spatial_size #7734
Conversation
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.
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?
Reviewed By: matteobettini Differential Revision: D48642265 fbshipit-source-id: 123d2a3157d4536ea9ac25e0192d54307b31ea1e
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_size
attribute as well as all of thespatial_size
parameters 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_size
andquery_spatial_size
toF.get_size
andquery_size
. There is a semantic slip in that name in the sense that it still returns thecanvas_size
for bounding boxes. However, this is the same as before, whereF.get_spatial_size
returned the size for images, masks, and videos.Remove the
.spatial_size
,.num_channels
, and.num_frames
properties 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 asize
as positional and aspatial_size
as optional keyword argument, but onlycanvas_size
as positional argument. Meaning, the role thatsize
previously filled was removed, since we never used that.cc @vfdev-5