Validation set augmentations PyTorch example
In this PyTorch vision example for transfer learning, they are performing validation set augmentations, and I can't figure out why.

# Just normalization for validation
data_transforms = {
    'train': transforms.Compose([
        transforms.RandomResizedCrop(224),
        transforms.RandomHorizontalFlip(),
        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])
    ]),
}


As far as I know, data augmentations are to be made solely on the training set (and sometimes on the test set, in what is called Test Time Augmentations).  

Why is it done here as well?
Also, why not just resizing straight to 224?  

To clarify, random data augmentation is only allowed on the training set. You can apply data augmentation to the validation and test sets provided that none of the augmentations are random. You will see this clearly in the example you provided. 

The training set uses many random augmentations (augmentations that use randomness usually have "random" in the name). However, the validation set only uses augmentations that don't introduce any randomness to the data.

One last important detail: when you use normalization on the validation and test set you MUST use the same exact factors you used for the training set. You will see that the example above kept the numbers the same.

The need to resize and then center crop comes from the fact the val set needs to come from the same domain of the train set, thus if the former was randomly resized and cropped to 224, the val set needs to deterministically resize and crop.
