--- title: OJOS AI emoji: 👁️ colorFrom: green colorTo: blue sdk: docker app_port: 7860 pinned: false --- # 👁️ OJOS AI — Advanced Eye Disease Detection Web App A state-of-the-art deep learning web application that detects and classifies multiple eye diseases with **96.69% validation accuracy** using fine-tuned Convolutional Neural Networks (CNNs). Equipped with a premium glassmorphic dark-mode UI. --- ## 🎯 Key Features - **Multi-Disease Classification**: Detects 5 distinct conditions: - 👁️ **Cataract** - ⚠️ **Diabetic Retinopathy** - 🔴 **Glaucoma** - 👓 **Myopia** - ✅ **Healthy Eye** - **High Performance**: Achieves **96.69% accuracy** on clinical validation datasets. - **Advanced Preprocessing**: Uses LAB color space **CLAHE (Contrast Limited Adaptive Histogram Equalization)** to enhance contrast in retinal/eye images, matching clinical standards. - **Premium User Interface**: Dark glassmorphic theme with sliding login/signup panel, drag-and-drop upload, scanning progress animation, and multi-probability confidence charts. - **Robust Authentication**: Fully integrated SQLite database system for secure user registration and login session management. - **Keras 3 Runtime Compatibility**: Includes a custom monkeypatch to bypass quantization config parameters when loading legacy `.h5` model files. --- ## 🛠️ Tech Stack - **Backend**: Python, Flask, SQLite3 - **Deep Learning**: TensorFlow / Keras (EfficientNetV2 backbone) - **Computer Vision**: OpenCV, Pillow (PIL) - **Frontend**: HTML5, Vanilla CSS3 (Glassmorphism, Neon Accents, CSS Keyframes) - **Deployment**: Docker, Hugging Face Spaces (Git LFS) --- ## 🚀 How to Run Locally ### 1. Prerequisites Ensure you have Python 3.9+ installed. Install the required libraries: ```bash pip install tensorflow opencv-python numpy pillow flask ``` ### 2. Clone the Repository ```bash git clone https://github.com/Sharad9084/OJOS-AI.git cd OJOS-AI ``` ### 3. Run the Application ```bash python app.py ``` Open [http://localhost:5000](http://localhost:5000) in your web browser. --- ## 📁 Project Structure ``` OJOS-AI/ ├── best_eye_disease_model.h5 # Fine-tuned EfficientNetV2 multiclass model (Git LFS) ├── class_indices.json # Mapping of class names to model indices ├── app.py # Core Flask server and prediction pipeline ├── database.py # SQLite database utility functions ├── requirements.txt # Python dependencies ├── Dockerfile # Containerization config for Hugging Face Spaces ├── Procfile # Web process config ├── static/ │ ├── css/ │ │ └── style.css # Premium glassmorphic styling sheet │ ├── logo.png # Custom circular eye logo │ └── uploads/ # Directory for temporary preview images └── templates/ ├── home.html # Main landing page ├── login.html # Login & signup portal ├── prediction.html # Real-time scan and multi-probability results ├── about.html # Team / info page └── diseases_info.html # Visual medical encyclopedia ``` --- ## 💡 How It Works ### 1. Image Preprocessing & Contrast Enhancement Retinal images can have inconsistent illumination. To normalize this: - The input image is converted to the **LAB color space**. - **CLAHE** is applied on the L-channel (lightness) to enhance local contrast without over-amplifying noise. - The image is merged back, converted to RGB, and resized to **300x300**. - EfficientNetV2 normalization (`preprocess_input`) is applied. ### 2. Inference & Classification - The preprocessed image is passed into `best_eye_disease_model.h5`. - The model outputs logits/probabilities for all 5 target categories. - The front-end renders a interactive bar chart displaying the confidence percentage for every condition. --- ## ⚕️ Medical Compliance & Disclaimer - **Screening Tool Only**: This application is designed as an assistive screening tool. It does not replace professional medical diagnosis, advice, or treatment by a qualified ophthalmologist. - **Data Privacy**: Images uploaded are saved temporarily on the server for visualization and are not shared. --- ## 📞 Contact & Support Developed by **Sharad Sharma** (sharmasharad9794@gmail.com). ⭐ **If you found this project helpful, please star the repository!**