Skip to content
x2ankitPublic

About

An Adaptive Edge-to-Cloud Telemedicine Pipeline for Explainable DR Screening

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

88 Commits

Folders and files

Repository files navigation

πŸ‘οΈ eDRis: Edge-Optimized Resilient AI Dashboard for Explainable Diabetic Retinopathy Screening

Explainable AI-Based Diabetic Retinopathy Screening for Rural PHCs

Status MATLAB SIH 2026 Problem Statement



eDRis Premium Dashboard

Project: Explainable AI for Diabetic Retinopathy in Rural India
Organization: MathWorks (Problem Statement SIH26038)
Theme: MedTech / BioTech / HealthTech | Category: Software


🌟 Context & Problem Statement

Diabetic retinopathy is a retinal complication of diabetes that can progress without obvious symptoms in the early stages. In many rural settings, access to specialist eye-care services is limited by distance, availability of ophthalmologists, and connectivity.

Fundus photographs captured at Primary Health Centres (PHCs) can be affected by blur, poor illumination, incomplete field of view, and other acquisition problems. A screening system therefore needs to determine whether an image is usable before classification, provide a clinically interpretable screening result, and continue operating when network connectivity is limited.

The eDRis Solution:
eDRis is an advanced, edge-first screening workflow designed for PHCs. It accepts a fundus image, performs mathematical image-quality assessment, enhances usable images, analyses retinal structures, classifies DR into the International Clinical DR severity levels 0–4 using a ResNet-50 model, generates attention and confidence information, and produces a screening report. Referable cases (DR Level β‰₯ 2) are placed into a local referral queue and synchronized to a server when connectivity becomes available.


πŸ—οΈ System Architecture & Complete Workflow

The eDRis architecture connects the AI model directly to the actual constraints of rural screening deployment. The clinical path is separated from the deployment simulation path. MATLAB handles image processing and inference, while Simulink models the flow of patients and resources.

eDRis Architecture

βš™οΈ Core Technical Innovations & Mathematical Formulations

Phase 1: Image Quality Assessment (IQA) & Enhancement

Image quality assessment is placed before AI inference because a visually poor fundus photograph can produce an unreliable classification. A failed image is not silently classified; it is sent back for recapture.

1. Focus / Sharpness Measurement

We use the variance of the Laplacian to quantify high-frequency image detail. For a grayscale image $I(x,y)$, the Laplacian is: $$L(I) = \nabla^2I = \frac{\partial^2I}{\partial x^2} + \frac{\partial^2I}{\partial y^2}$$

The variance of the Laplacian is then calculated as: $$S_{focus} = Var(L(I))$$ A low $S_{focus}$ indicates that high-frequency edges are weak (blur/defocus). The exact acceptance threshold is calibrated statistically.

2. Illumination / Brightness Assessment

The mean intensity ($\mu_I$) and intensity dispersion ($\sigma_I^2$) provide simple indicators of underexposure and overexposure: $$\mu_I = \frac{1}{N} \sum I(x,y)$$ $$\sigma_I^2 = \frac{1}{N} \sum (I(x,y) - \mu_I)^2$$ The practical gate combines brightness statistics with local illumination measurements to ensure the retinal region is well-lit.

3. Field-of-View (FOV) / Retinal Coverage

Let $\Omega_{FOV}$ denote the detected retinal field and $\Omega_{img}$ denote the total image area. The coverage ratio is: $$R_{FOV} = \frac{|\Omega_{FOV}|}{|\Omega_{img}|}$$ This prevents the processing of images with excessive black borders or partial captures.

4. Composite Quality Score

The three quality dimensions are represented by normalized scores $q_{focus}$, $q_{illum}$, and $q_{FOV}$. The composite score is: $$Q = w_f \cdot q_{focus} + w_i \cdot q_{illum} + w_v \cdot q_{FOV}, \quad (w_f + w_i + w_v = 1)$$ Gate Logic: Usable = 1 if $Q \ge \tau_Q$ and individual safety limits are satisfied; otherwise Usable = 0.

5. Illumination Normalization and Enhancement

Accepted images undergo Contrast Limited Adaptive Histogram Equalization (CLAHE) to improve local contrast without excessive amplification: $$I_{enh} = CLAHE(I_{input}; clipLimit, tileGridSize)$$


Phase 2: DR Classification Engine

The primary classification model is a ResNet-50 network imported through ONNX, mapping to the International Clinical DR scale (Level 0 to Level 4). $$z = f_{ResNet50}(I_{enh})$$ The probabilities are calculated using the Softmax function: $$p_k = \frac{\exp(z_k)}{\sum_{j=1}^{5} \exp(z_j)}$$ $$\text{DR Level} = \text{argmax}_k(p_k)$$

Referable DR Logic: For the screening workflow, Level 2 or higher is treated as referable:

  • Referral = 1, if DR Level $\ge 2$
  • Referral = 0, otherwise

