vanstorm9:

What would be a proper way to reformat this code so that I have different transformations per epoch?


Tansformations are usually applied in the __getitem__ method of the Datset (I don’t know if you are using a custom Dataset or a pre-defined one) and random transformations will be random by default. In your case ColorJitter will use random values for each call and thus each sample (the same applies to e.g. RandomCrop).



 vanstorm9:

Also if I want to use the same transformation from one epoch, wait a few epochs, and use that same transform (for example, the same data-augmented-transformed image from epoch 1 reappears in epoch 10), how would I do that?


One way would be to seed the code (I wouldn’t recommend using this approach, if you are not familiar with how seeing and the pseudo random number generator works) or to use the functional API via torchvision.transforms.functional and apply the transformations by creating the parameters for each transformation manually.