-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Ten crop annotation #7254
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
Ten crop annotation #7254
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.
Thank you Philip, if it fixes the original failure then let's get this in
ImageOrVideoTypeJIT, | ||
ImageOrVideoTypeJIT, | ||
ImageOrVideoTypeJIT, | ||
ImageOrVideoTypeJIT, | ||
ImageOrVideoTypeJIT, | ||
ImageOrVideoTypeJIT, | ||
ImageOrVideoTypeJIT, | ||
ImageOrVideoTypeJIT, | ||
ImageOrVideoTypeJIT, | ||
ImageOrVideoTypeJIT, |
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.
.... wow
torch.Tensor, | ||
torch.Tensor, | ||
torch.Tensor, | ||
torch.Tensor, | ||
torch.Tensor, | ||
torch.Tensor, | ||
torch.Tensor, | ||
torch.Tensor, | ||
torch.Tensor, | ||
torch.Tensor, |
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.
oh it keeps on giving 😅
@@ -234,7 +234,18 @@ def _check_inputs(self, flat_inputs: List[Any]) -> None: | |||
|
|||
def _transform( | |||
self, inpt: Union[datapoints.ImageType, datapoints.VideoType], params: Dict[str, Any] | |||
) -> Union[List[datapoints.ImageTypeJIT], List[datapoints.VideoTypeJIT]]: | |||
) -> Tuple[ |
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.
Yes, all of this is ugly and verbose AF. We can also try to keep the List
annotation (which we should have gone for in the first place).
flipped = five_crop_image_pil(image, size) | ||
|
||
return non_flipped + flipped |
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.
This is the actual functional fix. v1 returned a tuple and so should v2.
Test failures are unrelated. |
Reviewed By: vmoens Differential Revision: D44416586 fbshipit-source-id: e506d56435133a7761f59a3ac9d0208f1fab4884
Towards #7159. Although we annotated as
List[torch.Tensor]
vision/torchvision/transforms/functional.py
Line 830 in 0e0a5dc
the addition of two tuples
vision/torchvision/transforms/functional.py
Lines 870 to 871 in 0e0a5dc
vision/torchvision/transforms/functional.py
Line 785 in 0e0a5dc
will also be a tuple.
Our docstrings also say as much:
vision/torchvision/transforms/functional.py
Lines 848 to 849 in 0e0a5dc
vision/torchvision/transforms/transforms.py
Lines 1073 to 1074 in c5e9a10
It seems the automagic handling described in #7252 also kicks in for return types or otherwise the v1 script tests should have never passed.
cc @vfdev-5 @bjuncek