Figure 1: Linear and non-linear path of the direction for adversarial attack and baseline samples. |
To better understand the output of deep neural networks (DNN), attribution based methods have been an important approach for model interpretability, which assign a score for each input dimension to indicate its importance towards the model outcome. Notably, the attribution methods use the axioms of sensitivity and implementation invariance to ensure the validity and reliability of attribution results. Yet, the existing attribution methods present challenges for effective interpretation and efficient computation. In this work, we introduce MFABA, an attribution algorithm that adheres to axioms, as a novel method for interpreting DNN. Additionally, we provide the theoretical proof and in-depth analysis for MFABA algorithm, and conduct a large scale experiment. The results demonstrate its superiority by achieving over 101.5142 times faster speed than the state-of-the-art attribution algorithms. The effectiveness of MFABA is thoroughly evaluated through the statistical analysis in comparison to other methods.
To replicate our experiments, ensure your environment meets the following prerequisites:
- Python 3.8+
- foolbox==3.3.3
- numpy==1.24.2
- pandas==1.5.3
- Pillow==9.5.0
- PyTorch==2.0.0+cu118
- torchvision==0.15.1+cu118
- tqdm==4.65.0
Complete examples are shown in example.ipynb
.Here are some sample code.
from saliency.saliency_zoo import mfaba_sharp
# Load your model
model = load_model(...)
model.to(device)
model.eval()
# Load your data
img_batch = torch.load("data/img_batch.pt") # img_batch.shape = (1000,3,224,224)
target_batch = torch.load("data/label_batch.pt") # target_batch.shape = (1000,)
# Set batch_size
batch_size = 128
attributions = [] # init attributions
# Caculate attribution
for i in range(0, len(img_batch), batch_size):
img = img_batch[i:i+batch_size].to(device)
target = target_batch[i:i+batch_size].to(device)
attributions.append(mfaba_sharp(model, img, target))
if attributions[0].shape.__len__() == 3:
attributions = [np.expand_dims(attribution, axis=0) for attribution in attributions]
attributions = np.concatenate(attributions, axis=0)
Model | Method | Insertion Score | Deletion Score | AUC |
---|---|---|---|---|
Inception-v3 | SM | 0.2792 | 0.0445 | 0.5150 |
Inception-v3 | IG | 0.3215 | 0.0445 | 0.5180 |
Inception-v3 | BIG | 0.4840 | 0.0557 | 0.5200 |
Inception-v3 | AGI | 0.4629 | 0.0590 | 0.5178 |
Inception-v3 | SMOOTH | 0.5368 | 0.0640 | 0.5389 |
Inception-v3 | SHARP | 0.5407 | 0.0627 | 0.5367 |
ResNet-50 | SM | 0.1441 | 0.0387 | 0.4714 |
ResNet-50 | IG | 0.1467 | 0.0302 | 0.4823 |
ResNet-50 | BIG | 0.2911 | 0.0485 | 0.4759 |
ResNet-50 | AGI | 0.3695 | 0.0383 | 0.4772 |
ResNet-50 | SMOOTH | 0.3211 | 0.0574 | 0.4854 |
ResNet-50 | SHARP | 0.3237 | 0.0566 | 0.4857 |
VGG16 | SM | 0.1018 | 0.0297 | 0.4257 |
VGG16 | IG | 0.0973 | 0.0249 | 0.4431 |
VGG16 | BIG | 0.2274 | 0.0390 | 0.4356 |
VGG16 | AGI | 0.2910 | 0.0320 | 0.4359 |
VGG16 | SMOOTH | 0.2808 | 0.0424 | 0.4540 |
VGG16 | SHARP | 0.2856 | 0.0410 | 0.4540 |
Dataset | Method | BIG | IG | AGI | MFABA |
---|---|---|---|---|---|
CIFAR10 | ResNet-50 | 1.35 | 24.64 | 0.14 | 136.96 |
CIFAR100 | ResNet-50 | 1.36 | 24.29 | 0.15 | 162.74 |
ImageNet | ResNet-50 | 0.37 | 6.76 | 0.28 | 51.58 |
ImageNet | EfficientNet | 0.32 | 10.42 | 0.21 | 39.97 |
For academic usage, please cite our paper:
@article{zhu2023mfaba,
title={MFABA: A More Faithful and Accelerated Boundary-based Attribution Method for Deep Neural Networks},
author={Zhu, Zhiyu and Chen, Huaming and Zhang, Jiayu and Wang, Xinyi and Jin, Zhibo and Xue, Minhui and Zhu, Dongxiao and Choo, Kim-Kwang Raymond},
journal={arXiv preprint arXiv:2312.13630},
year={2023}
}