Spatial Attention Noise Masking for Causally Sufficient Interpretability
Authors: Benjamin Formby, Kuang-Ching Wang, D Hudson Smith
Organizations: Electrical and Computer Engineering department at Clemson University, Clemson, SC · School of Computing at Binghamton University, Binghamton, NY · Department of Mathematical and Statistical Sciences at Clemson University, Clemson, SC
We present a novel causal approach to interpretability for computer vision models that dynamically masks the input image prior to classification. The interpretability of deep learning predictions is critical in high-stakes fields such as medical imaging, security, and autonomous driving. Most interpretability methods are applied passively to already trained models, which typically result in correlational rather than causal explanations. Existing causal interpretability methods are limited to post hoc analysis, weakening the causal claims. Additionally, existing active methods generally lack explanations that explicitly assign responsibility to input features. This work proposes a spatial attention noise masking framework that provides causal explanations about the features sufficient for the prediction. The proposed framework consists of: 1) a UNet-style mask generator, and 2) a Resnet18 encoder and linear classifier that classifies both masked and unmasked versions of an input image. The generated masks are regularized to be sparse and spatially smooth, while masked image embeddings are constrained to remain consistent with embeddings from the corresponding unmasked images. The resulting masks can be interpreted as feature attribution maps that are competitive with related interpretability methods while additionally providing strong causal explanations of model predictions. Quantitative evaluations demonstrate mask faithfulness, near-baseline classification performance across five classification tasks despite substantial masking of image information, and robustness to distribution shifts such as background swapping and natural adversarial examples. Qualitative comparisons further demonstrate mask behavior and competitive interpretability relative to state-of-the-art feature attribution methods.
Figures & tables
Fig. 1 : This work proposes a spatial attention noise mask that provides causal explanations of model predictions. We achieve this by generating a mask with image-specific noise added to the masked regions and then applying it to the input image before classification. The classifier is trained on masked and unmasked versions of an input image. The generated masks are regularized to be sparse and spatially smooth, while masked image embeddings are constrained to remain consistent with embeddings from the corresponding unmasked images.
Fig. 2 : Example images from ImageNet-1k and CIFAR-100 with the corresponding SANM and four other feature attribution methods. Our masks tend to include the same regions highlighted by the other attribution maps, as well as additional regions. This is potentially caused by our masks being generated before classification, whereas the other attribution maps are generated post hoc and conditioned on a target class.
Fig. 3 : Example images from three medical imaging modalities in RadImageNet with the corresponding SANM and four other feature attribution methods. Our SANM provides a sharper structure than other methods but may require task-dependent sparsity tuning, since the sparsity constraint is largely satisfied by the amount of black background in many of these medical images.
Dataset
Total Images
Classes
Channels
Image Size
CIFAR-100
60k
100
3
32x32
ImageNet-1k
1.2M
1000
3
224x224
RadImageNet-Lung CT
152k
6
1
224x224
RadImageNet-Brain MRI
44k
10
1
224x224
RadImageNet-Abdomen/Pelvis US
297k
13
1
224x224
TABLE I : Dataset statistics showing total images, classes, channels, and image size.
Dataset
Model
Top-1 Accuracy (%)
Top-K Accuracy (%)
CIFAR-100
Baseline
75.47 (-)
89.70 (-)
Ours (unmasked)
73.81 (-1.66)
88.80 (-0.90)
Ours (masked)
67.04 (-8.43)
83.85 (-5.85)
ImageNet-1k
Baseline
70.22 (-)
89.62 (-)
Ours (unmasked)
69.76 (-0.46)
89.31 (-0.31)
Ours (masked)
68.02 (-2.20)
88.16 (-1.46)
TABLE II : Top-1 Accuracy and Top-K Accuracy for each dataset. All datasets use k=3 except ImageNet-1k uses k=5.
Fig. 4 : Average insertion (blue) and deletion (red) curves of the proposed masks (solid line) compared with the Occlusion method (dotted line) across 500 samples. The dashed black line shows the average mask pixel intensity of the inserted pixels.
Fig. 5 : Selected examples demonstrating the final rise of the insertion curve shown in Figure 4 . Shown are the input images with corresponding masks, insertion curves, and visualization of binned pixels in order of importance based on the mask, where the dark blue represents the most important and bright yellow represents the least important pixels.
Model
Insertion AUC (%)
Deletion AUC (%)
Occlusion Baseline
57.20
18.66
Ours
57.46
16.01
TABLE III : Area under the insertion curve and the deletion curve (AUC) for our masks compared to Occlusion on our model’s classifier.
Model
ImageNet-A (%)
ImageNet-1k Background Swap (%)
Baseline
1.98
57.23
Ours (unmasked)
1.87
57.31
Ours (masked)
2.09
59.97
TABLE IV : Top-1 Accuracy of ImageNet-A and ImageNet-1k with background swapping using segmentations from ImageNet-S.
Fig. 6 : Selected example images and model predictions of background-swapped ImageNet-1k experiment. The baseline was often influenced by background, leading to misclassification, whereas the masked prediction maintained the correct prediction.
Loss Terms
Sparsity
Smoothness
Consistency
Masked Classification
Unmasked Classification
Unmasked (% Acc)
Masked (% Acc)
Insertion AUC
Only Classification
✓
✓
75.00
75.03
27.81
No Sparsity
✓
✓
✓
✓
74.92
74.92
27.35
No Smoothness
✓
✓
✓
✓
74.60
67.33
58.88
No Consistency
✓
✓
✓
✓
72.98
65.26
59.16
No Masked Classification
✓
✓
✓
✓
72.63
61.26
58.61
All
✓
✓
✓
✓
✓
73.81
67.19
61.06
TABLE V : Unmasked and masked classification accuracies and area under the insertion curve (AUC) for the ablation study of loss terms on CIFAR-100. Bold values represent the optimal balance of interpretability and performance for both masked and unmasked classification accuracy.
Fig. 7 : Resulting masks from ablation study of loss terms on CIFAR-100. Removing the sparsity loss provides no interpretability and produces uniform white masks. Smoothness loss removes high-frequency noise while maintaining structure. Consistency and masked classification losses have a smaller visual effect on masks, but improve classification performance (see Table V ).
DAVID Lab, UVSQ, Paris-Saclay University, Versailles, France · LIPN, UMR CNRS 7030, Sorbonne Paris Nord University, Villetaneuse, France · LISN, Paris-Saclay University, Saclay, France