by akshaybahadur21

akshaybahadur21 / Drowsiness_Detection
226 Stars 142 Forks Last release: Not found MIT License 14 Commits 0 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

Drowsiness Detection OpenCV

This code can detect your eyes and alert when the user is drowsy.



This can be used by riders who tend to drive for a longer period of time that may lead to accidents

Code Requirements

The example code is in Python (version 2.7 or higher will work).


1) import cv2 2) import imutils 3) import dlib 4) import scipy


A computer vision system that can automatically detect driver drowsiness in a real-time video stream and then play an alarm if the driver appears to be drowsy.


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 less than 0.25, Alert is generated.


Summing up

For more information, see

Working Example


To run the code, type

python Drowsiness_Detection.py
python Drowsiness_Detection.py

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.