Skip to content

jason-wang24/MedIAnomaly

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 our pre-processed datasets from: MedIAnomaly-Data
  2. Download the ISIC2018_Task3_Training, ISIC2018_Task3_Test, and their ground truth from ISIC2018
  3. 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

[Reproduce the results in AE4AD] Train and evaluate AE with different latent size via:

cd reconstruction/;
./train_eval_latent_size.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 raise an issue or contact Yu Cai: yu.cai@connect.ust.hk.

Citation

@article{cai2024medianomaly,
  title={MedIAnomaly: A comparative study of anomaly detection in medical images},
  author={Cai, Yu and Zhang, Weiwen and Chen, Hao and Cheng, Kwang-Ting},
  journal={arXiv preprint arXiv:2404.04518},
  year={2024}
}
@inproceedings{cai2024rethinking,
  title={Rethinking autoencoders for medical anomaly detection from a theoretical perspective},
  author={Cai, Yu and Chen, Hao and Cheng, Kwang-Ting},
  booktitle={International Conference on Medical Image Computing and Computer-Assisted Intervention},
  pages={544--554},
  year={2024},
  organization={Springer}
}

About

[MedIA 2025] MedIAnomaly: A comparative study of anomaly detection in medical images

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 99.4%
  • Shell 0.6%