Instructions to use mahmoudibra98/covid-ct-sd21 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use mahmoudibra98/covid-ct-sd21 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("mahmoudibra98/covid-ct-sd21", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
COVID CT β Demographically-Conditioned SD 2.1
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.
Usage
import torch
from diffusers import StableDiffusionPipeline
pipe = StableDiffusionPipeline.from_pretrained(
"mahmoudibra98/covid-ct-sd21", safety_checker=None, torch_dtype=torch.float16
).to("cuda")
prompt = "50 year old FEMALE. COVID-19 findings on chest CT scan"
img = pipe(prompt, num_inference_steps=50, guidance_scale=7.5).images[0]
img.save("sample.png")
Prompt format
The model was trained on prompts of the exact form:
"{age} year old {SEX}. {clinical}"
ageβ {15, 30, 50, 70, 85} β representative integers for the training age bins (Under 20 β 15, 20-40 β 30, 40-60 β 50, 60-80 β 70, Over 80 β 85).SEXβ {MALE, FEMALE} (uppercase, as trained).clinicalβ {"Normal chest CT scan", "COVID-19 findings on chest CT scan"}.
Example: "70 year old MALE. Normal chest CT scan". Conditioning outside these values is
untested; stay within the trained vocabulary for faithful demographic control.
Intended use & limitations
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.
License
Apache-2.0.
- Downloads last month
- 28
Model tree for mahmoudibra98/covid-ct-sd21
Base model
stabilityai/stable-diffusion-2-1-base