There's this code for the image augmentation
# Transforms for the training data
train_transforms = transforms.Compose([
transforms.RandomHorizontalFlip(),
transforms.RandomRotation(20),
transforms.RandomResizedCrop(150),
transforms.ToTensor(),
transforms.Normalize(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5])
])
# Transforms for the validation data
val_transforms = transforms.Compose([
transforms.Resize(150),
transforms.CenterCrop(150),
transforms.ToTensor(),
transforms.Normalize(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5])
])
I was wondering if we should only pre-process the validation data, or in this case, it's ok to also "CenterCrop" the val data?
I'm asking this question because I read that for training data, we can pre-process (resize, to-tensor, normalize) and augment (flip, rotate, crop), but for validation data, we should only pre-process, but not augment. Is this idea true?
If that's true, I should remove the CenterCrop from the validation transform, right?
val_transforms = transforms.Compose([
transforms.Resize(150),
- transforms.CenterCrop(150),
transforms.ToTensor(),
transforms.Normalize(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5])
])
There's this code for the image augmentation
I was wondering if we should only pre-process the validation data, or in this case, it's ok to also "CenterCrop" the val data?
I'm asking this question because I read that for training data, we can pre-process (resize, to-tensor, normalize) and augment (flip, rotate, crop), but for validation data, we should only pre-process, but not augment. Is this idea true?
If that's true, I should remove the
CenterCropfrom the validation transform, right?val_transforms = transforms.Compose([ transforms.Resize(150), - transforms.CenterCrop(150), transforms.ToTensor(), transforms.Normalize(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5]) ])