Hey, so I was wondering what the best way is to apply separate train/test transforms on a torchvision dataset. What I am trying to do is have separate transforms for training, validation and test set (where validation and test transforms is similar)
I currently have everything setup like this (oversimplified):
train_transforms = T.Compose([ T.RandomCrop(32, padding=4), T.RandomHorizontalFlip(), T.ToTensor(), T.Normalize(mean, std) ]) test_transforms = T.Compose([ T.ToTensor(), T.Normalize(mean, std) ]) train_dataset = CIFAR10(root=PATH, train=True, transform=train_transforms) targets_ = rain_dataset.targets train_idx, val_idx = sklearn.model_selection.train_test_split(np.arange(len(targets_)), test_size=0.2, stratify=targets_) train_sampler = SubsetRandomSampler(train_idx) val_sampler = SubsetRandomSampler(val_idx) test_dataset = CIFAR10(root=PATH, train=False, transform=test_transforms) train_loader = DataLoader(train_dataset, sampler=train_sampler) val_loader = DataLoader(train_dataset, sampler=val_sampler) test_loader = DataLoader(test_dataset)
However, doing it this way does also apply the train_transforms to the val_loader, but for validation I would like to not have any augmentation (i.e. I want
Is there any straightforward way to apply another transforms to the validation loader?
Like creating a separate Dataset that only contains validation data?