Hi,
I have trained a classification network with the following transformations:
data_transforms = {
        'train': transforms.Compose([
            transforms.RandomResizedCrop(size=224, scale=(0.5, 1.0)),
            transforms.RandomAffine(15),
            transforms.ColorJitter(brightness=0.1, contrast=0.1, saturation=0.1, hue=0.1),
            transforms.ToTensor(),
            transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
        ]),
        'val': transforms.Compose([
            transforms.Resize(256),
            transforms.CenterCrop(224),
            transforms.ToTensor(),
            transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
        ]),
    }

Training accuracy is 99.99% and validation one is 99.65%, which is very good. Let’s name the above transformations train_transforms1 and val_transforms1, respectively.
Now if I change the validation transformations to the following, called val_transforms2:
'val': transforms.Compose([
            transforms.Resize((224,224)),
            transforms.ToTensor(),
            transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
        ]),

then the validation accuracy drops significantly to 97.78%.
Now again if I change the training transformations to the following, called train_transforms2:
'train': transforms.Compose([
            transforms.Resize((224,224)),
            transforms.RandomAffine(15),
            transforms.ColorJitter(brightness=0.1, contrast=0.1, saturation=0.1, hue=0.1),
            transforms.ToTensor(),
            transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
        ]),

then the results are inverse: very high accuracy with val_transforms2 and not so high accuracy with val_transforms1!
So I guess if in training we do RandomResizedCrop() then we should do Resize() and CenterCrop() at test time?
Is there a general rule for setting test time transformations according to training time ones? How should I best set test time transformations according to the train_transforms1 and train_transforms2 above?
Thank you very much for your suggestions!