/GenAI_UAD

Evaluation of normative learning or generative AI methods for Unsupervised Anomaly Detection

Primary LanguagePythonGNU General Public License v3.0GPL-3.0


Evaluating Normative Learning in Generative AI for Robust Medical Anomaly Detection

Cosmin BerceaBenedikt WiestlerDaniel Rueckert Julia A. Schnabel

Official repository of the paper

Under Review

Citation

If you find our work useful, please cite our paper:

@article{bercea2023evaluating,
  title={Evaluating Normative Learning in Generative AI for Robust Medical Anomaly Detection},
  author={Bercea, Cosmin and Wiestler, Benedikt and Rueckert, Daniel and Schnabel, Julia},
  year={2023}
}

Abstract: In Generative Artificial Intelligence (AI) for medical imaging, normative learning involves training AI models on large datasets of typical images from healthy volunteers, such as MRIs or CT scans. These models acquire the distribution of normal anatomical structures, allowing them to effectively detect and correct anomalies in new, unseen pathological data. This approach allows the detection of unknown pathologies without the need for expert labeling. Traditional anomaly detection methods often evaluate the anomaly detection performance, overlooking the crucial role of normative learning. In our analysis, we introduce novel metrics, specifically designed to evaluate this facet in AI models. We apply these metrics across various generative AI frameworks, including advanced diffusion models, and rigorously test them against complex and diverse brain pathologies. Our analysis demonstrates that models proficient in normative learning exhibit exceptional versatility, adeptly detecting a wide range of unseen medical conditions.

Setup and Run

The code is based on the deep learning framework from the Institute of Machine Learning in Biomedical Imaging: https://github.com/compai-lab/iml-dl

Framework Overview

Sign up for a free account and login to your wandb account.

wandb login

Paste the API key from https://wandb.ai/authorize when prompted.

2). Clone repository

git clone https://github.com/ci-ber/GenAI_UAD.git
cd GenAI_UAD

3). Install PyTorch

Optional create virtual env:

conda create --name genai python=3.8.0
conda activate genai

Example installation:

  • with cuda:
pip3 install torch==1.9.1+cu111 torchvision==0.10.1+cu111 -f https://download.pytorch.org/whl/torch_stable.html
  • w/o cuda:
pip3 install torch==1.9.1 torchvision==0.10.1 -f https://download.pytorch.org/whl/torch_stable.html

4). Install requirements

pip install -r pip_requirements.txt

5). Download datasets

Move the datasets to the target locations. You can find detailed information about the expected files and locations in the corresponding *.csv files under data/$DATASET/splits.

Alternatively train from scratch on other anatomies and modalities.

6). Run the pipeline

Run the main script with the corresponding config like this:

python core/Main.py --config_path ./projects/24_normative_eval/autoddpm.yaml

Refer to the autoddpm.yaml (or other_metho.yaml) for the default configuration.

That's it, enjoy! 🚀