Nikronic
(Nikan Doosti)
August 3, 2020, 5:48pm
2
Hi,
transforms.ToTensor()
scales your input between [0, 1]
but transforms.Normalize(mean, std)
computes z-score for input images (normalize images) so it is expected to see negative values and even out of range [-1, 1]
as you are using mean and std != 0.5.
I am new to Pytorch, I was just trying out some datasets. While using the torchvision.transforms.Normalize I noted that most of the example out there were using 0.5 as mean and std to normalize the images in range (-1,1) but this will only work if our image data is already in (0,1) form and when i tried out normalizing my data (using mean and std as 0.5) by myself, my data was converted to range (-1,1), this means that when I loaded the data it was converted into (0,1) some where in the code.
A…
I’m trying to compute the mean and the std of my dataset. I found this topic and implemented some ideas. However, when I applied the normalization on the dataset and checked the values. Then I found out that most values weren’t on the range[-1, 1], some greater than 1 and 2.
Is it normal? Or should it be best just use the scaling that the ToTensor() does?
I used the following transforms: Resize(250), CenterCrop(224), RandomHorizontalFlip(), ToTensor().
Bests
2 Likes