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.
Am I right that Pytorch automatically Normalizes Image to (0,1) when we load it and if yes which line of code is doing this?
import torch
from torchvision import transforms, datasets
Transformations = transforms.Compose([transforms.RandomSizedCrop(224), transforms.ToTensor(),
transforms.Normalize(mean=[0.5, 0.5, 0.5],std=[0.5, 0.5, 0.5])
])
image_data = datasets.ImageFolder('C:/users/sharm/OneDrive/Desktop/Mnist/dogImages/train', transform = Transformations)
data_loader = torch.utils.data.DataLoader(image_data, batch_size = 50, shuffle = True)
iteration = iter(data_loader)
images, labels = iteration.next()
print (images)
Thank you