Make get_image_size and get_image_num_channels public#4321
Make get_image_size and get_image_num_channels public#4321datumbox merged 1 commit intopytorch:mainfrom
Conversation
fmassa
left a comment
There was a problem hiding this comment.
Changes LGTM.
Only thing I would consider if we are making it public is about the order of the elements being returned. I've always found it confusing with PIL to have the sizes be (w, h) instead of (h, w), and _get_image_size returns (w, h) to minimize the number of lines changed when we introduced Tensor support for the transforms.
I'm not sure if it's worth changing the order of returned elements, but it's something worth keeping in mind.
Thoughts?
|
For transparency, I had an offline chat with @fmassa to see if it's worth adding a new method that returns all 3 arguments as vision/torchvision/transforms/transforms.py Lines 1446 to 1448 in 7947fc8 Thus we will merge this version. |
|
Cannot seem to be able to access these functions anymore. Error: #4328 |
Reviewed By: fmassa Differential Revision: D30793335 fbshipit-source-id: 90ec6a0da25cdcf62a359bddfdffa0e5678aa233
The
F._get_image_size()andF._get_image_num_channels()are quite useful methods to determine the size and channels of images and they are used across many classes. This PR makes them public.cc @vfdev-5 @datumbox