Attribution Quality
This package was designed to both generate explanations for deep learning segmentation models as well as to provide comprehensive metrics for evaluating new explanation methods.
We have included our novel explanation method, Kernel-Weighted Contribution, as well as a number of other XAI methods adapted for use with segmentation models. With the additional use of our explanation ground-truth dataset, we can evaluate the quality of these methods and provide a comprehensive comparison of their performance.
Startup Instructions
Note - We use mamba to install packages, but you can use conda in the same way if you prefer.
- Install
attribution_qualityrequirements- Either install torch or build from source
mamba install -c conda-forge numpy scikit-image tqdm
- Install
attribution_quality- METHOD 1 (recommended)
pip install attribution_quality --no-deps
- METHOD 2 (for local development)
git clone git@github.com:Mullans/AttributionQuality.gitcd AttributionQualitypip install -e . --no-deps
- METHOD 1 (recommended)
- (Optional) Install SimpleITK and matplotlib for the example notebooks and for some evaluation metrics
mamba install -c simpleitk -c conda-forge simpleitk matplotlib
nnUNet Setup Instructions (optional)
Note: We used nnUNet for the experiments described in our paper. You can skip this section unless you want to reproduce our results.
- Install nnUNet requirements
mamba install -c conda-forge -c simpleitk dicom2nifti medpy scikit-learn simpleitk pandas nibabel matplotlibpip install batchgenerators
- Install nnUNet v1
git clone -b nnunetv1 --single-branch git@github.com:MIC-DKFZ/nnUNet.gitcd nnunetpip install -e . --no-deps
- Finish setting up nnUNet
- Set
nnUNet_raw_data_base,nnUNet_preprocessed, andRESULTS_FOLDERenvironment variables
- Set
Attribution Quality Example Notebooks
examples/SingleLayer_Example.ipynb- Example Jupyter notebook showing how to use this package to generate explanations for a single layer of a segmentation modelexamples/Full_KWC_Example.ipynb- Example Jupyter notebook showing how to run Kernel-Weighted Contribution on all layers of a segmentation model and evaluate the resulting attribution map
Currently included methods of explanation:
| Kernel-Weighted Contribution | ScoreCAM | |
| GradCAM | GradCAM++ | LayerCAM |
| XGradCAM | Element-wise GradCAM | HiResCAM |
Metadata
Release files for attribution-quality 1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| attribution_quality-1.0.tar.gz | 314.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| attribution_quality-1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 343.3 kB
Release files / attribution_quality-1.0.tar.gz
| Download URL | attribution_quality-1.0.tar.gz |
|---|---|
| Size | 314.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8d0bab7ac383c5509079ddee245244d6374e14a534327d2dc1b53d0209911d61
|
|
BLAKE2b-256 checksum How to use checksums |
e3a412aecebb5c7992f88aa99421332bafd76cd3414cfc9a74fc961e5143851d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / attribution_quality-1.0-py3-none-any.whl
| Download URL | attribution_quality-1.0-py3-none-any.whl |
|---|---|
| Size | 29.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f3f38eeb4048380cad328f838418976f8c0c1402e9c8eabf0ab94c2b1015a7cf
|
|
BLAKE2b-256 checksum How to use checksums |
29f809f52e843a1c8c001dc158d809700f052bdb40322ad33596def9f2ecb792
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|