caiyu6666 / MedIAnomaly

MedIAnomaly: A comparative study of anomaly detection in medical images

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MedIAnomaly: A comparative study of anomaly detection in medical images

This is the repository for our benchmark paper MedIAnomaly: A comparative study of anomaly detection in medical images.

Environment

  • Python 3.10
  • PyTorch 2.1.2

Data Preparation

We provide the pre-processed seven datasets.

  1. Download the pre-processed datasets from: MedIAnomaly-Data
  2. Unzip the datasets via:
tar -zxvf RSNA.tar.gz
tar -zxvf VinCXR.tar.gz
tar -zxvf BrainTumor.tar.gz
tar -zxvf LAG.tar.gz
tar -zxvf ISIC2018_Task3.tar.gz
tar -zxvf Camelyon16.tar.gz
tar -zxvf BraTS2021.tar.gz
  1. Place the MedIAnomaly-Data directory in the user's home directory, i.e., ~/MedIAnomaly-Data/. (Otherwise, you need to modify the data root in your code.)

Finally, the data path should have the following structure:

~/MedIAnomaly-Data
├─RSNA
│  ├─images
│  └─data.json
├─VinCXR
│  ├─images
│  └─data.json
├─BrainTumor
│  ├─images
│  └─data.json
├─LAG
│  ├─images
│  └─data.json
├─ISIC2018_Task3
│  ├─ISIC2018_Task3_Training_Input
│  ├─ISIC2018_Task3_Training_GroundTruth
│  ├─ISIC2018_Task3_Test_Input
│  └─ISIC2018_Task3_Test_GroundTruth
├─Camelyon16
│  ├─train
│  │  ├─good
│  ├─test
│  │  ├─good
│  └─ └─Ungood
├─BraTS2021
│  ├─train
│  ├─test
│  │  ├─normal
│  │  ├─tumor
└─ └─ └─annotation

Train & Evaluate

  • AE ($\ell_2$, $\ell_1$, SSIM, Perceptual Loss)

  • AE-Spatial

  • VAE

  • Constrained AE

  • MemAE

  • CeAE

  • GANomaly

  • AE-U

  • DAE

  • AE-Grad

  • VAE-Grad ($Grad_{ELBO}$, $Grad_{KL}$, $Grad_{rec}$, $Grad_{Combi}$)

Train and evaluate these methods via:

cd reconstruction/;
./train_eval.sh

one-stage

  • CutPaste
  • FPI
  • PII
  • NSA

Train and evaluate these methods via:

cd ssl/one_stage/;
./train_eval.sh

two-stage

  • CutPaste
  • AnatPaste
  • ResNet18-ImageNet

Train and evaluate these methods via:

cd ssl/two_stage/;
./train_eval.sh

Visualization

Acknowledgement

Some datasets and codes in this repository are based on DDAD-ASR, BMAD, NSA, CutPaste, AnatPaste. We thank the original authors for their excellent work.

Contact

If any questions, feel free to contact Yu Cai: yu.cai@connect.ust.hk.

About

MedIAnomaly: A comparative study of anomaly detection in medical images


Languages

Language:Python 99.5%Language:Shell 0.5%