Drowsiness Detector is a computer vision system that automatically detects if the user drowsiness in real-time from a live video stream and then alert the user with an alarm notification.
This repository is based on the tutorial by Adrian Rosebrock
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
- Install and set up Python 3.
- Install cmake in your system
-
Clone the repository.
git clone https://github.com/bedangSen/Drowsiness-Detector.git
-
Move into the project directory.
cd Drowsiness-Detector
-
(Optional) Running it in a virtual environment.
- Downloading and installing virtualenv.
pip install virtualenv
- Create the virtual environment in Python 3.
virtualenv -p C:\Python37\python.exe test_env
-
Activate the test environment.
- For Windows:
test_env\Scripts\Activate
- For Unix:
source test_env/bin/activate
-
Install all the required libraries, by installing the requirements.txt file.
pip install -r requirements.txt
-
Installing the dlib library.
-
If you are using a Unix machine, and are facing some issues while trying to install the dlib library, follow this guide.
-
If you are using a Windows machine, install cmake and restart your terminal.
-
-
Run the application.
python detect_drowsiness.py --shape-predictor shape_predictor_68_face_landmarks.dat --alarm alarm.wav
- OpenCV Library - Most used computer vision library. Highly efficient. Facilitates real-time image processing.
- imutils library - A collection of helper functions and utilities to make working with OpenCV easier.
- Dlib library - Implementations of state-of-the-art CV and ML algorithms (including face recognition).
- scikit-learn library - Machine learning in Python. Simple. Efficient. Beautiful, easy to use API.
- Numpy - NumPy is the fundamental package for scientific computing with Python.