Plate I
HierarchiRetina
HierarchiRetina: A Diabetic Retinopathy Screening and Grading Cascade with Heterogeneous Mixture-of-Experts Lesion Segmentation
Clinical screening for diabetic retinopathy proceeds in stages, yet most automated systems grade fundus images with a single black-box network. Three gaps remain: (i) lesions differ widely in size and contrast, but segmenters typically apply the same blocks to all; (ii) ungradable images are usually excluded or treated as an extra class, and lesion-aware graders seldom test whether lesions drive the grade; (iii) staged systems often report each stage only on the images reaching it, leaving propagated errors unmeasured. HierarchiRetina, a screening, segmentation and grading cascade with inspectable stage outputs, addresses each gap. First, HSMoE-AUNet is a U-Net whose skip, bottleneck and decoder blocks are sparse mixtures of heterogeneous experts, with lesion-matched types, counts and losses; SwinHRUNetPP, a dual-encoder vessel segmenter, uses a field-of-view-restricted loss. Second, LG-DRG separates gradability from ordinal severity and lets lesion masks query the image through gated cross-attention. Third, an end-to-end evaluation counts screening misses as errors and traces each error to its stage. Pooled Dice ranged from 0.184 (microaneurysms) to 0.579 (exudates); vessel Dice was 0.731. On 58,689 held-out images from six datasets, end-to-end quadratic weighted kappa was 0.804, with referral sensitivity 0.832 at specificity 0.947, and the screening gate caused 66% of errors. In ablations, the grade ignored the masks, even with the cross-attention gate started open. On all 4,105 official DDR test images, six-class accuracy was 85.6%, above the best published six-class result we found (83.8%). Staged screening systems should be evaluated end-to-end, with stage attribution and mask ablation, before clinical deployment.
Md Asif Uddin, Niloy Farhan, Rafeed Rahman, and Md. Golam Rabiul Alam, "HierarchiRetina: A diabetic retinopathy screening and grading cascade with heterogeneous mixture-of-experts lesion segmentation," arXiv:2610.17933 [cs.CV], 2026. Under review, IEEE Journal of Biomedical and Health Informatics.
Results
| Measure | Value | Note |
|---|---|---|
| End-to-end quadratic weighted kappa | 0.804 | 95% CI 0.798 to 0.809; every screening miss counted |
| Referral sensitivity | 0.832 | at specificity 0.947 |
| Stage I gate, AUC | 0.929 | |
| Lesion Dice, pooled | 0.184 – 0.579 | microaneurysms to exudates |
| Vessel Dice | 0.731 | |
| Official DDR test set, six classes, end to end | 85.6% | accuracy, against 83.8% for the best published result we found |
Under review at the IEEE Journal of Biomedical and Health Informatics (submitted October 2026). Md Asif Uddin, Niloy Farhan, Rafeed Rahman and Md. Golam Rabiul Alam, Department of Computer Science and Engineering, Brac University. Preprint, arXiv:2610.17933 · Code, trained weights and per-image predictions · Archived code (Zenodo)

Why a cascade
Human graders work through diabetic retinopathy in steps:
- They decide whether any retinopathy is present.
- They look for the lesions that define the grade.
- They grade the eye, or refer it when the photograph cannot be read.
Most automated systems compress all of that into one network that maps a photograph to a grade.
Staged systems exist, but they are usually scored stage by stage, on the images each stage happens to receive. A case lost at the first step then never shows up as an error.
HierarchiRetina follows the clinical order and is scored the way a screening programme would experience it: every image enters at the first stage, and every miss counts.
The three stages
Stage I, screening gate. A ConvNeXt V2-L classifier at 768 × 768 pixels separates eyes with no retinopathy (Grade 0) from everything else (Grades 1 to 5, where Grade 5 is an unreadable photograph). Its threshold is fixed on validation data. Images below it stop at Grade 0.
Stage II, segmentation.
- HSMoE-AUNet segments four lesion types: microaneurysms, haemorrhages, hard exudates and cotton-wool spots, with one model per lesion type. Its skip, bottleneck and decoder blocks are sparse mixtures of heterogeneous experts. Each lesion gets the expert types, expert counts and losses that suit its size and contrast.
- SwinHRUNetPP, a dual-encoder network, segments the vessels with a loss restricted to the field of view.
Stage III, LG-DRG grader. The lesion-guided grader reads the photograph together with the five masks, which query the image through a gated cross-attention path. It has two heads:
- a gradability head, which decides whether the image can be read;
- an ordinal head, which grades severity using thresholds fitted on out-of-fold predictions.
Where the numbers come from
The end-to-end results come from a held-out test pool of 58,689 images from six public datasets: EyePACS, DDR, IDRiD, APTOS 2019, Messidor-2 and FGADR. The pool was never used for training or for choosing a model or threshold. The DDR result uses all 4,105 images of its official test split, and the Dice scores come from held-out segmentation splits.
What the end-to-end view showed
Most errors start at the gate. The cascade made 10,907 errors end to end:
| Source of error | Share |
|---|---|
| Eyes with retinopathy that the gate stopped | 22.5% |
| Healthy eyes that the gate let through | 43.5% |
| Grading mistakes | 34.0% |
So even a perfect grader would remove only about a third of the errors.
The grade ignored the masks. In the mask ablation (fold 0 of the cross-validation), we removed all masks, swapped in another image’s masks, and dropped one mask channel at a time. None of these changed the grader’s kappa by more than 0.0003. Retraining with the cross-attention gate started open did not change that.
The masks still help a person reviewing the case, but they do not explain the grade. We report this negative result because lesion-aware graders seldom test whether the lesions actually drive the grade.
The best kappa is not the best screening setting. A stricter gate (threshold 0.675) raises kappa to 0.825, because fewer healthy eyes reach the grader. But it also blocks 1,320 more eyes with retinopathy, 94% of them mild or moderate. Referral sensitivity then falls from 0.832 to 0.795.
Limitations
- The evaluation is held-out, not external: the test partitions share sources with the training data.
- EyePACS supplies 91% of the test pool.
- Grade 5 (ungradable) occurs only in DDR.
- Most images were graded once, without adjudication.
- The segmenters were not compared with other architectures on the same splits.
Reproducibility
The repository holds:
- the code;
- the trained weights (release v1.0);
- per-image predictions;
- a script that recomputes every end-to-end number in the paper (release v1.0.1, 203 checks).
The code is also archived on Zenodo with a permanent DOI, 10.5281/zenodo.23741643, so the version behind the paper stays citable even if the repository changes.
Background
The project began as my BSc thesis in Computer Science and Engineering at Brac University (2026).