Skip to content

aniketmishr/fundus_webapp

Repository files navigation

🧠 AI-Based Fundus Disease Detection Web App

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

What This Project Does (In Simple Terms)

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.

Quick Start

Run the application with a single command:

docker run -d -p 8000:8000 --name fundus-app aniketmishr/fundus-webapp:latest

Then open your browser and navigate to: http://localhost:8000

Stop the application:

docker stop fundus-app
docker rm fundus-app

📦 Project Structure

fundus_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

🔗 How Components Work Together

  1. 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
  2. FastAPI Backend (main.py):

    • Receives uploaded files
    • Calls utils.py to:
      • Preprocess images
      • Run predictions
      • Generate Grad-CAM heatmaps
    • Returns results to frontend
  3. 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

🚀 Getting Started (Run Locally)

🔧 Prerequisites

  • Python 3.8+
  • pip (Python package manager)

1. Clone the Repository

git clone https://www.github.com/aniketmishr/fundus_webapp
cd fundus_webapp

2. Install Dependencies

pip install -r requirements.txt

3. Add Trained Model

Place your trained model.pth inside:

backend/model/model.pth

4. Run the Web App

uvicorn backend.main:app --reload

Visit the app in your browser:
👉 http://localhost:8000/


📓 Reproducibility: Training from Scratch

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

✅ Features

  • ✅ 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

📁 Model Details

For dataset info, training process, metrics, and architecture:
🔍 See README.model.md

🏆 Hackathon Recognition

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.

🔗 Official Recognition


About

AI-based screening tool for early detection of eye diseases using retinal fundus images.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages