Abstract
Somnolence Detection is an open-source AI & Machine Learning project. Real-time driver drowsiness detection system using computer vision, OpenCV, and MediaPipe face mesh. Monitors eye movements and calculates Eye Aspect Ratio (EAR) to detect fatigue, providing immediate visual alerts for enhanced driving safety. This project implements a drowsiness detection system that monitors a user's eyes in real-time to detect signs of fatigue and alertness. Using advanced computer vision techniques, it calculates the Eye Aspect Ratio (EAR) to determine if a person's eyes are closing for extended periods, indicating potential drowsiness. It is built using Python, Computer Vision, OpenCV. Key capabilities include: Real-time eye tracking using MediaPipe Face Mesh; Eye Aspect Ratio (EAR) calculation; Visual drowsiness alerts. The complete source code is publicly available on GitHub under the MIT License, making it a useful reference for students building an AI & Machine Learning mini project or final-year project.
1. Introduction
This project implements a drowsiness detection system that monitors a user's eyes in real-time to detect signs of fatigue and alertness. Using advanced computer vision techniques, it calculates the Eye Aspect Ratio (EAR) to determine if a person's eyes are closing for extended periods, indicating potential drowsiness.
A real-time computer vision solution for driver drowsiness detection using OpenCV and MediaPipe face mesh detection.
2. Objective
Real-time driver drowsiness detection system using computer vision, OpenCV, and MediaPipe face mesh. Monitors eye movements and calculates Eye Aspect Ratio (EAR) to detect fatigue, providing immediate visual alerts for enhanced driving safety.
This project demonstrates how Python, Computer Vision, OpenCV can be applied to a real-world AI & Machine Learning problem.
3. Key Features / Modules
- Real-time eye tracking using MediaPipe Face Mesh
- Eye Aspect Ratio (EAR) calculation
- Visual drowsiness alerts
- Live EAR value display
- Face mesh visualization
- Mirror display for user comfort
4. Technology Stack
- Precise 6-point eye landmark detection
- Individual left and right eye tracking
- Real-time EAR calculation
- Dynamic threshold-based detection
- Visual alert system with on-screen warnings
- Configurable sensitivity settings
5. System Requirements
General requirements for this technology stack — check the README for exact versions.
- Python 3.8 or later
- pip / virtualenv for dependencies
- VS Code, PyCharm or Jupyter Notebook
- Git (to clone the repository)
6. Installation & Setup
git clone https://github.com/imprvhub/somnolence-detection.git
cd somnolence-detection- q - Quit the application
- Visual indicators will show:
- Green eye contours for tracking visualization
- EAR value display
- Red warning text for drowsiness alerts
# Clone the repository
git clone https://github.com/imprvhub/somnolence-detection.git
cd somnolence-detection
# Install dependencies
pip install -r requirements.txt
# Run the application
python somnolence_detection.pyFull setup instructions are in the project README.
7. Future Enhancements
Suggested extensions you can add to make this your own project.
- Deploy the model as a web app with Streamlit, Flask or FastAPI
- Compare against an additional model and report the metric difference
- Add explainability (SHAP / Grad-CAM)
8. Viva / Review Questions
Common questions examiners ask for projects in this domain.
- What dataset does the project use and how was it pre-processed?
- Which algorithm / model architecture is used and why was it chosen over alternatives?
- How are training and testing data split, and how is overfitting avoided?
- Which evaluation metrics (accuracy, precision, recall, F1) are reported and what do they mean here?
- How would you deploy this model for real users?
9. Source Code & License
This project is developed by imprvhub and published on GitHub under the MIT License. Please follow the license terms and credit the original author when you use or modify this code.
Want to build this as your internship project?
Work on an AI & Machine Learning project like this with mentor guidance, weekly reviews and an internship certificate from Training Trains, Erode — online or offline.
Apply for AI & Machine Learning Internship