I am using the following code to calculate the mean and std for my custom dataset. About Normalization using pre-trained vgg16 networks 1 (thanks to ptrblck)
However my dataset is unbalanced and hence I have used RandomWeightedSampler to create a dataloader.
Should I calcuate mean and std using this dataloader or calculate it using a dataloader that does not use any sampler. (Calculating mean and std using the sampler dataloader gives varying results each time)
Thanks in advance !