ML
Input: A retinal fundus image.
Output:
Image quality→ Accept / RejectDR grade→ Level 0–4Referable DR→ Yes / NoConfidenceExplanation→ Grad-CAM / lesion evidence- Eventually: an automated screening report
Fundus Image
│
▼
[Preprocessing]
│
▼
[Image Quality Check]
│
├── Poor → Reject / Recapture
│
▼
[DR Classification Model]
│
├── Grade 0
├── Grade 1
├── Grade 2
├── Grade 3
└── Grade 4
│
▼
[Referable?]
│
▼
[Grad-CAM + Confidence]
│
▼
[Screening Report]
The segmentation/lesion-detection components can then be added incrementally.
#2. Split the project into modules
ml/
│
├── data/
│ ├── raw/
│ ├── processed/
│ ├── train/
│ ├── validation/
│ └── test/
│
├── preprocessing/
│ ├── quality_assessment
│ ├── illumination_normalization
│ ├── denoising
│ └── enhancement
│
├── models/
│ ├── quality_model/
│ ├── dr_classifier/
│ ├── lesion_detection/
│ └── segmentation/
│
├── training/
│ ├── train_quality_model
│ ├── train_classifier
│ └── evaluate
│
├── explainability/
│ ├── gradcam
│ ├── confidence
│ └── lesion_evidence
│
├── pipeline/
│ └── inference
│
├── reports/
│ └── report_generation
│
├── simulink/
│
├── evaluation/
│ ├── metrics
│ ├── confusion_matrix
│ └── benchmark_comparison
│
└── README.md
#3. First milestone
#Milestone 1 — Minimum viable ML system
Image
↓
Preprocessing
↓
DR classifier
↓
0–4 prediction
↓
Referable / non-referable
↓
Confidence
Just:
Given a fundus image, can our model reliably classify its DR severity?
#4. Dataset
We need images with ground-truth DR severity labels corresponding as closely as possible to:
0 → No DR
1 → Mild NPDR
2 → Moderate NPDR
3 → Severe NPDR
4 → Proliferative DR
The problem statement explicitly expects this five-level classification.
For the initial prototype, the most important dataset properties are:
- fundus photographs
- severity labels
- sufficient samples per class
- preferably publicly documented
- preferably with established use in DR research
- train/test separation that prevents leakage
Do not start training until the dataset and label mapping are written down.
#5. Two separate ML problems
#Problem A — 5-class severity
Image → {0,1,2,3,4}
#Problem B — screening decision
Image → {Non-referable, Referable}
where:
0, 1 → Non-referable
2, 3, 4 → Referable
The problem statement specifically defines Level 2+ as referable.
Our model can therefore produce:
Predicted class: 3
Confidence: 0.87
Referable DR: YES
#6. Model plan
Use transfer learning.
Conceptually:
Pretrained CNN
│
▼
Fundus image
│
▼
Feature extraction
│
▼
Classification head
│
▼
5 DR classes
Possible backbone families can be decided later based on MATLAB support and compute availability.
Our initial experiment should answer:
Can a pretrained image-classification network fine-tuned on the chosen dataset achieve useful DR classification performance?
Only after that should we start experimenting with architectures.
#7. Preprocessing pipeline
Raw image
↓
Resize
↓
Crop / remove irrelevant borders
↓
Normalize
↓
Optional contrast enhancement
↓
Model
Later we'll investigate:
CLAHE
illumination normalization
denoising
color normalization
etc.
The problem statement specifically calls for CLAHE, illumination normalization and denoising as possible enhancement techniques.
#8. Image-quality module
This should be a separate model/module rather than mixing it into the DR classifier initially.
Its job:
Fundus image
↓
Quality assessment
↓
┌───────────────┐
│ │
Good Ungradeable
│ │
▼ ▼
DR model Reject
Initially, we can even implement a basic rule-based quality check before training a dedicated quality model.
Eventually:
Quality Model
Input image
↓
Quality features
↓
├── Focus
├── Illumination
├── Field of view
└── Overall gradability
↓
Gradeable / Ungradeable
This is important because the problem specifically targets variable-quality portable-camera images.
#9. One-at-a-time lesion detection
The statement asks for:
- optic disc/fovea localization
- vessel segmentation
- microaneurysm detection
- exudate segmentation
- hemorrhage classification
- neovascularization detection
#Phase 1
Fundus → DR severity
#Phase 2
Fundus → DR severity
↘
lesion evidence
#Phase 3
Fundus
├── optic disc/fovea
├── vessels
├── microaneurysms
├── exudates
├── hemorrhages
└── neovascularization
#10. Explainability
Once we have:
Image → prediction
add:
Image
↓
Classifier
↓
Prediction
+
Grad-CAM
↓
Heatmap
The intended question is:
What part of the retinal image caused the model to make this prediction?
Then eventually correlate those regions with actual lesions.
The problem statement explicitly requests Grad-CAM, lesion-level evidence and calibrated confidence.
So the eventual output could look conceptually like:
DR Grade: 3
Confidence: 91%
Referable DR: YES
Evidence:
┌──────────────────────┐
│ retinal photograph │
│ + │
│ Grad-CAM │
│ overlay │
└──────────────────────┘
#11. Evaluation
For the 5-class problem, track:
Accuracy
Precision
Recall
F1
Confusion matrix
For the referable DR problem, prioritize:
Sensitivity
Specificity
ROC-AUC
PR-AUC
The problem statement's explicit targets are:
Sensitivity > 90%
Specificity > 85%
for referable DR.
Result
--------------------------------
Sensitivity XX.XX%
Specificity XX.XX%
ROC-AUC X.XXX
Accuracy XX.XX%
F1 X.XXX
#12. First experiment
Dataset
↓
Train / validation / test split
↓
Resize + normalize
↓
Pretrained CNN
↓
5-class classifier
↓
Train
↓
Evaluate
Record:
Dataset version
Number of images
Class distribution
Image resolution
Preprocessing
Model architecture
Learning rate
Batch size
Epochs
Training time
Validation metrics
Test metrics
#13. Scientific iteration
Your experiment progression can be:
EXP-001
Baseline CNN
↓
EXP-002
+ preprocessing
↓
EXP-003
+ augmentation
↓
EXP-004
different backbone
↓
EXP-005
class imbalance handling
↓
EXP-006
hyperparameter tuning
↓
EXP-007
referable-DR optimization
↓
EXP-008
Grad-CAM
↓
EXP-009
quality assessment
↓
EXP-010
integrated pipeline
#14. Backlog
For the initial skeleton, explicitly put these in the backlog:
- Simulink resource optimization
- Telemedicine bandwidth simulation
- Automated clinical report generation
- Full lesion segmentation suite
- Neovascularization detection
- Ophthalmologist validation interface
- Deployment infrastructure
- Mobile/web application
They're part of the eventual solution, but they're downstream of the fundamental ML pipeline.
The problem statement ultimately expects the integrated pipeline plus Simulink simulation and benchmark validation.