kuangliu / pytorch-cifar

95.47% on CIFAR10 with PyTorch
MIT License
6.03k stars 2.15k forks source link

Correct Normalization Values for CIFAR-10 #19

Open dlmacedo opened 7 years ago

dlmacedo commented 7 years ago

Correct normalization values for CIFAR-10: (0.4914, 0.4822, 0.4465), (0.247, 0.243, 0.261)

tyunist commented 7 years ago

Great! It works much better than the previous one. Could you explain more about how did you compute those values? Thanks

Armour commented 7 years ago

@tyunist Hi, here is my code for how to compute those value, hope it helps :)

tyunist commented 7 years ago

Great! Thanks, Armour.
Based on your code, I found out a bug in my code causing worse performance after standardization.

Armour commented 7 years ago

Nice, I'm glad I could help :)

netaz commented 6 years ago

Hi guys, Any idea why the pytorch CIFAR10 example uses: transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5)?

And while I'm asking, why do you do: transforms.RandomCrop(32, padding=4)?

I.e. aren't the images already 32x32? And why pad the images? Thanks! Neta

luuuyi commented 6 years ago

@netaz I think after set padding=4 the image become 40 x 40, random crop operator can get more result. If we do not set padding=4, random crop only get origin image.

nzmora commented 6 years ago

@luuuyi yes, I agree with you. This occurred to me some time after I posted the question, but I didn't think to update here. Thanks for answer!

gobbedy commented 5 years ago

the behaviour of RandomCrop(32, padding=4) still wasn't clear to me after reading the documentation and reading this issue, so I did a little digging.

It order, it does

  1. pads the original image on all sides with 4 pixels, resulting in a 40x40 image (since the original image is 32x32 in cifar10)
  2. takes a random 32x32 crop of this 40x40 image

The result is weird black lines around a chopped off version of the original image

eg, original: image

after RandomCrop(32, padding=4) transformation: image

parkie0517 commented 10 months ago

Thank you @gobbedy. this is very helpful!