Augmentations#
Is some transformation of data that allows you to get more data or transfrom your data in specific way.
from torchvision import transforms
from PIL import Image
from IPython.display import HTML
To show the result of the transformations, the image loaded and displayed below is used.
img = Image.open("cat.jpg")
img

Resize#
Is a transformation that allows you to set a specific size for the image. So in the following cell I show how it can be done for a specific image.
display(HTML("<h4>Transforemd image</h4>"))
display(transforms.Resize((224, 224))(img))
Transforemd image

Horizontal flip#
You can use torchvision.transforms.RandomHorizontalFlip
for this purpose. But this transforms the flip randomly, you have to set the p
parameter as the probability of the flip.
In the following cell I is showed RandomHorizontalFlip(p=1)
that always will transform picture.
transforms.RandomHorizontalFlip(p=1)(img)
