A real-time drowsiness detection system using computer vision, OpenCV, and other relevant libraries. This system detects when a person is drowsy and alerts them to prevent accidents.
- Real-time drowsiness detection
- Alerts the user with a sound when drowsiness is detected
- Utilizes facial landmarks to detect eye closure and yawning
- Facial Landmark Detection: Uses dlib’s pre-trained shape predictor model to detect facial landmarks. The landmarks around the eyes are used to compute the Eye Aspect Ratio (EAR).
- Eye Aspect Ratio (EAR): The EAR is calculated based on the distances between the vertical eye landmarks and the horizontal eye landmarks. When the EAR falls below a certain threshold, it indicates that the eyes are closed.
- Yawning Detection: Measures the distance between upper and lower lips to detect yawning, another indicator of drowsiness.
- Alert Mechanism: When drowsiness or yawning is detected for a certain duration, the system triggers an alert sound to wake up the user.
- Python 3.x
- OpenCV
- dlib
- imutils
- scipy
- numpy
- Clone the repository:
git clone git@github.com:sanskaryo/Drowsiness_detection_using_dlib_and_cv.git cd drowsiness-detection-system python drowsiness_detection.py --webcam 0
- Download the shape predictor and extract the .dat file.
- Place the
shape_predictor_68_face_landmarks.dat
file in the project directory.
This version includes structured sections, improved readability, and direct instructions for installation and usage. Adjust paths and details as necessary for your specific setup.