Skip to content

Improving Performance, Robustness, and Fairness of Radiographic AI Models with Finely-Controllable Synthetic Data

License

Notifications You must be signed in to change notification settings

StanfordMIMI/RoentGen-v2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RoentGen-v2: Improving Performance, Robustness, and Fairness of Radiographic AI Models with Finely-Controllable Synthetic Data

Hugging Face arXiv License

🧨Inference with diffusers

import torch
from diffusers import DiffusionPipeline

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

pipe = DiffusionPipeline.from_pretrained("stanfordmimi/RoentGen-v2")
pipe = pipe.to(device)

prompt = "50 year old female. Normal chest radiograph."
image = pipe(prompt).images[0]

🩻 Synthetic CXR Dataset

565k synthetic chest radiographs generated with RoentGen-v2 available on HuggingFace here.

Visuals

🚀 Developer Mode

Environment Setup

Strongly recommended to create a dedicated virtual environment for this project. A requirements.txt is provided. After you install the requirements via your package manager, it is important to run pip install --upgrade torch==2.6.0 torchvision==0.21.0 torchaudio==2.6.0 xformers --index-url https://download.pytorch.org/whl/cu126. This downgrades torch in order to ensure version compatibility with monai and torchxrayvision packages. Tested and confirmed to work with wheels for cu126, cu121 and cu118.

Large-scale Inference

To run large-scale multi-gpu distributed inference, use the following commands.

Only inference, no quality check:

accelerate launch --num_processes=1 --mixed_precision bf16 \
 roentgenv2/inference_code/run_inference.py \
 --config_file="./configs/infer_config_demo.yaml"

Only inference, no quality check (multi-gpu):

accelerate launch --num_processes=4 --multi-gpu --mixed_precision bf16 \
 roentgenv2/inference_code/run_inference.py \
 --config_file="./configs/infer_config_demo.yaml"

Inference plus demographics quality check:

accelerate launch --num_processes=1 --mixed_precision bf16 \
 roentgenv2/inference_code/run_inference_w_quality_check.py \
 --config_file="./configs/infer_config_demo.yaml"

Inference plus demographics quality check (multi-gpu):

accelerate launch --num_processes=4 --multi-gpu --mixed_precision bf16 \
 roentgenv2/inference_code/run_inference_w_quality_check.py \
 --config_file="./configs/infer_config_demo.yaml"

Finetuning Instructions

In order to finetune RoentGen-v2 on your own dataset, follow the instructions below.

accelerate launch --num_processes=1 --mixed_precision bf16 \
 roentgenv2/train_code/train.py \
 --config_file="./configs/train_config_demo.yaml"

Finetuning (multi-gpu):

accelerate launch --num_processes 4 --multi_gpu --mixed_precision bf16 \
 roentgenv2/train_code/train.py \
 --config_file="./configs/train_config_demo.yaml"

📎 Citation

If you find this repository useful for your work, please cite the following paper:

@misc{moroianu2025improvingperformancerobustnessfairness,
      title={Improving Performance, Robustness, and Fairness of Radiographic AI Models with Finely-Controllable Synthetic Data}, 
      author={Stefania L. Moroianu and Christian Bluethgen and Pierre Chambon and Mehdi Cherti and Jean-Benoit Delbrouck and Magdalini Paschali and Brandon Price and Judy Gichoya and Jenia Jitsev and Curtis P. Langlotz and Akshay S. Chaudhari},
      year={2025},
      eprint={2508.16783},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2508.16783}, 
}

About

Improving Performance, Robustness, and Fairness of Radiographic AI Models with Finely-Controllable Synthetic Data

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages