- Real-time monitoring of driver's eyes using a camera
- Fatigue and drowsiness detection algorithm
- Timely alerts to prevent the driver from falling asleep
- Non-intrusive and easy to set up
- Progressive Web App (PWA) support - Install like a native app!
- Offline functionality with caching
- Fast loading with optimized performance on System
The Driver Drowsiness Detection System is a non-intrusive solution designed to monitor and detect signs of fatigue in drivers. By analyzing eye states through a camera feed, the system can identify early symptoms of drowsiness and issue timely warnings, helping to prevent accidents caused by driver fatigue. This project aims to enhance road safety, especially for those driving long distances who may not recognize their own drowsiness in time.
If you find this project helpful, please consider giving it a star β on GitHub!
It helps others discover the project and motivates us to keep improving it.
π Click the β button at the top-right of this page!
- Real-time monitoring of driverβs eyes using a camera
- Fatigue and drowsiness detection algorithm
- Timely alerts to prevent the driver from falling asleep
- Non-intrusive and easy to set up
- Python
- OpenCV
- Dlib or Mediapipe (for facial landmark detection)
- NumPy, Pandas
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Clone the repository:
git clone https://github.com/Gagandeep-2003/Driver-Drowsiness-Detection-System.git cd Driver-Drowsiness-Detection-System
-
Install dependencies:
pip install -r requirements.txt
-
Download the model:
The dlib facial landmark model is required for blink detection. Download it from the link below, unzip it, and place the
shape_predictor_68_face_landmarks.dat
file inside the/models
directory.- Download Link: shape_predictor_68_face_landmarks.dat
-
Run the application:
python main.py
(Replace
main.py
with the actual entry point if different.)
- Ensure your webcam is connected.
- Run the application as shown above.
- The system will start monitoring your eyes and alert you if signs of drowsiness are detected.
driver-drowsiness-detection-system/
β
βββ main.py # Entry point for the system
βββ blinkDetect.py # Drowsiness detection script
βββ lanedetection.py # Lane detection module
βββ ui.py # User interface handling
βββ requirements.txt # Python dependencies
βββ CONTRIBUTING.md # Contribution guidelines
βββ DEPLOYMENT.md # Deployment instructions
βββ PWA_README.md # PWA installation & usage
βββ PWA_IMPLEMENTATION.md # Technical details of PWA
β
βββ models/ # Pre-trained ML models
β βββ haarcascade_frontalface_default.xml
β
βββ streamlit_app/ # Web app (Streamlit + PWA)
β βββ streamlit_app.py
β βββ streamlit_app_pwa.py
β βββ manifest.json
β βββ sw.js
β βββ icons/ # App icons for PWA
β
βββ assets/ # Images, audio, and test files
β βββ alarm.wav
β βββ alarm.mp3
β βββ eye.PNG
β βββ eye_aspect_ratio.PNG
β βββ face.PNG
β βββ test_image.jpg
We welcome contributions to improve this project! To get started:
- Star β this repository to show your support.
- Fork π΄ the repository to your own GitHub account.
- Create a new branch for your feature or bugfix.
- Make your changes and commit them with clear messages.
- Push your branch to your forked repo.
- Open a Pull Request describing your changes.
We are actively tracking progress and assigning tasks for GSSoC'25 in our GitHub Project Board.
You can see which issues are To Do, In Progress, or Completed, and pick one to start contributing.
π View the GSSoC 2025 Roadmap Project β
βΉοΈ To work on an issue:
- Comment on the issue stating your interest.
- Weβll assign it to you under the appropriate GSSoCβ25 level.
- Track your progress via the Project Board.
This app version uses Streamlit + Mediapipe to detect drowsiness via webcam directly in the browser.
# Standard web app
streamlit run streamlit_app/streamlit_app.py
# Or run the enhanced PWA version
streamlit run streamlit_app/streamlit_app_pwa.py
NEW! This project now supports Progressive Web App functionality! Install it like a native app on your device.
- π± Installable: Add to home screen on mobile/desktop
- π Fast Loading: Cached resources for better performance
- π Offline Support: Basic functionality without internet
- π² App-like Experience: Full-screen, native app behavior
- Mobile: Open in browser β Menu β "Add to Home Screen"
- Desktop: Look for install icon in address bar β Click "Install"
π Complete PWA Guide - Detailed installation and usage instructions
Dependencies: Install using:
pip install -r requirements.txt
Features:
- Real-time Eye Aspect Ratio (EAR) monitoring
- Drowsiness warning overlay
- Web-based UI with live video
- PWA installable web app
- Offline caching support
Note: Please do not add a license section. A contributor will be adding license information soon.
If you have any questions or need guidance, feel free to open an issue or ask in the discussions!
Thank you for your interest in improving the Driver Drowsiness Detection System! Your contributions are greatly appreciated.