Transforms.Rotate

Hi All,

I’m using torchvision transforms but several of the transform documented in the website are missing.
I don’t rotation, vertical flips and many more.
I already updated torchvision to 0.2.0
What can be the problem?

1 Like

If you have the latest torchvision build, you should be able to use torchvision.transforms.RandomRotation, there is no transforms.Rotate

I think you can use it like transforms.RandomRotation((degree,degree), ...) if you want to have a fixed rotation.

I have torchvision 0.2.0 but I cannot find it. How can I upgrade my torchvision build? I’m using also python 3.5.2

Version 0.2.0 should already have RandomRotation.
I just tested this by installing pytorch and torchvision from pip (as instructed on the website)

# For python 3.5 and CUDA 8
pip3 install http://download.pytorch.org/whl/cu80/torch-0.3.0.post4-cp35-cp35m-linux_x86_64.whl 
pip3 install torchvision

Have you tried reinstalling maybe? You can always try to build the latest torchvision from source.
Clone this repo and follow the instructions to build it.

Just to be sure there are no typos involved, could you please execute the following python snippet and show me the output?

import torchvision
print(torchvision.__version__)
print(torchvision.transforms.RandomRotation)

Thank you for you help.
I got "torchvision has not attribute ‘version’, which is extemly strange since I already used it and train networks with it.

When you say you have version 0.2.0, you mean pytorch version?
Because that might explain everything. Pytorch v0.2.0 comes with an older torchvision that does not have the RandomRotation.

If you want to use that version of pytorch and torchvision, you need to select the right version on the documentation website. There you can see that there are less transforms.

If you want the newer transforms, I suggest you install pytorch v0.3.0 and the torchvision package that comes with it.
You could try building torchvision from source and still use pytorch v0.2.0, but as torchvision depends on pytorch I dont think that will work without issues.

Thank you a lot! I will check it!