Hello, I’d like to ask you about data preprocessing of cifar-10
In the pre-processing of data, we need to convert the data, converting the 0-255 RGB image to [0,1], and then to [-1,1],
Code is
transform = transforms.Compose(
[transforms.ToTensor(),
transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))])
])
I can understand.ToTensor() converts data to [0,1], but I don’t know how Normalize converts data to [-1,1]. Although I know that input[channel] = (input[channel] - mean[channel])/STD [channel]
But I still don’t know how to get to [-1,1]
Thanks.