This is the official implementation of SIC for interpretable image classification with neural networks.
If you use this code, please cite:
@article{wolf2025sic,
title={SIC: Similarity-Based Interpretable Image Classification with Neural Networks},
author={Wolf, Tom Nuno and Kavak, Emre and Bongratz, Fabian and Wachinger, Christian},
journal={arXiv preprint arXiv:2501.17328},
year={2025}
}
Before getting started, ensure you have conda installed and initialized. If not, follow the installation instructions at:
-
Install dependencies
bash setup/setup.sh conda activate sic
This will install the conda environment and all required pip dependencies.
-
Download the dataset
Follow the instructions at Stanford Dogs to download the
ImagesandListsdirectories. Place them in any directory of your choice. -
Prepare the dataset
python dogs_dataset.py --data_dir=PATH/TO/YOUR/DIR
To train a model, run:
python train_sic.py --data_dir=PATH/TO/YOUR/DIRFor a complete list of available arguments and options:
python train_sic.py --helpFor exemplary visualization of prototypes and the forward pass of a test sample, run (see --help for more arguments):
python vis_sic.py --data_dir=PATH/TO/YOUR/DIR --checkpoint=PATH/TO/YOUR/.PTHThis project is licensed under the Apache License 2.0. See the LICENSE file for complete details.
This project includes code from multiple sources:
- (Modified) code from the B-cos-v2 repository (Apache License 2.0)
- (Modified) code from the Nadaraya-Watson Head repository (no license specified)