Random-Transforms: New transform every time __getitem__ is called?

I am wondering whether applying Random Transformations/Augmentations of Images will transform each individual image in the same way in each epoch.

In other words: Is the Image with index idx always the same in every epoch or will the base image idx get a different transform at each call?

In PyTorch, when you apply random transformations/augmentations to images, they are generally not transformed in the same way in each epoch. The transformations are meant to be random and are applied independently for each image at each call. This means that the image with index idx will likely get a different transformation at each call, making the augmented image different in every epoch.

This randomness in transformations helps the model become more robust and generalize better, as it learns from a wider variety of augmented images.

1 Like

Thanks for the answer, that clarifies a lot.
What can I do to keep random augmentations fixed for some iterations? I need to compare the same image 2-3 times and I dont want it to be altered every time I get it.