Codes to generate datasets from "Abutting Grating Illusion: Cognitive Challenge to Neural Network Models"
This repository provides the code samples to generate abutting grating(AG) corruption samples with MNIST, high resolution MNIST and 160 silhouettes images.
The high resolution MNIST image samples are achieved by first interpolating the original MNIST samples from 1x28x28 to 3x224x224. The 160 silhouette images are proposed by "ImageNet-trained CNNs are biased towards texture; increasing shape bias improves accuracy and robustness": https://github.com/rgeirhos/texture-vs-shape
Three python scripts are provided respectively. In each script, a function is implemented to accomplish the AG corruption. You can change the parameter "interval" to alter the interval between abutting gratings. You can change the parameter "direction" to alter the direction of the abutting gratings.