This is a full-stack FastAPI application for detecting eye diseases such as Diabetes, ARMD, and Cataract from retinal fundus images. It uses a deep learning model (EfficientNet) and displays attention maps (Grad-CAM) to explain predictions. See README.model.md for detailed model training
demo_video.1.mp4
Millions of people lose their vision not because treatment doesn’t exist, but because the problem is detected too late.
This project is a web application that helps spot early signs of eye diseases by analyzing retinal (fundus) images using AI. A user uploads an eye scan, and the system:
-
🔍 Checks for common vision-threatening conditions (Diabetic Retinopathy, Age-Related Macular Degeneration, Cataract, Normal)
-
⚡ Gives results in seconds
-
🖼️ Visually highlights where the AI is looking in the eye image
-
🩺 Supports early diagnosis and preventive care, not replacement of doctors
The goal is early intervention — helping doctors and patients act before irreversible vision loss occurs.
Run the application with a single command:
docker run -d -p 8000:8000 --name fundus-app aniketmishr/fundus-webapp:latestThen open your browser and navigate to: http://localhost:8000
docker stop fundus-app
docker rm fundus-appfundus_webapp/
├── training/
│ └── fundus_notebook.ipynb # Jupyter notebook for model training
├── backend/
│ ├── main.py # FastAPI backend entry point
│ ├── model/
│ │ ├── model.pt # Trained EfficientNet model
│ │ └── utils.py # Inference, preprocessing, Grad-CAM
│ ├── static/ # Per-session folders for uploaded + Grad-CAM images
│ └── templates/
│ └── index.html # Jinja2-based Bootstrap UI
├── requirements.txt # Python dependencies
├── Dockerfile # (optional) For containerized deployment
├── README.md # Project setup and usage (this file)
└── README.model.md # Model training & evaluation documentation
-
Frontend (index.html):
- Lets user upload 1 or more fundus images
- Displays prediction results and Grad-CAM visualizations
- Shows loading spinner, image modals, and download buttons
-
FastAPI Backend (main.py):
- Receives uploaded files
- Calls
utils.pyto:- Preprocess images
- Run predictions
- Generate Grad-CAM heatmaps
- Returns results to frontend
-
Model Logic (
utils.py):- Loads
model.pt - Applies CLAHE → Resize → Normalize
- Generates Grad-CAM from final convolutional layer
- Saves full-resolution uploaded and Grad-CAM images
- Loads
- Python 3.8+
- pip (Python package manager)
git clone https://www.github.com/aniketmishr/fundus_webapp
cd fundus_webapppip install -r requirements.txtPlace your trained model.pth inside:
backend/model/model.pth
uvicorn backend.main:app --reloadVisit the app in your browser:
👉 http://localhost:8000/
You can retrain the model using the provided notebook:
📍 training/fundus_notebook.ipynb
This notebook covers:
- Loading AMDNet23 dataset
- Applying preprocessing (Gaussian blur)
- Training EfficientNet-B3 with augmentations
- Saving the model as
model.pth
- ✅ Upload one or more fundus images
- ✅ Predict disease type with confidence %
- ✅ Grad-CAM heatmap generation
- ✅ Clean UI with Bootstrap 5
- ✅ Downloadable Grad-CAMs
- ✅ High-res modal image previews
- ✅ Spinner + toast for interaction feedback
- ✅ “Clear” button to reset & delete files
For dataset info, training process, metrics, and architecture:
🔍 See README.model.md
This project was developed as part of the “Visionary AI: Hacking Blindness Before It Begins” hackathon organized by C-DAC Delhi, focused on AI-driven solutions for early detection and prevention of vision loss.
🥈 2nd Place – Overall
Our solution was awarded Second Place for its real-world impact, technical innovation, and focus on preventive eye care.