Official PyTorch implementation of ProtoMappingNet, accepted at ECCV 2026.
ProtoMappingNet learns low-, mid-, and high-level prototypes and explicitly connects adjacent prototype levels through bidirectional relational mappings, enabling structured hierarchical explanations using only image-level labels.
The code was tested with Python 3.8.10.
pip install -r requirements.txtFor the CUB-200-2011 experiments with the iNaturalist-pretrained ResNet-50 backbone, download:
BBN.iNaturalist2017.res50.180epoch.best_model.pth
The pretrained model is provided via ProtoTree and is also used by ProtoPool.
Rename the file to:
resnet50_iNaturalist.pth
and place it in the expected pretrained-model path used by resnet_features.py.
ProtoMappingNet expects datasets in PyTorch ImageFolder format.
Following ProtoPNet-style preprocessing, crop images using the provided bounding boxes and use the official train/test split.
datasets/birds/
├── train_cropped/
└── test_cropped/
datasets/cars/
├── train/
└── test/
datasets/PartImageNet/images/
├── train_split/
└── val_split/
Dataset paths can be overridden using:
--data_train
--data_push
--data_test
The default training configuration uses the training schedule reported in the paper. Below are representative commands for each dataset/backbone setting.
python3 main.py \
--arch resnet34 \
--inat Falsepython3 main.py \
--arch resnet50 \
--inat Truepython3 main.py \
--data_type cars \
--num_classes 196 \
--arch resnet34 \
--inat False \
--data_train ../datasets/cars/train \
--data_push ../datasets/cars/train \
--data_test ../datasets/cars/testpython3 main.py \
--data_type partimagenet \
--num_classes 158 \
--arch convnext_tiny \
--inat False \
--data_train ../datasets/PartImageNet/images/train_split \
--data_push ../datasets/PartImageNet/images/train_split \
--data_test ../datasets/PartImageNet/images/val_splitAdditional supported backbones can be selected through --arch.
This codebase builds upon and adapts components from several open-source prototype-based learning repositories:
In particular, backbone feature extractors and receptive-field utilities are adapted from ProtoPNet, and data augmentation utilities are adapted from PIPNet. Evaluation concepts for prototype stability were informed by EvalProtoPNet.
We thank the authors for making their implementations publicly available.
