A fundus photograph goes through cropping and contrast normalisation, then an EfficientNet-B3 backbone (pretrained on ImageNet, fine-tuned in two phases) maps it onto one of five ordinal stages: 0 no DR, 1 mild, 2 moderate, 3 severe, 4 proliferative. Grad-CAM traces the prediction back to the pixels that drove it, and QWK scores how well predictions agree with expert graders while punishing distant errors far more than adjacent ones.
Quadratic Weighted Kappa:
κ = 1 − Σ wᵢⱼOᵢⱼ / Σ wᵢⱼEᵢⱼ
wᵢⱼ = (i − j)² / (N − 1)²
O = observed grade matrix, E = expected (chance) matrix
κ ≈ 0.85+ ≈ expert-level agreement (N = 5 grades)
- Ground-truth DR stage — the true pathology on the retina: sets how many microaneurysms, haemorrhages, hard exudates and (at stage 4) neovascular tufts are actually present.
- Raw vs Ben Graham + CLAHE — raw photographs have uneven lighting that hides small, low-contrast lesions from the classifier; preprocessing subtracts local blur and equalises contrast, so the model detects far more of what is really there.
- Grad-CAM overlay — highlights exactly the lesions the model actually used for its prediction, in the same warm-to-cool heat scale a clinician would see in the explainability report.
- Predicted grade — reconstructed from how many lesions were detected, not from the true stage directly, which is why poor preprocessing can under-grade a genuinely severe retina.
Because DR stages are naturally imbalanced in screening populations, models are trained with class weighting, and every clinical deployment maps the predicted grade onto an action — from routine 12-month rescreening at grade 0 to urgent ophthalmology referral at grade 4.