You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
90, 180, and 270 degree rotation can be done without interpolation by simply re-arranging the data. This is significantly faster, especially for high resolution image.
Motivation, pitch
Image rotation becomes a bottleneck for me when using large images (1000x1000). Currently PyTorch already has torch.rot90(), which is significantly faster than torchvision.transforms.v2.functional.rotate(). In some applications, it is acceptable to use only 90, 180, and 270 degree rotation for augmentation (cross-ref #566).
Perhaps torchvision.transforms.v2.functional.rotate() can check for 90, 180, and 270 specifically, and call torch.rot90()?
Alternatives
A workaround is to write a custom transform to use torch.rot90().
Thank you for the feature request @gau-nernst . This is indeed something we should consider for inclusion. Let us know if you're interested in submitting a PR for this.
Thanks! Let's try to add that functionality only to torchvision.transforms.v2.functional.rotate (i.e. you do not need to worry about torchvision.transforms.functional.rotate)
🚀 The feature
90, 180, and 270 degree rotation can be done without interpolation by simply re-arranging the data. This is significantly faster, especially for high resolution image.
Motivation, pitch
Image rotation becomes a bottleneck for me when using large images (1000x1000). Currently PyTorch already has
torch.rot90()
, which is significantly faster thantorchvision.transforms.v2.functional.rotate()
. In some applications, it is acceptable to use only 90, 180, and 270 degree rotation for augmentation (cross-ref #566).Perhaps
torchvision.transforms.v2.functional.rotate()
can check for 90, 180, and 270 specifically, and calltorch.rot90()
?Alternatives
A workaround is to write a custom transform to use
torch.rot90()
.Additional context
Micro-benchmark results
TF.rotate()
torch.rot90()
The text was updated successfully, but these errors were encountered: