Skip to content

Repository files navigation

ProtoMappingNet: Interpretable Hierarchical Prototypes through Relational Prototype Mappings

Official PyTorch implementation of ProtoMappingNet, accepted at ECCV 2026.

Paper Supplement

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.

Setup

Installation

The code was tested with Python 3.8.10.

pip install -r requirements.txt

iNaturalist-pretrained ResNet-50

For 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.

Dataset Preparation

ProtoMappingNet expects datasets in PyTorch ImageFolder format.

CUB-200-2011

Following ProtoPNet-style preprocessing, crop images using the provided bounding boxes and use the official train/test split.

datasets/birds/
├── train_cropped/
└── test_cropped/

Stanford Cars

datasets/cars/
├── train/
└── test/

PartImageNet

datasets/PartImageNet/images/
├── train_split/
└── val_split/

Dataset paths can be overridden using:

--data_train
--data_push
--data_test

Training

The default training configuration uses the training schedule reported in the paper. Below are representative commands for each dataset/backbone setting.

CUB-200-2011 — ResNet-34

python3 main.py \
    --arch resnet34 \
    --inat False

CUB-200-2011 — ResNet-50 (iNaturalist pretrained)

python3 main.py \
    --arch resnet50 \
    --inat True

Stanford Cars — ResNet-34

python3 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/test

PartImageNet — ConvNeXt-Tiny

python3 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_split

Additional supported backbones can be selected through --arch.

Acknowledgements

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.

About

Code for "ProtoMappingNet: Interpretable Hierarchical Prototypes through Relational Prototype Mappings", ECCV 2026

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages