Can some explain transforms from torchvision?

I have read the documentation but as a newbie I am having difficulties comprehending it. What is the purpose of transforms? Thank you!

You can use the transformations to e.g. preprocess your data or augment it.
Preprocessing is often necessary, if you would like to resize your images to fit your model definition (a lot of pre-trained models require an image size of 224x224, although you can use adaptive layers to skip this condition).
Data augmentation helps while training your model. You can randomly transform your image data, e.g. by randomly flipping the images or changing their color, saturation etc., to artificially create more data.

The current transformations in torchvision use PIL.Images, so make sure to pass the loaded images and not tensors. :wink:

1 Like

Thanks! Haha. Now I get it!