Adapting Visual-Language Models for Generalizable Anomaly Detection in Medical Images

Chaoqin Huang, Aofan Jiang, Jinghao Feng, Ya Zhang, Xinchao Wang, Yanfeng Wang

Introduction

Anomaly detection (AD) in medical imaging is a high-stakes task where missing subtle patterns can lead to misdiagnosis. However, building a "universal" medical AD model is exceptionally difficult due to two major hurdles: the Domain Gap and the Task Gap. Large-scale models like CLIP are pre-trained on billions of natural images (e.g., cats and dogs), making their visual features fundamentally different from those needed to spot lesions in a liver CT scan. Furthermore, standard vision models focus on object semantics ("what is this?"), whereas AD requires focusing on irregularities ("what is wrong here?").

To bridge these gaps, researchers have developed MVFA-AD, a framework that successfully "repurposes" the CLIP visual-language model. By using a multi-level adaptation strategy, the model achieves state-of-the-art performance in identifying and segmenting abnormalities across diverse medical modalities—such as X-rays and MRIs—even when it hasn't seen those specific anatomical regions during training.

Methodology: Multi-level Visual Feature Adaptation

The authors introduce the Multi-level Visual Feature Adaptation (MVFA) framework. Instead of just using the final output of the CLIP visual encoder, they tap into multiple stages of the model to capture anomalies at vastly different scales, from massive tumors to tiny cellular irregularities.

The MVFA architecture detailing the multi-level visual feature adapters, alignment process, and the two-branch testing strategy.

Key Architectural Innovations:

  • Residual Adapters: Lightweight "bottleneck" linear layers are inserted into the pre-trained visual encoder. These adapters are "residual," meaning they learn to slightly tweak existing features rather than replacing them, preserving the model's foundational knowledge while recalibrating its focus toward medical anomalies.
  • Dual-Adapter Architecture: To handle both Anomaly Classification (AC)—identifying if the whole image is abnormal—and Anomaly Segmentation (AS)—localizing the abnormality—the framework uses a dual-path approach at each level to capture both global and local features.
  • Visual-Language Alignment: The model is trained using text prompts (e.g., "a photo of a flawless [organ]" vs. "a photo of a damaged [organ]"). A specialized loss function aligns visual features with these textual descriptions.
  • Two-Branch Testing: During inference, the model combines a Zero-Shot Branch (comparing images to text prompts) and a Few-Shot Branch (comparing the test image to a small "memory bank" of known normal images).

Experimental Setup and Datasets

The study utilizes the BMAD (Benchmarks for Medical Anomaly Detection), which includes five distinct modalities and anatomical regions: Brain MRI (BraTS2021), Liver CT (BTCV + LiTs), Retinal OCT (RESC and OCT17), Chest X-ray (RSNA), and Digital Histopathology (HIS). These datasets provide a rigorous test of "out-of-domain" generalization, as the model is often tested on modalities it never encountered during its adaptation phase.

Key Results and Performance

The MVFA-AD framework set new benchmarks across all tested modalities, demonstrating superior accuracy and robustness compared to existing methods.

Performance curves showing AUC (%) across different medical imaging modalities and shot counts, highlighting the superiority of the MVFA-AD approach.

Key Findings:

  • Superior Accuracy: In few-shot settings (using only 4 normal images for reference), MVFA-AD achieved an average AUC improvement of 7.33% for classification and 2.37% for segmentation over previous state-of-the-art models like April-GAN.
  • Zero-Shot Generalization: Even without seeing a single example of a specific modality (e.g., testing on Retinal OCT after training on Brain and Liver data), the model outperformed competitors by significant margins.
  • Adapters vs. Projectors: The research demonstrates that "adapting" the internal layers of the encoder is far more effective for bridging the domain gap than simply "projecting" the final CLIP features into a new space.

Conclusion and Future Work

MVFA-AD represents a significant advancement in generalizable medical anomaly detection. By effectively adapting large-scale vision-language models, the framework provides a robust solution for diverse clinical settings where data for rare anomalies is scarce. Future research will explore incorporating specific clinical knowledge into text prompts and optimizing the memory bank search to reduce computational overhead for real-time clinical use.

Summary updated

BibTeX
@inproceedings{huang2024adapting,
  author = {Chaoqin Huang and Aofan Jiang and Jinghao Feng and Ya Zhang and Xinchao Wang and Yanfeng Wang},
  title = {{Adapting Visual-Language Models for Generalizable Anomaly Detection in Medical Images}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2024},
}
Figure