How can I rotate random degree in 4D tensor (B,C,H,W)


#1

How can I rotate random degree in 4D tensor (B,C,H,W)? Thanks


#2

see here:
torchvision.transforms.functional.rotate


#3

4D tensor, not PIL.Image.


#4

I typically use scipy’s rotate function:
https://docs.scipy.org/doc/scipy-0.16.1/reference/generated/scipy.ndimage.interpolation.rotate.html

Unfortunately it’s not very fast and you have to apply it on a numpy tensor, i.e. before you convert it to a pytorch tensor.


#5

What about this: