Hi all, a bit of a basic question here - I am trying to work with a somewhat small dataset, and apply augmentation techniques to increase my training set size. My DataLoader is currently very basic, of the form:
class Dataset(torch.utils.data.Dataset):
def __init__(self, images_path):
super(Dataset, self).__init__()
self.images_path = images_path
def __len__(self):
return len(self.images_path)
def __getitem__(self, idx):
img_path = self.image_paths[idx]
img = cv2.imread(str(img_path))
return img
This Dataset doesn’t really suit itself well to augmentation, as images are iterated / specified by a specific index, whereas I want one single image to give rise to multiple training examples with different augmentations. I’m wondering what the usual solution in Pytorch is for this type of augmentation.
torchvisions.transforms
is very well documented, but it talks about taking training samples and applying random transformations to them, rather than generating multiple samples. I always could do it manually, by applying random transformations to the batch multiple times at training time, but this seems ugly, and fails to spread out the same sample with different augmentations through different batches - is there an easy, Pytorchy solution for multiple training samples from a single image w/ augmentation?