DiffuPT: Class Imbalance Mitigation for Glaucoma Detection via Diffusion Based Generation and Model Pretraining

Youssof Nawar, Nouran Soliman, Moustafa Wassel, Mohamed ElHabebe, Noha Adly, Marwan Torki, Ahmed Elmassry, Islam Ahmed

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:

  1. 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.
  2. 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.
  3. 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.
The DiffuPT framework: A Latent Diffusion Model generates synthetic images which are then filtered by a classifier to ensure label accuracy before being added to the training dataset.

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.

Performance comparison of various generative models (DDPM, LDM, GANs) showing the harmonic mean of sensitivity and specificity across different synthetic sample sizes.

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

Abstract

Glaucoma is a progressive optic neuropathy character-ized by structural damage to the optic nerve head andfunctinoal changes in the visual field. Detecting glaucoma early is crucial to preventing loss of eyesight. However, med-ical datasets often suffer from class imbalances, making detection more difficult for deep-learning algorithms. We use a generative-based framework to enhance glaucoma di-agnosis, 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 glaucoma-tous 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 AU C 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 generatino can be important in tackling class imbalances in medi-cal datasets to improve diagnostic performance.
BibTeX
@inproceedings{nawar2025diffupt,
  author = {Youssof Nawar and Nouran Soliman and Moustafa Wassel and Mohamed ElHabebe and Noha Adly and Marwan Torki and Ahmed Elmassry and Islam Ahmed},
  title = {{DiffuPT: Class Imbalance Mitigation for Glaucoma Detection via Diffusion Based Generation and Model Pretraining}},
  booktitle = {IEEE/CVF Winter Conference on Applications of Computer Vision},
  year = {2025},
  url = {https://openreview.net/forum?id=ew1xdSTPEM},
}
Figure