Skip to content
No description or website provided.
Jupyter Notebook Python
Branch: master
Clone or download
Latest commit cc14e6b Apr 3, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitattributes 🎪 Added .gitattributes & .gitignore files Nov 5, 2017
.gitignore 🎪 Added .gitattributes & .gitignore files Nov 5, 2017 Fixes the dependency issue Aug 21, 2018
drownsiness_detection.ipynb Add Jupyter kernel May 28, 2018
drowsy.gif Initial phase Nov 5, 2017
eye1.jpg Initial phase Nov 5, 2017
eye2.png Initial phase Nov 5, 2017
eye3.jpg Initial phase Nov 5, 2017 Rectified a typo Dec 26, 2018
shape_predictor_68_face_landmarks.dat Initial phase Nov 5, 2017

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


Summing up

For more information, see

Working Example


To run the code, type python

You can’t perform that action at this time.