A real-time driver drowsiness detection system using Mediapipe Face Mesh, OpenCV, and EAR/MAR-based alerting.
| Feature | Description |
|---|---|
| 👁️ Real-time Eye Tracking | Uses Mediapipe Face Mesh to track eye landmarks frame-by-frame |
| 😴 Drowsiness Detection (EAR) | Detects prolonged eye closure using Eye Aspect Ratio |
| 🗣️ Yawn Detection (MAR) | Identifies yawning patterns using Mouth Aspect Ratio |
| 🔊 Instant Alerts | Triggers audio alarms on detecting drowsiness |
| 🎥 Streamlit Web App | Live, browser-based detection using webcam |
(Add gif or images here)
demo.gif
driver-drowsiness-detection-system
│── drowsy_detection.py
│── audio_handling.py
│── streamlit_app.py
│── requirements.txt
│── README.md
│
├── audio/
│ └── wake_up.wav
│
├── test-open-eyes.jpg
└── test-close-eyes.jpg
- Python
- OpenCV
- Mediapipe Face Mesh
- Streamlit
- streamlit-webrtc
- pydub / av
git clone https://github.com/vatsalm1611/driver-drowsiness-detection-system
cd driver-drowsiness-detection-systempip install -r requirements.txtstreamlit run streamlit_app.pypython drowsy_detection.py- Detects eye openness using 6 facial landmark points.
- If EAR < threshold for continuous duration → Drowsiness detected.
- Detects wide mouth opening (yawn).
- MAR > threshold → Yawn event.
Drowsiness = EAR below threshold for X seconds
Yawn = MAR above threshold
Both metrics are computed per frame → real-time detection.
Contributions are welcome!
- Fork the repo
- Create a new branch
- Commit your changes
- Open a Pull Request
This project is licensed under the MIT License.
- Mediapipe team
- OpenCV community
- Streamlit contributors
If you like this project, ⭐ the repository!