Coder Social home page Coder Social logo

iolag / upd_study Goto Github PK

View Code? Open in Web Editor NEW
22.0 2.0 6.0 684.99 MB

This repository contains code from our comparative study on state of the art unsupervised pathology detection and segmentation methods.

Python 84.29% Shell 15.71%
anomaly-detection anomaly-detection-models anomaly-localization anomaly-segmentation brain-mri chest-xray-images retinal-fundus-images deep-learning

upd_study's Introduction

Official Repository of: "Unsupervised Pathology Detection: A Deep Dive Into the State of the Art"

This repository contains code to reproduce experiments from the paper "Unsupervised Pathology Detection: A Deep Dive Into the State of the Art" (arXiv preprint).

In this work, we perform a comprehensive evaluation of the state of the art in unsupervised pathology detection. We find that recent feature-modeling methods achieve increased performance compared to previous work and are capable of benefiting from recently developed self-supervised pre-training algorithms, further increasing their performance.

Citation

If you find our work useful for your research, please consider citing:

@ARTICLE{10197302,
  author={Lagogiannis, Ioannis and Meissen, Felix and Kaissis, Georgios and Rueckert, Daniel},
  journal={IEEE Transactions on Medical Imaging}, 
  title={Unsupervised Pathology Detection: A Deep Dive Into the State of the Art}, 
  year={2024},
  volume={43},
  number={1},
  pages={241-252},
  doi={10.1109/TMI.2023.3298093}}

Usage

Download this repository by running

git clone https://github.com/iolag/UPD_study/

in your terminal.

Environment

Create and activate the Anaconda environment:

conda env create -f environment.yml
conda activate upd

Additionally, you need to install the repository as a package:

python3 -m pip install --editable .

To be able to use Weights & Biases for logging follow the instructions at https://docs.wandb.ai/quickstart.

Data

CheXpert

To download CheXpert you must first register at https://stanfordmlgroup.github.io/competitions/chexpert/. After you receive the subscription confirmation e-mail, download the downsampled version (11G) and extract the CheXpert-v1.0-small folder in data/datasets/CXR. No other steps are required and all splits are provided.

Update 12/12/23

It seems that the small version of the dataset isn't available from the official source anymore. You can find it in Kaggle.

DDR

To download and prepare the DDR dataset, run:

bash UPD_study/data/data_preprocessing/prepare_DDR.sh

MRI: CamCAN, ATLAS, BraTS

To download and preprocess ATLAS and BraTS, first download ROBEX from https://www.nitrc.org/projects/robex and extract it in data/data_preprocessing/ROBEX. Then run:

bash UPD_study/data/data_preprocessing/prepare_ATLAS.sh
bash UPD_study/data/data_preprocessing/prepare_BraTS.sh

For ATLAS you need to apply for the data at https://fcon_1000.projects.nitrc.org/indi/retro/atlas.html and receive the encryption password. During the run of prepare_ATLAS.sh you will be prompted to input the password.

For BraTS, Kaggle's API will be used to download the data. To be able to interact with the API, follow the instructions at https://www.kaggle.com/docs/api.

To download the CamCAN data, you need to apply for it at https://camcan-archive.mrc-cbu.cam.ac.uk/dataaccess/index.php. After you download them, put them in data/datasets/MRI/CamCAN and run:

python UPD_study/data/data_preprocessing/prepare_data.py --dataset CamCAN

Experiments

To generate the "Main Results" from Tables 1 and 3 over all three seeds run:

bash UPD_study/experiments/main.sh 

Alternatively, for a single seed run:

bash UPD_study/experiments/main_seed10.sh 

To generate the "Self-Supervised Pre-training" results from Tables 2 and 4 over all three seeds run:

bash UPD_study/experiments/pretrained.sh

Alternatively, for a single seed run:

bash UPD_study/experiments/pretrained_seed10.sh      

To generate the "Complexity Analysis" results from Table 5 run:

bash UPD_study/experiments/benchmarks.sh

To generate "The Effects of Limited Training Data" results from Fig. 3 run:

bash UPD_study/experiments/percentage.sh

The repository contains PyTorch implementations for VAE, r-VAE, f-AnoGAN, H-TAE-S, FAE, PaDiM, CFLOW-AD, RD, ExpVAE, AMCons, PII, DAE and CutPaste.

A )

If you face any issues or have any suggestions do not hesitate to contact me or open an issue.

upd_study's People

Contributors

iolag avatar matt-baugh avatar snavalm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

upd_study's Issues

Questions about computing dice

Thanks for your great work. I have a question about computing dice in this code.

In utilies/metrics.py, function compute_best_dice() concatenates all the testing samples together to compute the dice score, instead of computing the dice of each sample one by one.

I am wondering whether this operation is reasonable as the dice score is usually caculated for each case seperately. Thanks.

Performance on the MVTec dataset

Hello,

Have you evaluated these methods using the MVTec dataset? I attempted to use your code on the MVTec dataset, but the outcomes were significantly inferior compared to those documented in the original paper. Specifically, the AUC for most methods was about 0.5-0.8 after 2000 training steps, except the method RD and DFR.

I used the following command. I changed the small testing set in your code to the complete testing set and observed the anom_val/sample-auroc in the wandb.
UPD_study/models/H-TAE-S/HTAEStrainer.py --shuffle t -ev t -mod MyData --percentage 100 --eval False --seed 10 --val_frequency 200 --log_frequency 200 --anom_val_frequency 200

Is there any problem with my usage? Look forward to your reply.

Thank you in advance!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.