Skip to content

Rohit8024/Cataract-Detection-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

24 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Cataract Prediction System

Eye Detection

πŸ” Overview

The Cataract Prediction System is a deep learning-powered web application designed to detect and classify cataracts from eye images. This system uses an EfficientNetB0 model trained on eye fundus images to provide accurate predictions for cataract detection, helping healthcare professionals make informed decisions.

✨ Features

  • AI-Powered Detection: Utilizes EfficientNetB0 deep learning model for accurate cataract prediction
  • User Authentication: Separate registration and login for patients and medical staff
  • Image Upload: Easy-to-use interface for uploading eye images
  • Real-time Predictions: Instant analysis and classification results
  • Dashboard Interface: Clean and intuitive dashboard for viewing results
  • Responsive Design: Works seamlessly across different devices

πŸ› οΈ Technology Stack

Backend

  • Python 3.x: Core programming language
  • Flask: Web framework
  • TensorFlow/Keras: Deep learning framework
  • EfficientNetB0: Pre-trained model architecture

Frontend

  • HTML5: Structure
  • CSS3: Styling
  • JavaScript: Interactive functionality
  • Bootstrap (implied): Responsive design

Database

  • SQLite/MySQL: User credentials and data storage

Model

  • EfficientNetB0: Transfer learning model
  • Model Size: 47.8 MB
  • Format: HDF5 (.h5)

πŸ“ Project Structure

Cataract-prediction-system/
β”‚
β”œβ”€β”€ .vscode/                    # VS Code configuration
β”œβ”€β”€ model/                      # Trained model directory
β”‚   └── efficientnet_b0_model.h5
β”œβ”€β”€ static/                     # Static files (CSS, JS, Images)
β”‚   β”œβ”€β”€ auth.js
β”‚   β”œβ”€β”€ BabyYodaGroguGIF.gif
β”‚   β”œβ”€β”€ eye.png
β”‚   β”œβ”€β”€ style.css
β”‚   └── user_cred.sql
β”œβ”€β”€ templates/                  # HTML templates
β”‚   β”œβ”€β”€ dashboard.html
β”‚   β”œβ”€β”€ index.html
β”‚   β”œβ”€β”€ login.html
β”‚   β”œβ”€β”€ signup_patient.html
β”‚   └── signup_staff.html
β”œβ”€β”€ uploads/                    # User uploaded images
β”‚   β”œβ”€β”€ download.jpg
β”‚   β”œβ”€β”€ image_2.jpeg
β”‚   └── image3-1.png
β”œβ”€β”€ venv/                       # Virtual environment
β”‚   β”œβ”€β”€ Include/
β”‚   β”œβ”€β”€ Lib/
β”‚   └── Scripts/
β”œβ”€β”€ .gitignore                  # Git ignore file
β”œβ”€β”€ app.py                      # Main Flask application
β”œβ”€β”€ demo.py                     # Demo/testing script
β”œβ”€β”€ LICENSE                     # License file
β”œβ”€β”€ README.md                   # Project documentation
└── requirements.txt            # Python dependencies

πŸš€ Installation

Prerequisites

  • Python 3.7 or higher
  • pip (Python package installer)
  • Virtual environment (recommended)

Step-by-Step Installation

  1. Clone the repository
git clone https://github.com/yourusername/Cataract-prediction-system.git
cd Cataract-prediction-system
  1. Create a virtual environment
# Windows
python -m venv venv
venv\Scripts\activate

# macOS/Linux
python3 -m venv venv
source venv/bin/activate
  1. Install required packages
pip install -r requirements.txt
  1. Set up the database
# Initialize the database using the SQL file in static folder
# Or let the application create it automatically on first run
  1. Download the trained model
  • Ensure efficientnet_b0_model.h5 is in the model/ directory
  • The model file should be approximately 47.8 MB

πŸ“‹ Requirements

Based on the project structure, the key dependencies include:

Flask==2.3.0
tensorflow==2.13.0
keras==2.13.0
numpy==1.24.0
Pillow==10.0.0
werkzeug==2.3.0
opencv-python==4.8.0
scikit-learn==1.3.0
pandas==2.0.0
matplotlib==3.7.0

Note: Check requirements.txt for the complete and exact version list

🎯 Usage

Running the Application

  1. Start the Flask server
python app.py
  1. Access the application
  • Open your web browser
  • Navigate to http://localhost:5000 or http://127.0.0.1:5000

User Workflow

  1. Registration

    • Choose between Patient or Staff signup
    • Fill in required credentials
    • Create account
  2. Login

    • Enter your credentials
    • Access the dashboard
  3. Upload Image

    • Navigate to the prediction section
    • Upload an eye fundus image (JPG, JPEG, PNG)
    • Submit for analysis
  4. View Results

    • See prediction results on the dashboard
    • View confidence scores
    • Download or save results

🧠 Model Details

EfficientNetB0 Architecture

  • Base Model: EfficientNetB0 (pre-trained on ImageNet)
  • Transfer Learning: Fine-tuned for cataract detection
  • Input Size: 224x224x3 (RGB images)
  • Output: Binary or multi-class classification
  • Training Dataset: Eye fundus images with cataract annotations

Model Performance

The model has been trained to classify:

  • Normal eye (no cataract)
  • Cataract-affected eye
  • Severity levels (if applicable)

Expected accuracy metrics should be documented based on your validation results

πŸ“Š Dataset

The system works with eye fundus images showing:

  • Normal retinal images
  • Images with various stages of cataract
  • Different types of cataracts (cortical, nuclear, posterior subcapsular)

Sample Images

The uploads/ folder contains example images:

  • download.jpg: Cataract example 1
  • image_2.jpeg: Fundus image example
  • image3-1.png: Cataract example 2

πŸ” Security Features

  • Password hashing for user credentials
  • Session management for logged-in users
  • Secure file upload validation
  • SQL injection prevention
  • CSRF protection

🎨 User Interface

Pages

  1. Index Page (index.html)

    • Landing page with system introduction
    • Quick access to login/signup
  2. Login Page (login.html)

    • Secure authentication
    • Error handling
  3. Signup Pages

    • signup_patient.html: Patient registration
    • signup_staff.html: Medical staff registration
  4. Dashboard (dashboard.html)

    • Upload interface
    • Prediction results
    • User profile management

πŸ§ͺ Testing

Run the demo script to test model predictions:

python demo.py

This will test the model with sample images and display results.

🀝 Contributing

Contributions are welcome! Please follow these steps:

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

πŸ‘₯ Authors

πŸ™ Acknowledgments

  • EfficientNet model creators (Google Research)
  • Medical datasets providers
  • Open-source community
  • Healthcare professionals for domain expertise

πŸ“š References

πŸ“± Screenshots

Upload Interface

Upload Example

Prediction Results

Fundus Analysis

Detection Example

Cataract Detection


Note: This is a medical assistance tool and should not replace professional medical diagnosis. Always consult with qualified healthcare professionals for medical decisions.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors