This repository presents the official PyTorch implementation for the paper "Interpretable Image Classification via Non-parametric Part Prototype Learning".
Setting up the environment involves the following steps:
- Install required Python packages listed in
requirements.txt
, - Install
dinov2
without its dependencies for better compatibility (mainly to excludexformers
). We use commite1277af
ofdinov2
repository. Additionally, please ensure the PyTorch version meetstorch<2.4.0
to avoid performance regression.
To install Python packages used in this repository:
pip install -r requirements.txt
To install dinov2
without installing xformers
:
git clone https://github.com/facebookresearch/dinov2.git
cd dinov2
git checkout e1277af2ba9496fbadf7aec6eba56e8d882d1e35
pip install --no-deps -e .
Please prepare the dataset as follows:
- Download CUB-200-2011 dataset from the official website.
- Perform offline data augmentation on the dataset following previous works, such as by modifying this script.
- For evaluation, please also download the object segmentation masks.
- Make sure all the data folders are placed under one dataset root directory, which looks like the following after extracting archives:
dataset-root
├── CUB_200_2011/
├── cub200_cropped/
└── segmentations/
To train the model on CUB-200-2011, run the following command after replacing the arguments with dataset root directory and logging directory:
python train.py --data-dir <dataset-root> --log-dir <log-directory>
To evaluate the trained model:
- First change line 19 of
eval/utils.py
so it points to<dataset-root>
. - Run the following command after changing the argument to the previous logging directory that contains training artifacts (keep
ckpt.pth
at the end):
python evaluate.py --ckpt-path <log-directory>/ckpt.pth
@InProceedings{Zhu_2025_CVPR,
author = {Zhu, Zhijie and Fan, Lei and Pagnucco, Maurice and Song, Yang},
title = {Interpretable Image Classification via Non-parametric Part Prototype Learning},
booktitle = {Proceedings of the Computer Vision and Pattern Recognition Conference (CVPR)},
month = {June},
year = {2025},
pages = {9762-9771}
}