What is the best way to execute data augmentation in Pytorch?
I created a regression UNet to predict a cell service coverage map. I want to add data augmentation. I already have the dataset and transforms complete (pasted below), but I don't know how to productively augment data in pytorch, since it seems like pytorch replaces the originals with the transforms. My thinking is: if you only augment the data before you train and lose the originals, doesn't it defeat the purpose of data augmentation? Is there a way of adding augmented images to the dataset rather than replacing the originals?
rotation_angle = 90
rotation_transform = transforms.Compose([
transforms.ToPILImage(),
transforms.RandomRotation(degrees=rotation_angle),
transforms.ToTensor()
])
dataset = FullDataset(dir_building, dir_cm, transform=rotation_transform)
Code snippit inside my FullDataset getitem():
if self.transform:
aug_input = self.transform(input)
aug_mask = self.transform(mask)
return aug_input, aug_mask