This repository is the official implementation of “ImageNet-trained CNNs are not biased towards texture: Revisiting feature reliance through controlled suppression” - Tom Burgert, Oliver Stoll, Paolo Rota, Begüm Demir @ NeurIPS 2025 (oral)
This repository provides code to reproduce the experiments in the paper. The work revisits the hypothesis that CNNs are inherently biased toward texture [Geirhos et al., ICLR 2019]. It proposes a domain-agnostic framework for controlled suppression of cues (shape, texture, color) and quantifies feature reliance. Our results show that CNNs are not inherently texture-biased but mainly depend on local shape features. Extending the analysis across domains, we find systematic differences: vision models lean on shape, medical imaging on color, and remote sensing on texture.
Install dependencies with pip. By default, the commands below install CPU wheels.
For GPU support, uncomment the lines for CUDA 12.1.
For other CUDA versions, please check the official PyTorch installation guide.
# CPU installation
pip install -r requirements.txt
# GPU installation (CUDA 12.1)
pip install torch==2.4.0 torchvision==0.19.0 --index-url https://download.pytorch.org/whl/cu121
pip install -r requirements.txt- Caltech101, Flowers102, OxfordPet, and STL10 are included in
torchvision.datasetsand will be automatically downloaded when first used. - ImageNet: use the official ILSVRC 2012 split.
- We use the
224×224release from MedMNIST. - The MedMNIST repository is integrated via the
medmnistPython package (already included inrequirements.txt), which handles dataset download in the same way astorchvision.datasets.
- AID: Hugging Face link
- RSD46-WHU: Hugging Face link
- After download, set the the path for base_path in the script and run:
scripts/preprocess_rsd46whu.py
- After download, set the the path for base_path in the script and run:
- PatternNet: Download here
- UCMerced: Download here
- DeepGlobe: Kaggle link
- After download, set the the paths for source_path and destination_path in the script and run:
scripts/preprocess_deepglobe.py - This script converts DeepGlobe into a multi-label classification dataset.
- After download, set the the paths for source_path and destination_path in the script and run:
To train a model, run:
python3 training.py \
logging.exp_dir=<logging_path> \
params.cuda_no=2 \
params.dataset=caltech101 \
optimizer.optimizer_name=adam_w \
optimizer.lr=0.001 \
params.max_epochs=300 \
dataaug.train_augmentations=randomresizedcrop_horizontalflip \
dataaug.test_augmentations=resizecrop \
optimizer.weight_decay=0.01 \
optimizer.scheduler_name=step_lrReplace <logging_path> with your desired output directory. Datasets can be swapped (e.g., imagenet, flowers102, etc.).
To evaluate feature reliance of ResNet-50 across all Computer Vision datasets:
python3 reliance_protocol.py \
-d imagenet caltech101 flowers102 stl10 oxfordiiitpet \
-m resnet50 \
-l <logging_path>Here:
-d: specifies the datasets (space-separated).-m: specifies the model architecture.-l: sets the logging directory.
Replace <logging_path> with your desired output directory.
If you use this code, please cite:
@misc{burgert2025featurereliance,
title = {ImageNet‐trained CNNs are not biased towards texture: Revisiting feature reliance through controlled suppression},
author = {Tom Burgert and Oliver Stoll and Paolo Rota and Begüm Demir},
year = {2025},
eprint = {2509.20234},
archivePrefix= {arXiv},
primaryClass = {cs.CV}
}