Skip to content

AI-powered Driver Drowsiness Detection System using Computer Vision & Machine Learning for real-time driver alertness monitoring and accident prevention.

License

Notifications You must be signed in to change notification settings

Gagandeep-2003/driver-drowsiness-detection-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

72 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Driver Drowsiness Detection Key Features

  • 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

GitHub stars GitHub forks GitHub issues

Project Overview

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.

⭐ Support the Project

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!

GitHub stars

Key Features

  • 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

Technologies Used

  • Python
  • OpenCV
  • Dlib or Mediapipe (for facial landmark detection)
  • NumPy, Pandas

Optional: create a virtual environment

python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate

Setup Instructions

  1. Clone the repository:

    git clone https://github.com/Gagandeep-2003/Driver-Drowsiness-Detection-System.git
    cd Driver-Drowsiness-Detection-System
  2. Install dependencies:

    pip install -r requirements.txt
  3. 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.

  4. Run the application:

    python main.py

    (Replace main.py with the actual entry point if different.)

Usage

  • 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.

Folder Structure

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

Contribution Guidelines

We welcome contributions to improve this project! To get started:

  1. Star ⭐ this repository to show your support.
  2. Fork 🍴 the repository to your own GitHub account.
  3. Create a new branch for your feature or bugfix.
  4. Make your changes and commit them with clear messages.
  5. Push your branch to your forked repo.
  6. Open a Pull Request describing your changes.

πŸ“‹ Project Board & Roadmap

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:

  1. Comment on the issue stating your interest.
  2. We’ll assign it to you under the appropriate GSSoC’25 level.
  3. Track your progress via the Project Board.

🌐 Streamlit Web App (New Feature!)

This app version uses Streamlit + Mediapipe to detect drowsiness via webcam directly in the browser.

Usage:

# Standard web app
streamlit run streamlit_app/streamlit_app.py

# Or run the enhanced PWA version
streamlit run streamlit_app/streamlit_app_pwa.py

πŸ“± Progressive Web App (PWA) Support

NEW! This project now supports Progressive Web App functionality! Install it like a native app on your device.

PWA Features:

  • πŸ“± 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

Quick PWA Installation:

  1. Mobile: Open in browser β†’ Menu β†’ "Add to Home Screen"
  2. 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.

⬆️ Back to Top