I was looking at the tutorial and someone code on github (https://github.com/bearpaw/pytorch-classification/blob/master/cifar.py) and the two preprocessing have different means and stds. Which one is the standard one or the best one? I’m confused on the advantages disadvantages of one vs the other or what the difference of the really are. What do the numbers mean?
Inspired by the tutorial:
transform =  ''' converts (HxWxC) in range [0,255] to [0.0,1.0] ''' to_tensor = transforms.ToTensor() transform.append(to_tensor) ''' Given meeans (M1,...,Mn) and std: (S1,..,Sn) for n channels, input[channel] = (input[channel] - mean[channel]) / std[channel] ''' if standardize: gaussian_normalize = transforms.Normalize( (0.5, 0.5, 0.5), (0.5, 0.5, 0.5) ) transform.append(gaussian_normalize) ''' transform them to Tensors of normalized range [-1, 1]. ''' transform = transforms.Compose(transform)
vs the one from the github link:
def this_guys_preprocessor(): transform_train = transforms.Compose([ transforms.RandomCrop(32, padding=4), transforms.RandomHorizontalFlip(), transforms.ToTensor(), transforms.Normalize((0.4914, 0.4822, 0.4465), (0.2023, 0.1994, 0.2010)), ]) transform_test = transforms.Compose([ transforms.ToTensor(), transforms.Normalize((0.4914, 0.4822, 0.4465), (0.2023, 0.1994, 0.2010)), ]) return transform_train, transform_test