Skip to content

Transformer-based Models for Unsupervised Anomaly Segmentation in Brain MR Images

License

Notifications You must be signed in to change notification settings

ahmedgh970/brain-anomaly-seg

Repository files navigation

Transformers for Unsupervised Anomaly Segmentation in Neuroimaging

This repository contains the code for our paper on Transformers for Unsupervised Anomaly Segmentation in Neuroimaging. If you use any of our code, please cite:

@article{ahghorbe2021,
  title = {Transformers for Unsupervised Anomaly Segmentation in Neuroimaging},
  author = {Ghorbel, Ahmed and Aldahdooh, Ahmed and Hamidouche, Wassim and Albarqouni, Shadi},
  booktitle={Medical Imaging with Deep Learning},
  year = {2022}
}

Requirements

  • Python >= 3.6

All packages used in this repository are listed in requirements.txt. To install those, run pip3 install -r requirements.txt

Folder Structure

Transformers_Unsupervised_Anomaly_Segmentation/
│
├── Transformers_Unsupervised_Anomaly_Segmentation.ipynb - Jupyter notebook to work on Google Colab
│
├── data/
│   └── data.txt  - datasets descriptions and download link
│
├── models/ - Models defining, training and evaluating
│   ├── Autoencoders/
│       ├── DCAE.py
│       └── ...
│   ├── Latent Variable models/
│       ├── VAE.py
│       └── ...
│   └── Transformer based models/
│       ├── B_TAE.py
│       └── ...
│
├── saved/  - saving folder
│
└── scripts/ - small utility scripts
    ├── utils.py
    └── ...    

Usage

All the preprocessed datasets that we utilized are available on this drive link: https://drive.google.com/file/d/11Bj7ATQtxLt7PyL3fqyyeXqNNrRqgS9K/view?usp=sharing

CLI Usage

Every model can be trained and tested individually using the scripts which are provided in the models/* folders.

Google Colab Usage

Training can be started by importing Transformers_Unsupervised_Anomaly_Segmentation.ipynb in Google Colab. This github repository is linked and can directly loaded into the notebook. However, the datasets have to be stored so that Google Colab can access them. Either uploading by a zip-file or uploading it to Google Drive and mounting the drive.

Disclaimer

Please do not hesitate to open an issue to inform of any problem you may find within this repository.

Reference

This project is inspired by the comparative study paper on Autoencoders for Unsupervised Anomaly Segmentation in Brain MR Images: A Comparative Study.

@article{baur2021autoencoders,
  title={Autoencoders for unsupervised anomaly segmentation in brain mr images: A comparative study},
  author={Baur, Christoph and Denner, Stefan and Wiestler, Benedikt and Navab, Nassir and Albarqouni, Shadi},
  journal={Medical Image Analysis},
  pages={101952},
  year={2021},
  publisher={Elsevier}
}

License

This project is licensed under the GNU General Public License v3.0. See LICENSE for more details