Abstract
Glaucoma is a progressive optic neuropathy characterized by structural damage to the optic nerve head and functional changes in the visual field. Detecting glaucoma early is crucial to preventing loss of eyesight. However, medical datasets often suffer from class imbalances, making detection more difficult for deep-learning algorithms. We use a generative-based framework to enhance glaucoma diagnosis, specifically addressing class imbalance through synthetic data generation. In addition, we collected the largest national dataset for glaucoma detection to support our study. The imbalance between normal and glaucomatous cases leads to performance degradation of classifier models. We created a more robust classifier training process by combining our proposed framework leveraging diffusion models with a pretraining approach. This training process results in a better-performing classifier. The proposed approach shows promising results in improving the harmonic mean “sensitivity and specificity” and AUC for the ROC for the glaucoma classifier. We report an improvement in the harmonic mean metric from 89.09% to 92.59% on the test set of our Egyptian dataset. We examine our method against other methods to overcome imbalance through extensive experiments. We report similar improvements on the AIROGS dataset. This study highlights that diffusion-based generation can be important in tackling class imbalances in medical datasets to improve diagnostic performance.
Introduction
Glaucoma is a leading cause of irreversible blindness globally. Early detection is vital, yet clinical datasets are often heavily skewed toward healthy cases, reflecting the low prevalence of the disease (approximately 3.54%). This class imbalance poses a significant challenge for deep learning models, which tend to over-optimize for the majority class, resulting in poor sensitivity for actual glaucoma cases. While standard techniques like oversampling or basic data augmentation provide some relief, they often fail to capture the complex structural nuances of glaucomatous eyes.
Methodology: The DiffuPT Framework
To address these challenges, we propose DiffuPT (Diffusion-based Generation and Model Pretraining), a three-stage framework designed to mitigate class imbalance:
- Latent Diffusion Model (LDM) Training: We utilize LDMs to generate high-resolution (512x512) synthetic fundus images. Unlike Generative Adversarial Networks (GANs), which can be unstable, LDMs learn to denoise images in a compressed latent space, ensuring both computational efficiency and high visual fidelity.
- Generation and Filtering: To ensure the quality of the synthetic data, we implement a filtering stage. A baseline classifier evaluates each generated image; if an image does not clearly represent the target class (glaucoma), it is rejected.
- Pretraining and Fine-tuning: A Swin Transformer classifier is first pretrained on a balanced dataset comprising both real and high-quality synthetic images. This stage allows the model to learn robust, unbiased features. Subsequently, the model is fine-tuned on the original imbalanced real-world dataset to anchor its performance to clinical reality.
Datasets
Our study introduces GlaucomaEgy, the largest national dataset for glaucoma detection, containing 39,449 fundus images from over 20,000 Egyptian patients. This dataset is crucial for addressing ethnic variations in retinal appearance. We also validate our approach using the AIROGS public dataset to ensure generalizability across different populations and imaging conditions.
Results and Discussion
The DiffuPT framework significantly outperformed traditional augmentation and GAN-based methods. On the GlaucomaEgy dataset, the harmonic mean of sensitivity and specificity improved from 89.09% to 92.59%.
Quantitatively, the LDM achieved a Fréchet Inception Distance (FID) of 7.94, vastly superior to CycleGAN's 48.63, indicating that diffusion-generated images are statistically much closer to real clinical data. Furthermore, ablation studies indicated that a 50/50 split of glaucoma to non-glaucoma images during pretraining is optimal for "un-biasing" the classifier.
Conclusion
DiffuPT demonstrates that diffusion-based synthetic data generation, coupled with a strategic pretraining pipeline, effectively mitigates class imbalance in medical imaging. While the computational cost of diffusion sampling remains a limitation (approximately 80 seconds per image), the resulting gains in diagnostic sensitivity and overall model robustness are substantial. Future work will focus on accelerating the generation process and extending this framework to other rare medical conditions.
Summary updated