DEV Community

Soumyajit Chaudhury
Soumyajit Chaudhury

Posted on

RetinaVision AI: Exposing the Ghost in the Black Box of Medical AI

Hacktoberfest Open-Source AI Challenge: Ghost in the Machine Submission 👻🌼

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine

What I Built

RetinaVision AI turns any rural Primary Health Centre (PHC) into a diabetic retinopathy (DR) screening point.

In rural India there is roughly one eye doctor for every 100,000 people. Diabetic retinopathy is silent in its early stages, so many patients reach a specialist only after irreversible vision loss, even though the blindness is preventable with timely screening.

A health worker uploads a retina (fundus) photo, even one taken on a smartphone. The system then:

  • Validates the image and rejects screenshots and random photos in about a second
  • Checks quality (sharpness, brightness, contrast, field of view) and enhances usable images
  • Detects lesions: segments the optic disc and vessels, and counts microaneurysms, hemorrhages and hard exudates
  • Grades the disease from Normal to Proliferative DR (Grade 0-4) with a confidence score
  • Explains itself with heatmaps showing what the model looked at
  • Refers high-risk patients to a specialist in one click, with a full PDF report attached

How I read the theme: every AI model has a ghost in the machine: a decision made somewhere inside layers of weights that nobody can see. In medicine, a ghost you can't question is dangerous. RetinaVision AI is built to make the ghost visible. Grad-CAM, Multi-Layer CAM, Occlusion and LIME let a doctor see where the model looked and why it reached its grade, instead of trusting a black box.

Demo

Code

GitHub logo Soumyajitttt / RetinaVisionAI

AI-assisted diabetic retinopathy screening for rural India, with Explainable AI. Demo Video Link ⇓

RetinaVision AI

AI-assisted diabetic retinopathy screening for rural India: simple, fast, and explainable.

RetinaVision AI turns any Primary Health Centre (PHC) into a diabetic retinopathy (DR) screening point. A health worker uploads a retina (fundus) photo, even one taken on a smartphone, and the system grades the disease, shows why it made that decision, and refers high-risk patients to a specialist in one click.

Demo video -> https://youtu.be/7Pvx6oEvqRg?si=dKT32cT2UV1CgszA


The Problem

In rural India there is roughly one eye doctor for every 100,000 people. It is not possible to detect symptoms early without medical assistance, so patients reach a specialist only after irreversible vision loss, even though this blindness is preventable with timely screening.

Our Solution

  • Screen at the PHC: health workers do first-line screening, so doctors are no longer the only line of screening.
  • AI grading: each scan is graded from Normal to Proliferative DR with a confidence score.
  • Explainable…

Original project by Swastik; this is my fork.

How I Built It

React + Vite  ──HTTP/JSON──▶  Node/Express + MongoDB  ──matlab -batch──▶  Pipeline
 (frontend)   ◀─────────────       (backend)           ◀── result.json ──  (quality, segment,
                                        │                                   classify, explain)
                         Cloudinary (images) · Nodemailer (referrals)
🔥 ข่าวด่วน: soumyajitttt/retinavision ai exposing the ghost in the black box of medical ai ck - ประเด็นร้อน 🔥 ข่าวด่วน: soumyajitttt/retinavision ai exposing the ghost in the black box of medical ai ck - ประเด็นร้อน

Request flow: upload → JS pre-check → pipeline → images stored → result saved in MongoDB → shown in the UI.

  • Model: a CNN classifier trained for DR severity grading (Grade 0-4) [ADD: architecture, dataset, and accuracy/validation results]
  • Explainability suite: Grad-CAM, Multi-Layer CAM, a Cross-Method check (Grad-CAM vs Occlusion vs LIME), and layer Activations. Showing agreement or disagreement between methods stops a single heatmap from being over-trusted.
  • Image processing: CLAHE, illumination normalization and denoising to cope with low-quality field images
  • Backend: Node.js, Express, MongoDB, JWT auth, Socket.io, Multer, Sharp, Nodemailer
  • Frontend: React, Vite, Tailwind CSS
  • Workflow: separate clinician and doctor roles, a "My Patients" inbox, in-app case discussions, and a searchable referral history

Why Does Open Innovation Matter?

Explainability only works when you can open the model up. The explainability methods here (Grad-CAM, Occlusion, LIME) are all openly published techniques. They work because we own the model and can inspect its gradients and activations. A closed diagnostic API gives you a label and a score, with no way to ask it why.

The model is ours, not rented.

  • No per-scan API fees, which matters for under-funded PHCs screening at volume
  • Patient scans are analyzed on our own server rather than sent to a third-party inference API
  • We can retrain or fine-tune on local data, since fundus images from Indian smartphones and cameras look different from the clean clinical datasets most models are trained on
  • The grading pipeline can't be changed or shut down by a vendor

Honest limits: the pipeline currently runs on MATLAB, which is proprietary, and referral images are stored on Cloudinary. The next step is to port the pipeline to an open stack (PyTorch/ONNX) and self-host image storage, so that every layer, not just the model, is open and can run in a clinic with poor connectivity.

The Spirit of It

A black box can say "Grade 3" and be right, but a health worker or doctor has no reason to believe it. A heatmap glowing over the exact hemorrhages and exudates a specialist would look at is what turns "the AI said so" into "I can verify this." In a place where there's one specialist per 100,000 people, that trust decides who gets referred in time and who loses their sight.

Team

Built together with Swastik (@Swastik1901 on GitHub), who started the original RetinaVisionAI repository that this project builds on. He doesn't have a DEV account, so I'm crediting him here directly. Huge thanks to him for the foundation of this project.

RetinaVision AI is a decision-support and screening aid, not a replacement for a qualified ophthalmologist. All results should be reviewed by a medical professional before any clinical decision.

Top comments (0)