Studying the Effects of Self-Attention for Medical Image Analysis

Adrit Rao, Jongchan Park, Sanghyun Woo, Joon-Young Lee, Oliver Aalami

Abstract

When the trained physician interprets medical images, they understand the clinical importance of visual features. By applying cognitive attention, they apply greater focus onto clinically relevant regions while disregarding unnecessary features. The use of computer vision to automate the classification of medical images is widely studied. However, the standard convolutional neural network (CNN) does not necessarily employ subconscious feature relevancy evaluation techniques similar to the trained medical specialist and evaluates features more generally. Self-attention mechanisms enable CNNs to focus more on semantically important regions or aggregated relevant context with long-range dependencies. By using attention, medical image analysis systems can potentially become more robust by focusing on more important clinical feature regions. In this paper, we provide a comprehensive comparison of various state-of-the-art self-attention mechanisms across multiple medical image analysis tasks. Through both quantitative and qualitative evaluations along with a clinical user-centric survey study, we aim to provide a deeper understanding of the effects of self-attention in medical computer vision tasks.

Introduction

In clinical practice, diagnostic accuracy relies on a physician's ability to apply "cognitive visual attention"—the subconscious process of prioritizing clinically significant features, such as the irregular border of a melanoma or opacities in a lung X-ray, while filtering out irrelevant background noise. Standard Convolutional Neural Networks (CNNs), while powerful, lack this inherent prioritization, often evaluating features globally without regard for clinical relevance.

This research investigates whether integrating self-attention mechanisms into CNNs can bridge this gap. By forcing models to evaluate feature relevancy in a manner more aligned with human expert cognition, we aim to improve both the diagnostic performance and the interpretability of automated medical imaging systems.

Methodology

The study employs a ResNet-18 architecture as the baseline model. To evaluate the impact of attention, the authors inject self-contained attention modules into each residual block. Three primary mechanisms are compared:

  1. Squeeze-and-Excitation (SE): Focuses on channel-wise attention by recalibrating feature channel weights using global average pooling.
  2. Convolutional Block Attention Module (CBAM): A dual-attention mechanism that sequentially computes 1D channel attention and 2D spatial attention.
  3. Global Context Network (GC): Designed to capture long-range dependencies across the entire image using a simplified non-local approach.
The Convolutional Block Attention Module (CBAM) architecture, showing the sequential application of channel and spatial attention.

The models were trained end-to-end across four diverse medical datasets to ensure the generalizability of the findings.

Datasets

The evaluation spanned four distinct imaging modalities:

  • Skin Cancer (ISIC): 3,297 images for benign vs. malignant classification.
  • Chest X-Ray (CXR): 5,863 images for pneumonia detection.
  • Brain MRI: 3,264 images for tumor identification.
  • COVID-19 CT: 812 scans for COVID-19 screening.

Results and Analysis

Quantitative Performance

The addition of attention mechanisms, particularly SE and CBAM, consistently outperformed the baseline ResNet-18. CBAM showed significant gains, notably a +6.22% improvement in AUC-ROC for the COVID-19 CT task and a +3.09% improvement for Brain MRI. Interestingly, the Global Context (GC) module often underperformed the baseline, suggesting that global feature aggregation may introduce noise when tasks require precise localization of lesions.

Qualitative Evaluation and Clinical Alignment

To assess interpretability, Grad-CAM heatmaps were generated and reviewed by medical specialists in a blind study. The results were striking: clinicians overwhelmingly preferred the heatmaps generated by the CBAM-augmented models.

Qualitative comparison of Grad-CAM heatmaps between the baseline ResNet-18 and the CBAM-augmented model on a skin lesion image.

As shown in the figure above, the baseline model often focuses on diffuse areas, whereas the CBAM model concentrates on the lesion itself, mirroring the focus of a trained dermatologist. Specialists noted that attention-augmented models successfully highlighted critical features like irregular borders and patchy consolidations, which are essential for clinical diagnosis.

Conclusion

Self-attention mechanisms, specifically those combining spatial and channel information like CBAM, serve as effective computational proxies for clinical focus. They not only enhance classification accuracy but also improve the alignment between model reasoning and human expertise. While global context mechanisms may not always be beneficial for localized medical tasks, the integration of targeted attention represents a significant step toward more robust and trustworthy medical AI. Future work will focus on validating these findings on larger, more diverse datasets and refining attention architectures specifically for medical contexts.

Summary updated

BibTeX
@inproceedings{rao2021studying,
  author = {Adrit Rao and Jongchan Park and Sanghyun Woo and Joon-Young Lee and Oliver Aalami},
  title = {{Studying the Effects of Self-Attention for Medical Image Analysis}},
  booktitle = {ICCVW},
  year = {2021},
  url = {https://openreview.net/forum?id=8Q9J2E1hSa},
}
Figure