Torchvision - normalization abnormal values

It should not necessarily be within [-1, 1]. We are centering by the data by their mean mean=[0.04717693328857422] and dividing them by their standard-deviation (std=[0.12218446918562346]). So given that the input values of images are within [0, 1], after this mean-centering and standardization, they will end-up in the interval: (0-0.047)/0.122=-0.386 and (1-0.047)/0.122=7.798.

If you want to make your outputs be within [-1, 1], then you can normalize by mean=0.5, and std=0.5:

transforms =  transforms.Compose([transforms.ToTensor(),  
                                  transforms.Normalize(mean=[0.5], std=[0.5])])
1 Like