Skip to content

Mpradeep-dev/drowsiness-detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Drowsiness Detection System

📌 Overview

This project is a real-time drowsiness detection system that monitors eye activity using a webcam and alerts the user when signs of fatigue are detected. It enhances safety in critical situations such as driving or operating machinery.


⚡ Features

Real-time face and eye detection
Eye blink and drowsiness analysis using facial landmarks
Visual feedback: "Active," "Drowsy," or "Sleeping" state
Buzzer alert if the user is detected as "Sleeping"


🛠 Technologies Used

  • Python: Core logic and detection algorithms
  • OpenCV: Video capture and image processing
  • Dlib: Face and facial landmark detection
  • NumPy: Numerical computations
  • Pillow: GUI video feed display
  • Tkinter: Graphical user interface
  • Playsound: Alert sounds

🔍 How It Works

📸 Face Detection: Detects the user's face using Dlib’s pre-trained model.
👀 Eye Aspect Ratio (EAR): Measures eye openness using key facial landmarks.
State Classification:

  • Active: Eyes are open and blinking normally.
  • Drowsy: Eyes are slightly closed or blinking slowly.
  • Sleeping: Eyes remain closed for over 7 seconds. 🔊 Audio Alert: A buzzer sound is triggered if the user remains "Sleeping".

⚙️ Setup Instructions

1️⃣ Install Dependencies:

pip install opencv-python numpy dlib imutils playsound pillow

2️⃣ Download Pre-Trained Model:

  • Download shape_predictor_68_face_landmarks.dat from Dlib’s GitHub and place it in the project directory.

3️⃣ Run the Project:

python drowsiness_detection.py

📌 Usage Guide

1️⃣ Open the application.
2️⃣ The webcam feed will display in the GUI.
3️⃣ The system monitors eye activity and updates the state: "Active," "Drowsy," or "Sleeping".
4️⃣ If "Sleeping" is detected for over 7 seconds, an alert will sound.


📂 Project Structure

Drowsiness Detection/
│
├── drowsiness_detection.py         # Main script
├── buzzer.mp3                      # Audio alert file
├── shape_predictor_68_face_landmarks.dat  # Pre-trained model
└── README.md                       # Project documentation

🚗 Applications

🔹 Driver Safety: Prevent drowsy driving accidents.
🔹 Workplace Monitoring: Improve worker alertness in critical environments.
🔹 Personal Alertness: Help individuals stay focused during long tasks.


🔮 Future Enhancements

🔹 Yawning detection for better accuracy.
🔹 Deep learning models for advanced drowsiness prediction.
🔹 Mobile-friendly version of the application.
🔹 Multilingual support for international users.


📜 License

This project is available for personal or educational use. Feel free to customize or extend it! 🚀


🏆 Connect with Me!

🔥 Stay Alert, Stay Safe! 🚀

About

This project is a real-time drowsiness detection system designed to monitor a user's eye activity and alert them if signs of drowsiness or sleep are detected. It leverages computer vision techniques and facial landmark detection to analyze eye blinking patterns, ensuring the safety of drivers or individuals performing critical tasks.

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages