MedIAnomaly
MedIAnomaly copied to clipboard
MedIAnomaly: A comparative study of anomaly detection in medical images
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.
- Download the pre-processed datasets from: MedIAnomaly-Data
- 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
- 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
Reconstruction-baed methods
-
[x] AE ($\ell_2$, $\ell_1$, SSIM, Perceptual Loss)
-
[x] AE-Spatial
-
[x] VAE
-
[x] Constrained AE
-
[x] MemAE
-
[x] CeAE
-
[x] GANomaly
-
[x] AE-U
-
[x] DAE
-
[x] AE-Grad
-
[x] VAE-Grad ($Grad_{ELBO}$, $Grad_{KL}$, $Grad_{rec}$, $Grad_{Combi}$)
Train and evaluate these methods via:
cd reconstruction/;
./train_eval.sh
SSL-based methods
one-stage
- [x] CutPaste
- [x] FPI
- [x] PII
- [x] NSA
Train and evaluate these methods via:
cd ssl/one_stage/;
./train_eval.sh
two-stage
- [x] CutPaste
- [x] AnatPaste
- [x] 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: [email protected].