akamaster / pytorch_resnet_cifar10

Proper implementation of ResNet-s for CIFAR10/100 in pytorch that matches description of the original paper.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

about the mean and stddev

yuffon opened this issue · comments

commented

Hi, I compute the mean and stddev from the cifar10 train dataset. The results are:
mean:[125.30691805 122.95039414 113.86538318]
stddev:[62.99321928 62.08870764 66.70489964]
the normalized mean and stddev is:
mean: [0.49139968 0.48215841 0.44653091]
stddev: [0.24703223 0.24348513 0.26158784]

However, in the code, the mean and stddev is:
mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225])

True, normalized stddev and mean should be as you mentioned since ToTensor normalizes everythin between 0 to 1. However, the difference between mean and std in code and true mean and std is non essential due to the BatchNormalization layers. In fact, any values can be given, since BN will normalize it anyway, therefore arbitrary values were taken =)