A simple Drowsiness Detection module for humans. ๐ด ๐ซ ๐
Last updated Aug 6, 2026
543
Stars
263
Forks
4
Issues
0
Stars/day
Attention Score
34
Topics
Language breakdown
Jupyter Notebook 71.1%
Python 28.9%
โธ Files
click to expand
README
Drowsiness Detection OpenCV ๐ด ๐ซ ๐
This code can detect your eyes and alert when the user is drowsy.
Applications ๐ฏ
This can be used by riders who tend to drive for a longer period of time that may lead to accidentsCode Requirements ๐ฆ
The example code is in Python (version 2.7 or higher will work).Dependencies
1) import cv2 2) import imutils 3) import dlib 4) import scipy
Description ๐
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.
Algorithm ๐จโ๐ฌ
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.

Relationship

Summing up

For more information, see
Results ๐

Execution ๐
To run the code, typepython Drowsiness_Detection.py
python Drowsiness_Detection.py
Made with โค๏ธ and ๐ฆ by Akshay Bahadur
๐ Cite Us
To cite this guide, use the below format:
@article{Drowsiness_Detection, author = {Bahadur, Akshay}, journal = {https://github.com/akshaybahadur21/Drowsiness_Detection}, month = {01}, title = {{Drowsiness_Detection}}, year = {2018} }
References ๐ฑ
- Adrian Rosebrock, PyImageSearch Blog๐ More in this category