This repository consists of the two implementations for driver drowsiness detection via
- Eye monitoring being it closed or opened (Detection_for_images).
- Real-time video stream (Detection_for_videos).
- pip install dlib
- pip install skimage
- pip install scipy
- pip install numpy
- pip install cv2
- pip install imutils
You can download a trained facial shape predictor from: here
Python code: Simple app to detect the status of eye being closed or opened (sleep_detection.py (test1.jpg and test2.jpg are for testing))
Run using the command, python sleep_detection.py /path/to/shape_predictor_68_face_landmarks.dat test1.jpg
To run the code, type python Drowsiness_Detection.py
Each eye is represented by 6 (x, y)-coordinates, starting at the left-corner of the eye (as if you were looking at the person), and then working clockwise around the eye:
It checks 20 consecutive frames and if the Eye Aspect ratio is lesst than 0.25, Alert is generated.
For more information look here.
- This implementation is inspired by Akshay Bahadur's project.
- This implementation also took inspiration from Taha Emara's work.