GithubHelp home page GithubHelp logo

chexaid's Introduction

CheXaid

This repo contains code accompaning the paper CheXaid: Deep Learning Assistance for Physician Diagnosis of Tuberculosis using Chest X-Rays in Patients with HIV.

This is a deep learning model developed by Stanford Machine Learning Group to help physicians detect Tuberculosis (TB) among patients with HIV infection using their Chest X-rays.

Table of Contents


Prerequisites

This code uses python and pytorch. Follow these steps to get started:

  1. Create a conda virtual environment:
conda env create -f environment.yml
  1. Activate the virtual environment:
conda activate chexaid
  1. If using dummy data: create dummy data dataframe:
python create_dummy_df.py

Data

By default, the training data directory is set to be dummy/, which has 128 randomly generated images. You can replace it with your own data.


Training

To train a model with the default parameters run:

python train.py

Changing trainging parameters

By default, hyperparameters for training are set in util/hypersearch.py. This script includes information about the pretrained model to use for transfer learning (checkpoint paths, number of original classes), data args (task sequence, number of the fold to train and validate on for k-fold cross validation, image transformations), model args (model to be used, list of covariates, loss function), optimizer args and logger args. More details about these can be found in args/.

Alternatively, hyperparameters can be set by adding arguments to the training command:

python train.py \
       --batch_size=64 \
       --eval_pulm=True \
       --num_epochs=10

Model Evaluation

In order to test a model that has been trained as above, the test script can be run as:

python test.py \
       --eval_pulm=True \
       --transform_classifier=False \
       --save_cams=True \
       --task_sequence=pulm \
       --ckpt_path=ckpts/new_gt_1549918027265_4CF892/iter_6656_pulm-valid_pulm_tbAUROC_0.79.pth.tar \
       --split=test

Note that the ckpt_path argument should point to the checkpoints of the evaluated model. By default, model checkpoints will be saved following the format: ckpts/new_gt_<timestamp>/<checkpoint name>.pth.tar


License

This repository is made publicly available under the MIT License.


Citing

If you are using this code, please cite our paper:

@article{rajpurkar2020chexaid,
  title = {CheXaid: deep learning assistance for physician diagnosis of tuberculosis using chest x-rays in patients with HIV},
  author = {Pranav Rajpurkar and Chloe O'Connell and Amit Schechter and Nishit Asnani and Jason Li and Amirhossein Kiani and Robyn L. Ball and Marc Mendelson and Gary Maartens and Daniël J. van Hoving and Rulan Griesel and Andrew Y. Ng and Tom H. Boyles and Matthew P. Lungren},
  journal = {npj Digital Medicine},
  volume = {3},
  number = {1},
  doi = {10.1038/s41746-020-00322-2},
  year = {2020},
  publisher = {Nature Publishing Group}
}

chexaid's People

Contributors

amitschechter avatar asnani04 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

chexaid's Issues

Could you share your dataset?

Dear authors,
We are building an AI tool for diagnosis of Covid-19, TB, other pneumonia and Normal from both CXR and CT. Our application is free. Therefore, we are collecting as many medical images as we could do.
Can you share your dataset for us?
Best regards.
Linh

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.