rgeirhos / texture-vs-shape

Pre-trained models, data, code & materials from the paper "ImageNet-trained CNNs are biased towards texture; increasing shape bias improves accuracy and robustness" (ICLR 2019 Oral)
https://openreview.net/forum?id=Bygh9j09KX
Other
785 stars 101 forks source link

Preprocessing cue-conflict images #22

Closed sousquared closed 3 years ago

sousquared commented 3 years ago

Hi Robert Geirhos,

I'm trying to compute shape bias of my model by using cue-conflict images in stimuli/style-transfer-preprocessed-512 folder.
I would like to know what you did for preprocessing these images.
Did you use standard ImageNet normalization like you mentioned in README?

  • mean = [0.485, 0.456, 0.406]
  • std = [0.229, 0.224, 0.225]

Or should I recalculate and use mean and std of cue-conflict images? Below are the mean and std of them that I calculated by myself:

Additionally, I don't think we need Resize(256) and CenterCrop(224) with these images because their size is already 224 x 224 (height, width). So I changed test transformation from:

    test_transforms = transforms.Compose([
                                      transforms.Resize(256),
                                      transforms.CenterCrop(224),
                                      transforms.ToTensor(),
                                      normalize])                 

to:

    test_transforms = transforms.Compose([
                                      transforms.ToTensor(),
                                      normalize])                 

I would like to know your settings.

Best Regards,

Sou Yoshihara Master student at Kyoto university

rgeirhos commented 3 years ago

I used standard ImageNet normalization. And yes, you don't need to resize/crop these images if they're already in the desired size.

sousquared commented 3 years ago

Okay thank you for the quick replay!