Phase 3: Explainability and Screening Report

The screening report combines DR level, model confidence, quality status, key findings, and an Attention Visualization.

  • Extracts high-activation layer maps during inference to visually highlight specific retinal regions (e.g., hemorrhages, exudates).
  • Clinicians receive interpretable, localized diagnostic evidence alongside the raw probability score.

Phase 4: Offline-First Referral Workflow

Continuous internet access is not a prerequisite. The PHC device performs local inference and stores referral information in an outbox JSON file. When connectivity becomes available, queued referral records are synchronized to the central specialist server.


Phase 5: Simulink Deployment & Resource Modelling

Simulink is used to represent the deployment behavior of the screening network, modeling how patient arrivals move through acquisition, AI processing, network sync, and specialist review.

1. District Workload ($N = 100,000$ patients/year)

Assuming 365 operating days and 8 operating hours/day: $$\lambda = \frac{N}{365 \times 8} = \frac{100,000}{2920} \approx 34.25 \text{ patients/hour}$$ For a district with 20 PHCs (balanced workload): $$\lambda_{PHC} \approx \frac{34.25}{20} \approx 1.71 \text{ patients/hour/PHC}$$

2. AI Processing Capacity

If the mean processing time per image is $t_{AI}$ seconds, the theoretical single-worker capacity is: $$C_{AI} = \frac{3600}{t_{AI}} \text{ patients/hour}$$ (e.g., 0.8 s/image = 4,500 images/hour)

3. Network / Bandwidth Model

For an image of $S$ megabytes transmitted over a $B$ Mbps link, the approximate transmission time is: $$t_{network} \approx \frac{8 \times S}{B} \text{ seconds}$$

4. Specialist Capacity

If $N_s$ specialists each spend $t_r$ minutes reviewing one referral, the nominal review capacity is: $$C_{spec} = \frac{N_s \times 60}{t_r} \text{ referrals/hour}$$


☁️ Cloud-First vs Edge-First Deployment Comparison

Aspect Cloud-first eDRis Edge-first
Inference Remote / server Local PHC device
Image transfer All screening images Referral-focused synchronization
Connectivity Important for routine inference Not required for basic local screening
Referral handling Server-side Local outbox + later sync
Resource model Network / server dependent Network + AI + queue + specialist capacity

πŸ“Š Validation & Current Results

The current prototype has been verified through a deterministic ONNX inference path using a 551-image APTOS 2019 holdout set.

  • Referable Definition: DR Level $\ge 2$
  • Threshold: 0.620
  • AUC-ROC: 0.9748
  • Sensitivity: 94.17%
  • Specificity: 93.58%
  • Inference Benchmark: 128 ms/image (machine/session dependent)

πŸš€ Feasibility, Execution Plan, and Risks

Execution Plan

  • Stage 1 (PHC Prototype): Local screening workflow (image capture, quality gate, preprocessing, classification, report).
  • Stage 2 (Connectivity): Connect local referral outbox to an online synchronization service.
  • Stage 3 (Multi-PHC Simulation): Simulink evaluation of district-scale workload under varying bandwidth and specialist conditions.
  • Stage 4 (Clinical Validation): Prospective validation on representative clinical data and regulatory review before real-world deployment.

Risks and Mitigation

Risk Mitigation / Engineering Response
Camera & Image Variation Quality gate, CLAHE normalization, and recapture pathway.
Population Shift Prospective validation and external evaluation prior to deployment.
Poor Connectivity Local edge inference, local JSON queue, and delayed synchronization.
Referral Overload Simulink specialist-capacity and queue bottleneck modeling.
False Reassurance Use strictly as screening support; maintain specialist review.

πŸ“Έ System UI Screenshots

Telemedicine Network Simulation

Real-time MATLAB Queue Simulation mathematically proving the bottleneck of Cloud-AI versus the scalability of eDRis Edge-AI in low-bandwidth rural conditions.


Specialist Review Dashboard

The Centralized Specialist Review UI for offline-synced JSON payloads, enabling rapid triage and verified medical diagnosis.


πŸ› οΈ Technology Stack

  • Application: MATLAB
  • Deployment Modelling: Simulink
  • Model Interoperability: ONNX
  • Primary Classifier: ResNet-50 (5-class DR severity)
  • Image Processing: MATLAB image-processing toolboxes
  • Referral Storage: Local JSON outbox / sync workflow

πŸ’» Getting Started

  1. Clone this repository.
  2. Open MATLAB R2023b or newer.
  3. Ensure you have the following Toolboxes installed:
    • Deep Learning Toolbox
    • Deep Learning Toolbox Converter for ONNX Model Format
    • Image Processing Toolbox
  4. Navigate to src/matlab/ and run the core pipeline scripts.

πŸ“œ License

This project is licensed under the MIT License. See the LICENSE file for details.

About

An Adaptive Edge-to-Cloud Telemedicine Pipeline for Explainable DR Screening

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages