Skip to content

VaibhavDaveDev/Explainable-AI-Based-Glaucoma-Detection-using-Transfer-Learning-LIME-and-LLMs

Repository files navigation

Explainable AI-Based Glaucoma Detection using Transfer Learning, LIME and LLMs

A multi-modal, interpretable AI system for glaucoma detection and clinical insight generation

OverviewArchitectureTechnologiesProject StructureInstallationUsageResultsContributingSnapshots


Overview

Explainable AI-Based Glaucoma Detection leverages Transfer Learning, LIME, and LLMs to deliver accurate and interpretable glaucoma screening from fundus images.

  • LLAMA 3.2 90B Vision Model: Analyzes LIME-based visual explanations to refine interpretability.
  • LLAMA 3.1 70B LLM: Generates detailed textual reasoning, combining model outputs and vision insights.

System Components:

  • Frontend: React.js-based interface for image upload and result visualization
  • Backend: Express.js and FastAPI for handling predictions and hosting LLMs
  • Image Analysis: Combines CNN-based classification with LIME and LLAMA models for interpretability
  • Database: MongoDB stores user feedback to refine predictions

Framework Architecture

  1. Image Upload: Users upload fundus images for evaluation
  2. Classification: Pre-trained CNN model classifies images as Normal or Glaucoma
  3. LIME Explanation: Highlights critical regions influencing the model’s decision
  4. Vision Model Analysis: LLAMA 3.2 90B Vision Model refines LIME heatmaps and extracts superpixel importance
  5. Reasoning and Explanation: LLAMA 3.1 70B LLM generates detailed textual explanations
  6. Feedback: Users can submit feedback for continuous improvement

Technologies

  • Frontend: React.js
  • Backend: Express.js, FastAPI
  • AI Models: Transfer Learning (CNN, e.g., VGG16), LIME, LLAMA 3.2 90B Vision Model, LLAMA 3.1 70B LLM
  • Database: MongoDB

Project Structure

Project/
│
├── Backend_Model/                    # Backend for the machine learning model and API
│   ├── model/                        # Model-related files
│   ├── Notebooks/                    # Model Training Notebooks
│   ├── predictenv/                   # Environment setup for model predictions
│   ├── server/                       # Fast API backend for model deployment
│
├── Glaucoma-Detection-using-Transfer-Learning/  # Main application
│   ├── node_modules/                 # Node.js dependencies
│   ├── public/                       # Static files for frontend
│   ├── server/                       # Node.js and Express.js backend configuration
│   ├── server.js                     # Express.js API server entry point
│   ├── src/                          # React.js source code (frontend)
│   ├── .env                          # Environment variables for configuration
│   ├── package.json                  # NPM package configuration
│   ├── vite.config.js                # Vite configuration for frontend
│
├── Test Images/                      # Test images for model validation
│   ├── Glaucoma/                     # Images of glaucoma-affected eyes
│   └── Normal/                       # Images of normal eyes
│
├── .gitignore                        # Files to be ignored by git
└── README.md                         # Project documentation

Installation

1. Clone the Repository

git clone https://github.com/VaibhavDaveDev/Explainable-AI-Based-Glaucoma-Detection-using-Transfer-Learning-LIME-and-LLMs.git
cd Explainable-AI-Based-Glaucoma-Detection-using-Transfer-Learning-LIME-and-LLMs

2. Backend Setup (FastAPI)

cd Backend_Model/predictenv
pip install -r requirements.txt

3. Frontend & Express.js Backend Setup

cd ../../Glaucoma-Detection-using-Transfer-Learning
npm install

4. MongoDB Setup

  • Install and start MongoDB locally, or configure a remote MongoDB instance.

5. Configure Environment Variables

Create a .env file in both Backend_Model/server and Glaucoma-Detection-using-Transfer-Learning directories. Example for Express.js backend:

MONGO_URI=mongodb://localhost:27017/glaucomaDetection
PORT=5000

▶️ Usage

1. Start MongoDB

Ensure MongoDB is running on your machine.

2. Start Backend Servers

  • Express.js:
    cd ../../Glaucoma-Detection-using-Transfer-Learning
    node server.js
  • FastAPI:
    cd Backend_Model/server/
    uvicorn main:app --reload

3. Start the Frontend

cd ../../Glaucoma-Detection-using-Transfer-Learning
npm run dev

Access the application at: http://localhost:3000


📊 Results and Visualizations

  • Classification Result: Identifies the input image as Normal or Glaucoma
  • LIME Heatmaps: Highlights important regions in the fundus image
  • LLAMA-Enhanced Explanation:
    • Visual Analysis (LLAMA 3.2 90B): Refines LIME outputs by identifying key superpixels and their relevance
    • Reasoning (LLAMA 3.1 70B): Provides detailed natural language explanations, offering clinical insights

Example Workflow

  1. Upload a test image (e.g., from the Test Images folder)
  2. Receive the classification result and LIME-based visual heatmap
  3. View detailed reasoning generated by the LLAMA models
  4. Optionally submit feedback to improve the system

🤝 Contributing

We welcome contributions! Follow these steps:

  1. Fork the repository
  2. Create a new branch (git checkout -b feature/YourFeature)
  3. Commit your changes (git commit -m 'Add your feature')
  4. Push to the branch (git push origin feature/YourFeature)
  5. Open a Pull Request

🖼️ Snapshots

Here are some snapshots of the system in action:

Multi-Modal Framework for Glaucoma Classification and Explainable AI Integration

Multi-Modal Framework for Glaucoma Classification and Explainable AI Integration

Home Page

Home Page

About Page

About Page

Contact Us Page

Contact Us Page

Image Upload Interface

Image Upload

Model Prediction and LIME Processing

Model Prediction and LIME Processing

Prediction Result

Prediction

LIME Explanation 1

LIME Explanation 1

LIME Explanation 2

LIME Explanation 2

LIME Explanation 3

LIME Explanation 3

LIME Explanation 4

LIME Explanation 4

AI Generated Explanation

AI Generated Explanation

Feedback Submission Page

Feedback Submission

MongoDB Database Store

MongoDB Database Store


About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published