Giter Club home page Giter Club logo

cxr-clip's Introduction

KakaoBrain

CXR-CLIP

This is an official Pytorch Implementation of "CXR-CLIP: Toward Large Scale Chest X-ray Language-Image Pre-training" [arxiv]

Environment setup

We have experimented the implementation on the following enviornment.

  • Pytorch 1.12
  • CUDA 11
pip install -r requirements.txt

Prepare dataset

Datasets we used are as follows:

Dataset Download Comment
MIMIC-CXR Link official split
CheXpert Link official split for train and val, and chexpert_5x200 from GLoRIA for test
ChestX-ray14 Link not used for test
VinDr-CXR Link official split for test, and random split for train and val
RSNA-Pneumonia Link same split as GLoRIA
SIIM-Pneumothorax Link same split as GLoRIA
OpenI Link all frontal images are used for evaluation

For more details, please refer to data preparation.

Pre-trained model checkpoint

We trained Resnet50 and SwinTiny models with three dataset compositions.
MIMIC-CXR (M), MIMIC-CXR + CheXpert (M,C), MIMIC-CXR + CheXpert + ChestX-ray14 (M,C,C14)

model / dataset M M,C M,C,C14
ResNet50 Link Link Link
SwinTiny Link Link Link

Pre-Train model

command line

  • single gpu
    python train.py {--config-name default_config}
  • multi gpu
    torchrun --nproc_per_node=4 --nnodes=1 --node_rank=0 --master_addr=127.0.0.1 --master_port=45678 train.py {--config-name default_config}

Evaluation

Zero-shot Evaluation

  • Zero-shot classification
    • perform zero-shot and image-text retrieval evaluation on ( vindr_cxr, rsna_pneumonia, siim_pneumothorax, chexpert5x200, mimic_cxr, openi )
    python evaluate_clip.py test.checkpoint=${CKPT_PATH/model-best.tar}

Fine-tuned Classifier (linear probing)

  • on rsna_pneumonia
# train
python finetune.py --config-name finetune_10 hydra.run.dir=${SAVE_DIR} data_train=rsna_pneumonia data_valid=rsna_pneumonia model.load_backbone_weights=${CKPT_PATH/model-best.tar} # 10%
python finetune.py hydra.run.dir=${SAVE_DIR} data_train=rsna_pneumonia data_valid=rsna_pneumonia model.load_backbone_weights=${CKPT_PATH/model-best.tar} # 100%
# evaluate
python evaluate_finetune.py data_test=rsna_pneumonia test.checkpoint=${FINETUNED_CKPT_PATH/model-best.tar}
  • on siim_pneumothorax
# train
python finetune.py --config-name finetune_10 hydra.run.dir=${SAVE_DIR} data_train=siim_pneumothorax data_valid=siim_pneumothorax model.load_backbone_weights=${CKPT_PATH/model-best.tar} # 10%
python finetune.py hydra.run.dir=${SAVE_DIR} data_train=siim_pneumothorax data_valid=siim_pneumothorax model.load_backbone_weights=${CKPT_PATH/model-best.tar} # 100%
# evaluate
python evaluate_finetune.py data_test=siim_pneumothorax test.checkpoint=${FINETUNED_CKPT_PATH/model-best.tar}
  • on vindr_cxr
# train
python finetune.py --config-name finetune_10 hydra.run.dir=${SAVE_DIR} data_train=vindr_cxr data_valid=vindr_cxr model.load_backbone_weights=${CKPT_PATH/model-best.tar} # 10%
python finetune.py hydra.run.dir=${SAVE_DIR} data_train=vindr_cxr data_valid=vindr_cxr model.load_backbone_weights=${CKPT_PATH/model-best.tar} # 100%
# evaluate
python evaluate_finetune.py data_test=vindr_cxr test.checkpoint=${FINETUNED_CKPT_PATH/model-best.tar}

Citation

@incollection{You_2023,
	doi = {10.1007/978-3-031-43895-0_10},
	url = {https://doi.org/10.1007%2F978-3-031-43895-0_10},
	year = 2023,
	publisher = {Springer Nature Switzerland},
	pages = {101--111},
	author = {Kihyun You and Jawook Gu and Jiyeon Ham and Beomhee Park and Jiho Kim and Eun K. Hong and Woonhyuk Baek and Byungseok Roh},
	title="CXR-CLIP: Toward Large Scale Chest X-ray Language-Image Pre-training",
	booktitle="Medical Image Computing and Computer Assisted Intervention -- MICCAI 2023",
}

License

CXR-CLIP: Toward Large Scale Chest X-ray Language-Image Pre-training © 2023 is licensed under CC BY-NC 4.0

Contact for Issues

Kihyun You, [email protected]
Jawook Gu, [email protected]

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.