hendrycks/robustness

Please note the Resize, Crop usage of torchvision.transforms!

Opened this issue · 0 comments

Differences between Resize and Crop arguments may cause incorrect comparisons between corruption data and clean data.

The label of this image is tench, in the case of this image, method 1 clearly improves the accuracy of the original (severity=0)
In the transformation of the original image, method1 is incorrect

For a correct comparison, I would suggest using method2 .

clean_image_path : val/n01440764/ILSVRC2012_val_00041939.JPEG.png
method1

transforms.Resize((256, 256)),
transforms.CenterCrop((224, 224)),

method2

transforms.Resize(256),
transforms.CenterCrop(224),

method1 result (severity:0->1->2->3->4->5)
Screenshot from 2024-06-21 14-17-41

method2 result(severity:0->1->2->3->4->5)
Screenshot from 2024-06-21 14-18-19