This repository contains the proposed acceleration method – simplified calculation of the loss function – in the research "Acceleration of Interpretable Deep Neural Networks" (ISO).
This repository includes code implementations for:
- ProtoPNet and its experiment results across different batch sizes (stored in the
/saved_modelsdirectory). - ProtoViT and TesNet, with experiment results only for batch size 80 (stored in their respective
/saved_modelsdirectories). - EvalProtoPNet, a folder containing the evaluator for ProtoPNet.
To install the required dependencies for each of these models, run in their subfolders:
pip install -r requirements.txt- Download the dataset CUB_200_2011.tgz from Caltech Vision.
- Unpack the dataset:
tar -xvzf CUB_200_2011.tgz
- Crop the images using
crop_dataset.pyand bounding box information frombounding_boxes.txt(included in the dataset):python crop_dataset.py
- Split the cropped images into training and test sets using
split_dataset.pyandtrain_test_split.txt(included in the dataset):python split_dataset.py
- Move the cropped images into appropriate directories:
mv cropped_train ./datasets/cub200_cropped/train_cropped/ mv cropped_test ./datasets/cub200_cropped/test_cropped/
- Augment the training dataset using
img_aug.py:This will create an augmented training set in:python img_aug.py
./datasets/cub200_cropped/train_cropped_augmented/
Edit settings.py to set appropriate paths for dataset and other hyperpameters
- For training the original models:
or run directly:
bash main.sh
python main.py
- For training the accelerated models:
or run directly:
bash main_custom.sh
python main_custom.py
All experiments were conducted on an NVIDIA Tesla T4 GPU with 16GB RAM.
This work builds upon the following repositories:
- ProtoPNet: https://github.com/cfchen-duke/ProtoPNet
- BetterProtoPNet - fork of ProtoPNet with data preprocessing scripts: https://github.com/KrystianJachna/BetterProtoPNet
- ProtoViT: https://github.com/Henrymachiyu/ProtoViT
- TesNet: https://github.com/JackeyWang96/TesNet
- EvalProtoPNet: https://github.com/hqhQAQ/EvalProtoPNet