Inside AI-Assisted Diabetic Retinopathy Screening: From Retinal Photo to Risk Grade
How transfer learning, specialised image preprocessing and explainability tools like Grad-CAM combine to grade diabetic retinopathy severity from retinal photographs, and what it would take to support the NHS Diabetic Eye Screening Programme.
A screening programme running at national scale
Diabetic retinopathy is damage to the blood vessels of the retina caused by long-term high blood sugar, and it remains one of the leading causes of preventable sight loss among working-age adults in the UK. Around 4.9 million people in the UK live with diabetes, and the NHS Diabetic Eye Screening Programme (DESP) invites over 2.5 million of them for a retinal photograph every year, precisely because early-stage retinopathy has no symptoms but is treatable if caught in time. Screening at that scale is expensive and labour-intensive for expert graders to review by eye, which is exactly the kind of repetitive, high-volume, well-defined image classification task that has attracted serious interest in AI-assisted grading — with estimates suggesting AI triage could meaningfully reduce screening costs while helping graders focus their attention on the images most likely to need it.
Five stages, one ordered scale
Clinically, diabetic retinopathy is staged from 0 to 4: no DR, mild, moderate, severe, and proliferative, with each stage describing progressively more severe damage — from tiny microaneurysms (small red dots where vessel walls bulge) through haemorrhages and lipid exudates, up to proliferative disease where abnormal new blood vessels grow across the retina and put the patient at serious risk of vision loss. Unlike a simple yes/no classification, this is an ordinal problem: mistaking stage 0 for stage 1 is a much smaller error than mistaking stage 0 for stage 4, and any model built for this task needs to be evaluated in a way that reflects that. This is where Quadratic Weighted Kappa (QWK) comes in — a standard metric for this exact problem that measures agreement with expert graders while penalising distant misclassifications much more heavily than adjacent ones, with a QWK around 0.85 or above generally considered to be approaching expert-level agreement.
Cleaning up retinal photographs before the network sees them
Retinal (fundus) photographs vary considerably between cameras and clinics — differences in exposure, lighting and even the black border around the circular retinal field can add noise that has nothing to do with the patient's actual retinopathy status. A few standard preprocessing steps address this directly: cropping away the black surrounding border so the network only ever looks at retinal tissue; the Ben Graham method (the approach used by the winning entry in the original 2015 Kaggle diabetic retinopathy competition), which subtracts a heavily blurred version of the image from itself to cancel out uneven local lighting and sharply boost the contrast of small vascular abnormalities; and CLAHE (Contrast Limited Adaptive Histogram Equalisation), which locally stretches contrast across small regions of the image without over-amplifying noise in already-bright or already-dark areas. Together these steps make the images that reach the network far more consistent, which matters enormously when the model has to generalise across photographs taken on different equipment at different NHS clinics.
Why transfer learning and a two-phase training strategy
Rather than training a network from scratch, a more effective approach for a dataset of a few thousand labelled retinal images is transfer learning: starting from a network such as EfficientNet-B3, already pretrained on millions of general images from ImageNet, and adapting it to this specific task. Training happens in two phases. In phase one, the pretrained backbone is frozen entirely and only a newly added classification head — global average pooling followed by dense layers — is trained, letting the model quickly learn to map the backbone's already-rich general visual features onto the five DR grades. In phase two, the last several layers of the backbone itself are unfrozen and fine-tuned at a much lower learning rate (often ten times smaller than in phase one), letting the network's deeper visual features adapt slightly to the specific textures of retinal pathology without destroying what they already learned from the much larger, more general dataset. Because the DR stages are naturally imbalanced in real data — most people screened have no retinopathy at all — class weighting is applied during training so the model isn't simply rewarded for predicting "no DR" on every image.
Grad-CAM: making the model show its working
A grading system this consequential cannot be a black box. Grad-CAM (Gradient-weighted Class Activation Mapping) is a technique that traces back through the network to work out which regions of the input image most influenced its final prediction, producing a heatmap overlay that shows where the model "looked." For a well-trained diabetic retinopathy model, that heatmap should light up over genuine pathology — clusters of microaneurysms, patches of haemorrhage, areas of neovascularisation — rather than over irrelevant parts of the image like the optic disc or image artefacts. This kind of interpretability isn't just a nice-to-have for building clinician trust; UK regulators including the MHRA and the NHS AI Lab explicitly expect AI diagnostic tools to be able to explain their reasoning to some degree before being trusted in a clinical pathway.
From grade to clinical action
The final piece that makes a model like this clinically meaningful is mapping each predicted grade onto an actual recommended action rather than leaving it as an abstract number: no DR might mean routine rescreening in twelve months, mild or moderate DR might shorten that interval or trigger referral to an ophthalmologist within a few months, and severe or proliferative disease should trigger urgent referral within weeks given the real risk of vision loss. Built this way, the tool becomes less a diagnostic replacement and more an AI-assisted triage layer sitting between the fundus camera at a GP surgery or screening clinic and the human grader — flagging likely urgent cases for fast-tracked review while routine normal cases can be processed with less manual burden, freeing up expert time for the images that need it most.
Frequently Asked Questions
What is diabetic retinopathy and why is it a UK screening priority?
It is damage to the retina's blood vessels caused by prolonged high blood sugar in people with diabetes. It's a major cause of preventable blindness in working-age adults, which is why the NHS runs an annual national screening programme covering millions of people with diabetes.
What is Quadratic Weighted Kappa and why use it here?
It's a metric for ordered (ordinal) classification problems that measures agreement with expert grading while penalising predictions that are further from the true grade much more heavily than predictions that are just one stage off, which fits how clinically meaningful DR staging errors actually are.
What does Grad-CAM actually show?
It produces a heatmap over the input image highlighting the regions that most influenced the model's prediction, generated by tracing gradients back through the network's convolutional layers. For retinal images, a trustworthy model should highlight genuine lesions like haemorrhages or microaneurysms.
Why is image preprocessing so important for retinal photographs specifically?
Fundus cameras vary between clinics in exposure and lighting, and small vascular abnormalities can be very subtle. Standardising contrast and removing irrelevant black borders makes those subtle features far more consistent and detectable across images from different equipment.
Could a model like this replace human graders in the NHS screening programme?
Not on its own. The realistic near-term role is triage support — flagging likely urgent cases and helping route the huge screening workload — with any AI grading still needing rigorous multi-site clinical validation and regulatory approval before taking on an independent diagnostic role.