Medical diffusion on a budget: Textual Inversion for medical image generation
Bram de Wilde, Anindo Saha, Maarten de Rooij, Henkjan Huisman, Geert Litjens
TL;DR
This work shows that Textual Inversion can adapt pre-trained diffusion models like Stable Diffusion to medical imaging using only 100 examples on a consumer GPU, addressing data scarcity and privacy concerns. By training compact embeddings for a medical concept, the approach enables diagnostically meaningful image generation across modalities, supports compositional prompting and inpainting, and can augment limited real data for downstream classification (e.g., improving Prostate MRI AUC from 0.78 to 0.80 with synthetic data). Compared to StyleGAN3 baselines, diffusion with TI yields superior perceptual realism in a blinded radiologist evaluation, while highlighting limitations of conventional metrics like FID/MFID in medical contexts. The results suggest a practical, low-resource pathway to generate synthetic medical images for training and scenario planning, with embeddings that are easy to share and integrate into existing workflows, though not a substitute for large-scale, captioned medical datasets.
Abstract
Diffusion models for text-to-image generation, known for their efficiency, accessibility, and quality, have gained popularity. While inference with these systems on consumer-grade GPUs is increasingly feasible, training from scratch requires large captioned datasets and significant computational resources. In medical image generation, the limited availability of large, publicly accessible datasets with text reports poses challenges due to legal and ethical concerns. This work shows that adapting pre-trained Stable Diffusion models to medical imaging modalities is achievable by training text embeddings using Textual Inversion. In this study, we experimented with small medical datasets (100 samples each from three modalities) and trained within hours to generate diagnostically accurate images, as judged by an expert radiologist. Experiments with Textual Inversion training and inference parameters reveal the necessity of larger embeddings and more examples in the medical domain. Classification experiments show an increase in diagnostic accuracy (AUC) for detecting prostate cancer on MRI, from 0.78 to 0.80. Further experiments demonstrate embedding flexibility through disease interpolation, combining pathologies, and inpainting for precise disease appearance control. The trained embeddings are compact (less than 1 MB), enabling easy data sharing with reduced privacy concerns.
