Upload 11 files
Browse files- LICENSE +22 -0
- README.md +140 -0
- cars_models/convnext_model/net_end_to_end.pth +3 -0
- cars_models/resnet_model/net_end_to_end.pth +3 -0
- cars_models/resnet_partial_model/net_end_to_end.pth +3 -0
- cub_models/convnext_model/net_end_to_end.pth +3 -0
- cub_models/resnet_model/net_end_to_end.pth +3 -0
- cub_models/resnet_partial_model/net_end_to_end.pth +3 -0
- pets_models/convnext_model/net_end_to_end.pth +3 -0
- pets_models/resnet_model/net_end_to_end.pth +3 -0
- pets_models/resnet_partial_model/net_end_to_end.pth +3 -0
LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
MIT License
|
2 |
+
|
3 |
+
Copyright (c) 2025 Saxon Institute for Computational Intelligence and Machine
|
4 |
+
Learning (SICIM)
|
5 |
+
|
6 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7 |
+
of this software and associated documentation files (the "Software"), to deal
|
8 |
+
in the Software without restriction, including without limitation the rights
|
9 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10 |
+
copies of the Software, and to permit persons to whom the Software is
|
11 |
+
furnished to do so, subject to the following conditions:
|
12 |
+
|
13 |
+
The above copyright notice and this permission notice shall be included in all
|
14 |
+
copies or substantial portions of the Software.
|
15 |
+
|
16 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22 |
+
SOFTWARE.
|
README.md
ADDED
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
base_model:
|
4 |
+
- torchvision/convnext_tiny
|
5 |
+
- pytorch/resnet50
|
6 |
+
metrics:
|
7 |
+
- accuracy
|
8 |
+
tags:
|
9 |
+
- Interpretability
|
10 |
+
- Explainable AI
|
11 |
+
- XAI
|
12 |
+
- Classification
|
13 |
+
- CNN
|
14 |
+
- Convolutional Neural Networks
|
15 |
+
---
|
16 |
+
|
17 |
+
# A Robust Prototype-Based Network with Interpretable RBF Classifier Foundations
|
18 |
+
|
19 |
+
This repository contains the Deep Classification-by-Component (CBC) models for
|
20 |
+
prototype-based learning interpretability benchmarks for classification as described in the paper
|
21 |
+
"A Robust Prototype-Based Network with Interpretable RBF Classifier Foundations"
|
22 |
+
|
23 |
+
## Model Description
|
24 |
+
|
25 |
+
The CBC approach learns components (or prototypes) to create interpretable learning insights.
|
26 |
+
It uses positive and negative reasoning to reason about the class predictions
|
27 |
+
i.e. the presence and absence of components creates evidence for a given class to be predicted
|
28 |
+
as that class.
|
29 |
+
|
30 |
+
The [`deep_cbc`](https://github.com/si-cim/cbc-aaai-2025) package provides trainer, evaluation
|
31 |
+
and visualization scripts for the CBC models in deep settings with CNN architecture as feature
|
32 |
+
extractor backbones. Further, CBC with positive reasoning is equivalent to having an RBF
|
33 |
+
classification head. Additionally, we provide compatibility support with the PIPNet
|
34 |
+
classification head as well.
|
35 |
+
|
36 |
+
### Available and Supported Architectures
|
37 |
+
|
38 |
+
We provide two variants of CNNs for each of the CUB-200-2011, Stanford Cars and
|
39 |
+
Oxford-IIIT dataset:
|
40 |
+
|
41 |
+
- **ResNet50 w/ CBC Classification Head**: Built on both partially trained and fully trained
|
42 |
+
backbone from the `model_zoo` module in `pytorch`.
|
43 |
+
- **ConvNeXt w/ CBC Classification Head**: Built on partially trained trained `convnext_tiny`
|
44 |
+
backbone from `torchvision`.
|
45 |
+
|
46 |
+
Further, training the above two architectures is possible with an RBF and PIPNet classification
|
47 |
+
head as well.
|
48 |
+
|
49 |
+
## Performance
|
50 |
+
|
51 |
+
All models were trained and evaluated on the CUB-200-2011 (CUB), Stanford Cars (CARS) and
|
52 |
+
Oxford-IIIT Pets (PETS) datasets and below we report the top-1 classification accuracy
|
53 |
+
results on these datasets.
|
54 |
+
|
55 |
+
| Model Version | Backbone | CUB | CARS | PETS |
|
56 |
+
|---------------|-----------------|--------------|--------------|--------------|
|
57 |
+
| CBC-C | `convnext_tiny` | 87.8 ± 0.1 % | 93.0 ± 0.1 % | 93.9 ± 0.1 % |
|
58 |
+
| CBC-R | `resnet50` | 83.3 ± 0.3 % | 92.7 ± 0.1 % | 90.1 ± 0.1 % |
|
59 |
+
| CBC-R Full | `resnet50` | 82.8 ± 0.3 % | 92.8 ± 0.1 % | 89.5 ± 0.2 % |
|
60 |
+
|
61 |
+
## Model Features
|
62 |
+
|
63 |
+
- 🔍 **Interpretable Decision Assistance:** The model performs classification by
|
64 |
+
using positive and negative reasoning based on learnt components (or prototypes) to provide
|
65 |
+
interpretable decision-making insights for assistance.
|
66 |
+
- 🎯 **SotA Accuracy:** Achieves SotA performance on classification tasks for the interpretability benchmarks.
|
67 |
+
- 🚀 **Multiple Feature Extractor CNN Backbones:** Supports ConvNeXt and ResNet50 feature extractor
|
68 |
+
architecture backbones with CBC heads for interpretable image classification tasks.
|
69 |
+
- 📊 **Visualization and Analysis Tools:** Equipped with visualization tools to plot learnt prototype patches and
|
70 |
+
corresponding activation maps alongside the similarity score and detection probability metrics.
|
71 |
+
|
72 |
+
## Requirements
|
73 |
+
|
74 |
+
- python = "^3.9"
|
75 |
+
- numpy = "1.26.4"
|
76 |
+
- matplotlib = "3.8.4"
|
77 |
+
- scikit-learn = "1.4.2"
|
78 |
+
- scipy = "1.13.0"
|
79 |
+
- pillow = "10.3.0"
|
80 |
+
- omegaconf = "2.3.0"
|
81 |
+
- hydra-core = "1.3.2"
|
82 |
+
- torch = "2.2.2"
|
83 |
+
- torchvision = "0.17.2"
|
84 |
+
- setuptools = "68.2.0"
|
85 |
+
|
86 |
+
The basic dependencies for using the models are stated above. Please, refer to the
|
87 |
+
[GitHub repository](https://github.com/si-cim/cbc-aaai-2025) for detailed dependencies
|
88 |
+
and project setup instructions to execute experiments with the above models.
|
89 |
+
|
90 |
+
## Limitations and Bias
|
91 |
+
|
92 |
+
- ❗ **Partial Interpretability Issue:** The uninterpretable feature extractor CNN backbone introduces
|
93 |
+
an uninterpretable component into the model. Although, we achieve SotA accuracy and demonstrate
|
94 |
+
that the models provide quality positive and negative reasoning explanations. But, still we
|
95 |
+
can only call these methods partially interpretable owing to the fact that all prototypes learnt
|
96 |
+
are not human interpretable.
|
97 |
+
- ❗ **Data Bias Issue:** These models are trained on CUB-200-2011, Stanford Cars and Oxford-IIIT Pet datasets
|
98 |
+
and the stated model performance would not generalize to other domains.
|
99 |
+
- ❗ **Resolution Constraints Issue:** The model backbones are pre-trained with a resolution of 224×224.
|
100 |
+
Although models can flexibly input images of different resolutions with current data loaders.
|
101 |
+
The performance will be suboptimal owing to fixed receptive fields learnt by networks for a given resolution.
|
102 |
+
Possibly, a scope of improvement on Stanford Cars dataset can be to standardize image sizes as
|
103 |
+
a pre-processing step to achieve better performance.
|
104 |
+
- ❗ **Location Misalignment Issue:** CNN based models are not perfectly immune to
|
105 |
+
location misalignment under adversarial attack. Hence, with blackbox feature extractor the
|
106 |
+
learnt prototype-based networks are also prone to such issues.
|
107 |
+
|
108 |
+
## Citation
|
109 |
+
|
110 |
+
If you use this model in your research, please consider to cite:
|
111 |
+
|
112 |
+
```bibtex
|
113 |
+
@article{saralajew2024robust,
|
114 |
+
title={A Robust Prototype-Based Network with Interpretable RBF Classifier Foundations},
|
115 |
+
author={Saralajew, Sascha and Rana, Ashish and Villmann, Thomas and Shaker, Ammar},
|
116 |
+
journal={arXiv preprint arXiv:2412.15499},
|
117 |
+
year={2024}
|
118 |
+
}
|
119 |
+
```
|
120 |
+
|
121 |
+
## Acknowledgements
|
122 |
+
|
123 |
+
This implementation builds upon the following excellent repositories:
|
124 |
+
|
125 |
+
- [PIPNet](https://github.com/M-Nauta/PIPNet)
|
126 |
+
- [ProtoPNet](https://github.com/cfchen-duke/ProtoPNet)
|
127 |
+
|
128 |
+
And further these repositories can be referred to as additional documentation details specified
|
129 |
+
in the above two repositories regarding the data pre-processing, data loaders,
|
130 |
+
model architectures and visualizations.
|
131 |
+
|
132 |
+
## License
|
133 |
+
|
134 |
+
This project is released under [MIT] license.
|
135 |
+
|
136 |
+
## Contact
|
137 |
+
|
138 |
+
For any questions or feedback, please:
|
139 |
+
1. Open an issue in the project [GitHub repository](https://github.com/si-cim/cbc-aaai-2025)
|
140 |
+
2. Contact the Correspondence Author
|
cars_models/convnext_model/net_end_to_end.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c8254be23e3ae224c343c2431db4892d84a595cbbda522a289f94a93d8d62983
|
3 |
+
size 112704471
|
cars_models/resnet_model/net_end_to_end.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:18c4e974907acac0f08f8ab9f9ae65025101c92002b28fdb8ab44c1f9aef8a41
|
3 |
+
size 97723283
|
cars_models/resnet_partial_model/net_end_to_end.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:70c8d7bbea99ce8f5eb26fb9ece7e450687a1dab0061eeb9ad4470dda1db7c9e
|
3 |
+
size 97723283
|
cub_models/convnext_model/net_end_to_end.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:58b9727c164ca2ee1b3dd500fbd82fb73c9fc948b91aae5181239afc7bac8f0b
|
3 |
+
size 112735383
|
cub_models/resnet_model/net_end_to_end.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:43db617c7e1823e5c4d56de026b766f69fd28ff36606929a5ee87accef516a4f
|
3 |
+
size 97795155
|
cub_models/resnet_partial_model/net_end_to_end.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4948ae9c7d2c690a4f9d008f86af6b12048ea11a9193373c88724bdf8b8aa60e
|
3 |
+
size 97795155
|
pets_models/convnext_model/net_end_to_end.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0a81e3b336b97d928b9eee0532243b3f3ca0bc475b53827ba4f2f89495d60c15
|
3 |
+
size 111579351
|
pets_models/resnet_model/net_end_to_end.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5a73b2083cce840dd076abd611c205228623cd638bf47c03a85d56c3898cad49
|
3 |
+
size 94970003
|
pets_models/resnet_partial_model/net_end_to_end.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f36c4b3179dbb6fad9219655dc98eb64667a8f162c0b73f4578e965b2d8f2460
|
3 |
+
size 94970003
|