Towards Continual Visual Anomaly Detection in the Medical Domain

Manuel Barusco, Francesco Borsatti, Nicola Beda, Davide Dalle Pezze, Gian Antonio Susto

Introduction

Visual Anomaly Detection (VAD) serves as a critical tool in medical imaging, functioning as a "one-class" classification problem where models are trained exclusively on "normal" data to identify pathological deviations. However, traditional VAD models are inherently static. In clinical environments, data is dynamic: new imaging modalities, different organs, and updated hardware are introduced over time.

Updating a standard model with new data via naive Fine-Tuning typically results in Catastrophic Forgetting, where the model loses its ability to detect anomalies in previously learned domains. Conversely, Joint Training—retraining on the entire cumulative dataset—is often prohibited by data privacy regulations (e.g., GDPR, HIPAA) and the prohibitive computational costs of managing ever-expanding datasets. This research introduces PatchCoreCL, a continual learning framework designed to enable medical VAD models to become "lifelong learners."

Methodology: PatchCoreCL

The researchers adapted the PatchCore algorithm into a continual version, PatchCoreCL. The architecture relies on a frozen, pre-trained CNN backbone (such as WideResNet50) to extract local feature patches. By keeping the backbone weights frozen, the model avoids the weight-drift that typically drives forgetting in deep neural networks.

The core innovation lies in the management of the Memory Bank. PatchCoreCL stores representative "normal" features to compare against during inference. To prevent the memory bank from growing indefinitely, the authors implement Coreset Subsampling. As new tasks are introduced, the model generates a new memory bank while simultaneously reducing the size of existing banks for previous tasks. This strategy maintains a fixed total memory footprint while preserving the most informative features across all tasks.

The PatchCoreCL framework utilizes coreset subsampling to manage memory banks across sequential tasks.

Experimental Setup and Datasets

The framework was evaluated using the Benchmarks for Medical Anomaly Detection (BMAD) dataset, comprising six distinct tasks:

  1. Brain_AD (MRI)
  2. Liver_AD (CT)
  3. Retina_RESC_AD (Fundus photography)
  4. Chest_AD (X-ray)
  5. Histopathology_AD (Microscopy)
  6. Retina_OCT2017_AD (Optical Coherence Tomography)

These tasks provide a rigorous test for cross-domain stability, with the first three tasks including pixel-level annotations for evaluating lesion localization.

Key Results and Discussion

The performance of PatchCoreCL was compared against several baselines, including Multi-Model (individual models per task), Joint-Train (the upper bound), and Fine-Tuning.

Minimal Forgetting and Performance Stability

PatchCoreCL-30k demonstrated exceptional stability, with an Average Forgetting value of only 0.73%. In contrast, standard Fine-Tuning experienced a performance collapse, with a 52.32% drop as it progressed through the task sequence. As shown in the figure below, PatchCoreCL maintains a high F1 score across the task index, closely tracking the Joint-Train baseline, whereas Fine-Tuning performance degrades rapidly.

Image-level F1 Score across sequential tasks, comparing PatchCoreCL variants against Fine-Tuning and Joint-Train baselines.

Efficiency and Localization

Even with a reduced memory budget (PatchCoreCL-10k), the model remained highly competitive. Furthermore, the model's ability to localize anomalies remained robust, maintaining high AUROC and AUPRO scores at the pixel level. A notable byproduct of the multi-bank approach is implicit task identification; by comparing a test sample against all stored banks, the bank yielding the lowest anomaly score typically identifies the correct domain.

Conclusion

This work establishes a strong baseline for Continual Learning in medical VAD. By leveraging frozen feature extractors and intelligent coreset subsampling, PatchCoreCL achieves performance near the theoretical upper bound of Joint Training without the associated privacy or storage burdens. Future research may explore adapting this approach to more complex architectures like Normalizing Flows or Transformers, as well as investigating performance under more subtle, fine-grained domain shifts within the same organ types.

The code for this project has been integrated into the MoViAD library to support further community research.

Summary updated

BibTeX
@misc{barusco2025towards,
  author = {Manuel Barusco and Francesco Borsatti and Nicola Beda and Davide Dalle Pezze and Gian Antonio Susto},
  title = {{Towards Continual Visual Anomaly Detection in the Medical Domain}},
  year = {2025},
  eprint = {2508.18013},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2508.18013},
}
Figure