Abstract
Anomaly detection (AD) in medical imaging is a critical yet challenging task due to the high variability of pathologies and the scarcity of labeled data. While foundation models like CLIP have shown promise in natural image tasks, their application to the medical domain is hindered by a significant domain gap. This paper introduces MadCLIP, a novel few-shot medical anomaly detection framework that adapts the pre-trained CLIP model using a dual-branch architecture and learnable text prompts. By modeling normal and abnormal distributions separately and utilizing the SigLIP loss for enhanced image-text alignment, MadCLIP achieves state-of-the-art performance across diverse medical modalities without requiring synthetic data or memory-intensive feature banks.
Introduction
Anomaly detection in medical imaging—identifying everything from tumors in MRIs to lesions in retinal scans—is a high-stakes task where missing a pattern can have severe clinical consequences. However, AD faces two major hurdles:
- The Definition Gap: There is no universal definition of an "anomaly"; it varies significantly across different organs and imaging modalities.
- The Data Scarcity Gap: Unsupervised methods require massive amounts of "normal" data, while supervised methods require many labeled "abnormal" examples, which are often rare.
Foundation models like CLIP (Contrastive Language-Image Pre-training) offer a potential solution, but they are primarily trained on natural images. When applied directly to medical scans, they struggle due to the massive domain gap. Existing attempts to adapt CLIP often rely on "memory banks" of features or the generation of synthetic anomalies, which can be computationally expensive or fail to generalize to real-world pathology.
Methodology
MadCLIP addresses these challenges through three key architectural innovations:
Dual-Branch Architecture
Instead of a single general encoder, MadCLIP utilizes two specialized branches within the CLIP vision encoder. One branch is dedicated to capturing "normality" features, while the other focuses on "abnormality." These branches exchange signals to create a sharper contrast between healthy and diseased tissue, allowing the model to calculate anomaly scores by subtracting the normality signal from the abnormality signal.
Multi-Level Adapters
To avoid the computational cost of fine-tuning the entire CLIP model, MadCLIP inserts small, learnable "adapters" at specific layers (6, 12, 18, and 24). These adapters perform two functions: first, they bridge the domain gap from natural to medical images; second, they specialize features for either Anomaly Classification (AC) or pixel-level Anomaly Segmentation (AS).
Learnable Prompts and SigLIP Loss
MadCLIP replaces rigid text templates (e.g., "a photo of a [CLS]") with learnable token embeddings. Crucially, the authors replace the standard CLIP loss with SigLIP loss. While the original CLIP loss assumes a one-to-one mapping between images and text, SigLIP handles "many-to-one" relationships more effectively. This is ideal for medical AD, where many different images may all map to the same "abnormal" text prompt.
Experimental Results
MadCLIP was validated on a comprehensive benchmark spanning five modalities and six datasets, including Brain MRI (BraTS 2021), Liver CT (LiTS), Retinal OCT (OCT17, RESC), Chest X-ray (NIH ChestX-ray8), and Digital Histopathology (HIS).
Performance and Generalization
MadCLIP consistently outperformed state-of-the-art (SOTA) methods like MVFA and MediCLIP:
- Overall Performance: It achieved an average improvement of 3.5% in Anomaly Classification and 0.22% in Anomaly Segmentation over previous best methods.
- Extreme Few-Shot Learning: In scenarios with only two normal and two abnormal samples for training, MadCLIP outperformed competitors in 7 out of 9 test cases.
- Cross-Dataset Evaluation: To test generalization, the model was trained on one dataset and tested on another (e.g., CheXpert or ADNI). MadCLIP reached an average AUC of 76.12%, significantly higher than the previous SOTA of 74.53%.
Discussion and Conclusion
MadCLIP demonstrates that a dual-branch approach combined with SigLIP loss can effectively bridge the domain gap for medical anomaly detection. By avoiding the need for synthetic data or large memory banks, the model remains robust to unseen diseases and computationally efficient.
While the adapters successfully bridge the domain gap, the authors note that the "modality gap" (the fundamental difference between an MRI and a CT scan) remains an area for further exploration. Future work will investigate the zero-shot potential of MadCLIP and expand the framework to handle multi-modal AD, where a single model could process diverse anatomical regions and imaging types simultaneously.
Summary updated