End-to-end fine-tuned Stable Diffusion 2.1 generator for COVID-19 chest CT slices,
conditioned on demographics through the text prompt. Main generator from the paper
Demographically-Conditioned Synthetic Medical Images for Bias Mitigation and Bias
Detection in Disease Classifiers.
1import torch
2from diffusers import StableDiffusionPipeline
3
4pipe = StableDiffusionPipeline.from_pretrained(
5 "mahmoudibra98/covid-ct-sd21", safety_checker=None, torch_dtype=torch.float16
6).to("cuda")
7
8prompt = "50 year old FEMALE. COVID-19 findings on chest CT scan"
9img = pipe(prompt, num_inference_steps=50, guidance_scale=7.5).images[0]
10img.save("sample.png")
Research only. Synthetic COVID-19 chest CT for classifier training/augmentation and
subgroup fairness auditing. Not a medical device; not for diagnosis. Trained on
public COVID CT datasets (see the code repository). Outputs are 512×512 grayscale
chest CT slices rendered as 3-channel images.
Apache-2.0.