Development and validation of an AI algorithm to generate realistic and meaningful counterfactuals for retinal imaging based on diffusion models
Counterfactual reasoning is often used by humans in clinical settings. For imaging based specialties such as ophthalmology, it would be beneficial to have an AI model that can create counterfactual images, illustrating answers to questions like "If the subject had had diabetic retinopathy, how would the fundus image have looked?". Such an AI model could aid in training of clinicians or in patient education through visuals that answer counterfactual queries. We used large-scale retinal image datasets containing color fundus photography (CFP) and optical coherence tomography (OCT) images to train ordinary and adversarially robust classifiers that classify healthy and disease categories. In addition, we trained an unconditional diffusion model to generate diverse retinal images including ones with disease lesions. During sampling, we then combined the diffusion model with classifier guidance to achieve realistic and meaningful counterfactual images maintaining the subject's retinal image structure. We found that our method generated counterfactuals by introducing or removing the necessary disease-related features. We conducted an expert study to validate that generated counterfactuals are realistic and clinically meaningful. Generated color fundus images were indistinguishable from real images and were shown to contain clinically meaningful lesions. Generated OCT images appeared realistic, but could be identified by experts with higher than chance probability. This shows that combining diffusion models with classifier guidance can achieve realistic and meaningful counterfactuals even for high-resolution medical images such as CFP images. Such images could be used for patient education or training of medical professionals.
Authors
- Matthias Hein (ORCID: https://orcid.org/0000-0002-8751-7760)
- Indu Ilanchezian
- Murat Seçkin Ayhan (ORCID: https://orcid.org/0000-0002-3184-2353)
- Philipp Berens (ORCID: https://orcid.org/0000-0002-0199-4727)
- Ziwei Huang (ORCID: https://orcid.org/0000-0001-7517-0395)
- Laura Kuehlewein (ORCID: https://orcid.org/0000-0003-1906-8681)
- Lisa M. Koch (ORCID: https://orcid.org/0000-0003-4377-7074)
- Valentyn Boreiko
Institutions
- University of Bern (CH)
- University Hospital of Bern (CH)
- Bernstein Center for Computational Neuroscience Tübingen (DE)
- Hertie Institute for Clinical Brain Research (DE)
- STZ eyetrial (DE)
- Tübingen AI Center
- University College London (GB)
- University of Tübingen (DE)
Publication Details
- Journal
- PLOS Digital Health
- Published
- 2025-05-15
- DOI
- https://doi.org/10.1371/journal.pdig.0000853
- Citations
- 1
- Primary Topic
- Retinal Imaging and Analysis
- Type
- article
- Field-Weighted Citation Impact
- 1.36
Funders
- Carl-Zeiss-Stiftung
- Deutsche Forschungsgemeinschaft
- Bundesministerium für Bildung und Forschung
- Else Kröner-Fresenius-Stiftung
- Gemeinnützige Hertie-Stiftung