Glaucoma Severity System
Three-stage system for retinal fundus photographs: input validation, severity
grading, and quantitative cup-to-disc measurement.
Part of the NeuroGSD project (AI-based early detection of common eye diseases).
Scope
This module grades severity in confirmed glaucoma cases. It does not screen
for the presence of glaucoma. A healthy fundus photograph will still receive a
severity grade. Screening is not implemented.
Usage
1from inference import GlaucomaSystem
2import cv2
3
4sys = GlaucomaSystem(".")
5result = sys.predict(cv2.imread("fundus.jpg"))
Accepted input returns grade, confidence, class probs, vcdr and
cup_disc_area_ratio. Rejected input returns accepted: False with the reasons
and produces no grade.
Components
1. Input validation — two independent checks on the raw image, before any
preprocessing. Order matters: the disc-cropping stage transforms an arbitrary
photograph into a texture patch, destroying the evidence needed to reject it.
The first check uses black-surround fraction and red-channel dominance; the
second measures Mahalanobis distance from the training distribution in
EfficientNetB4 feature space. Photographs of a car and of a flower passed all
statistical checks and were caught only by the distance measure, so both are
needed.
2. Severity classifier — EfficientNetB4 fine-tuned on optic disc crops,
three-way softmax over mild / moderate / severe. Preprocessing: black-border
trim, disc localisation by brightest-point detection with a 12% border exclusion,
crop at 40% of the shorter dimension, CLAHE (clip 2.0, 8x8, LAB L-channel),
resize to 384.
3. Cup-to-disc measurement — U-Net trained on ORIGA, REFUGE and G1020
(2,237 image-mask pairs), returning vertical CDR and cup-to-disc area ratio.
Results
Severity classification, held-out test set (n=67), evaluated once:
| Metric | Value |
|---|
| Quadratic weighted kappa | 0.604 |
| Accuracy | 0.672 |
| Macro-F1 | 0.660 |
| Within-one-grade agreement | 0.940 |
Cross-validated development estimate was 0.607, closely matching the held-out
result and indicating a leakage-free evaluation.
Segmentation, held-out REFUGE test partition (a source not seen during training):
rim Dice 0.883, cup Dice 0.862.
Input validation: 93% of fundus images from an unseen camera accepted; all
non-fundus images tested rejected.
Limitations
- Trained on 322 images from a single clinic; generalisation untested
- Labels student-graded under expert guidance, not independently verified
- No healthy class; cannot screen for the presence of glaucoma
- Segmentation quality on clinic images is lower than on the public validation
set, since their disc crops are looser than the training crops. Measured CDR
correlates with expert grade (Spearman 0.219 vertical, 0.309 area) but this
survives on clean masks only at 0.194 and 0.282
- Research use only. Not a medical device.