A computer vision application that detects drowsiness by monitoring eye state using facial recognition.
This script uses OpenCV to detect faces and track eye state (open/closed) in real-time video, designed to alert drowsy drivers.
- 👁️ Eye State Detection — Monitors if eyes are open or closed
- 😴 Drowsiness Alert — Detects when driver may be falling asleep
- 📹 Real-time Processing — Works with live webcam feed
- 🎯 Face Tracking — Locates and tracks face in frame
- Python 3.x
- OpenCV (
cv2) - dlib (for facial landmarks)
- NumPy
pip install opencv-python dlib numpypython sleep_detector.py- Captures video from webcam
- Detects face using Haar Cascade / dlib
- Identifies eye regions
- Calculates eye aspect ratio (EAR)
- Alerts if eyes closed for extended period
- Driver drowsiness detection
- Workplace fatigue monitoring
- Safety systems
MIT
All PRs are checked for:
- ✅ Syntax (Python, JS, TS, YAML, JSON, Dockerfile, Shell)
- ✅ Secrets (No hardcoded credentials)
- ✅ Security (High-severity vulnerabilities)