How to find mean and standard deaviation for normalization

how do you calculate the mean and standard deviation for image normalization??

.mean() and .std() methods of a tensor should help.

like where do i type these sorry i forgot everything cuz been on a break

Hey!! you can use this code to find out the mean and standard deviation of the individual channel from the image.

mean = 0
std = 0
for i in range(len(dataset)):
image, _ = dataset[i]


From this you get the output as mean=0.4914 and standard deviation=0.2023.

1 Like