This is a Python-based real-time Drowsiness Detection System that uses a webcam to detect signs of drowsiness by monitoring the Eye Aspect Ratio (EAR) through facial landmarks.
If the user's eyes remain closed for a certain number of consecutive frames, the system triggers:
- 🔔 Beep alarm
- 🗣️ Voice alert: "Wake up! You're feeling drowsy."
- Real-time facial landmark detection
- Eye Aspect Ratio (EAR) calculation
- Drowsiness alert with beeping sound
- Text-to-speech voice warning
- Live webcam visualization with eye landmarks
- Python 3.11
- OpenCV
- Dlib (with
shape_predictor_68_face_landmarks.dat) - NumPy
- SciPy
- Pyttsx3 (text-to-speech)
- Winsound (for beep alert on Windows)
- The webcam captures live video.
- Dlib’s 68 facial landmark model locates eyes.
- The Eye Aspect Ratio (EAR) is computed for each frame.
- If eyes remain closed beyond a threshold duration, the system:
- Triggers a beep alert
- Speaks a voice warning: "Wake up! You're feeling drowsy."
Drowsy driving is a major cause of road accidents due to slow reaction time and loss of alertness.
This system works like a safety assistant, continuously monitoring the driver's eyes and alerting them before microsleep causes harm.
- Automotive vehicles (dashboard camera-based alert system)
- Truck/fleet monitoring systems
- Railway or aviation crew fatigue detection
- Industrial workers' safety monitoring