Skip to main content
. 2026 May 27;16(11):1654. doi: 10.3390/diagnostics16111654
Algorithm 1: RETFound-Based DRIL Classification Architecture.
1: Input: OCT images with foveal annotations
2: Model: RETFound (Vision Transformer)
3: // Phase 1: Preprocessing the OCT Images and extracting central foveal 1 mm region
4: for all class c∈{DRIL,No-DRIL} do
5:     for all image Ii in class c do
6:         Load Ii and annotation file
7:         Read foveal center coordinates fx
8:         Icrop←CropCentral(Ii,fx,width=1mm)
9:         Ienhanced←CLAHE(Icrop)
10:         Save Ienhanced
11:     end for
12: end for
13: // Phase 2: Splitting the dataset for training and testing
14: D← Read all preprocessed images
15: Shuffle D with seed = 42
16: Dtrain,Dtest←Split(D,0.85,0.15)
17: // Phase 3: Cross-validation and model training
18: Initialize K=5
19: for    k=1 to K do
20:     Split Dtrain into Train and Validation sets
21:     Initialize RETFound with pretrained weights
22:     Freeze backbone layers
23:     Train classification head
24:     Unfreeze layers for fine-tuning
25:     Validate on Validation set
26: end for
27: // Phase 4: Model selection and evaluation
28: Select best model based on cross-validation performance
29: Evaluate final fold-specific trained models on the held-out test set
30: Compute-AC, SE, SP, AUC, MCC and Plot Visualizations and other curves