Skip to content

404soulnotfound/drowsiness-detector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Drowsiness and Distraction Detector.

It is a real time driver monitoring system that uses facial landmark detection to identify signs of drowsiness, yawning and distraction(head tilt). It avoids accidents on road as it triggers visual alerts.

Setup

Pre requisites- Python 3.8 or higher, pip, a webcam Clone the repository Create a virtual environment Install dependencies

How it works

When the eye is open EAR approx 0.30+. When it closes EAR drops to 0. So if EAR stays below 0.22 for 20+ frames consecutively a drowsiness alert is triggered. if MAR exceeds 0.6 yawn is detected The angle between the nose tip and chin landmarks is computed. If the angle exceeds 25 degrees a head tilt warning is fired.

What makes this different

Most drowsiness detectors only track eye closure. This system tracks three signals simultaneously:

  • Eye closure — Eye Aspect Ratio (EAR) with a 20-frame temporal filter to eliminate false alarms from normal blinks
  • Yawning — Mouth Aspect Ratio (MAR) detects early fatigue signs
  • Head tilt — Geometric angle between nose and chin landmarks flags distraction or phone use

Built with MediaPipe (no external model files needed) instead of dlib — faster, lighter, works on CPU at 30+ FPS.

Libraries used

OpenCV MediaPipe NumPy

How to stop

press Q on the video window

About

Real-time driver drowsiness detection using facial landmarks. Detects eye closure (EAR), yawning (MAR), and head tilt simultaneously. Triggers visual alerts before fatigue-related accidents occur. Built with OpenCV and MediaPipe.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages