/Drowsiness-Detector

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.

Primary LanguagePython

Drowsiness-Detector

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

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

  1. Install and set up Python 3.
  2. Install cmake in your system

Running the application

  1. Clone the repository.

    git clone https://github.com/bedangSen/Drowsiness-Detector.git
    
  2. Move into the project directory.

    cd Drowsiness-Detector
    
  3. (Optional) Running it in a virtual environment.

    1. Downloading and installing virtualenv.
    pip install virtualenv
    
    1. Create the virtual environment in Python 3.
     virtualenv -p C:\Python37\python.exe test_env
    
    1. Activate the test environment.

      1. For Windows:
      test_env\Scripts\Activate
      
      1. For Unix:
      source test_env/bin/activate
      
  4. Install all the required libraries, by installing the requirements.txt file.

    pip install -r requirements.txt
    
  5. Installing the dlib library.

    1. If you are using a Unix machine, and are facing some issues while trying to install the dlib library, follow this guide.

    2. If you are using a Windows machine, install cmake and restart your terminal.

  6. Run the application.

    python detect_drowsiness.py --shape-predictor shape_predictor_68_face_landmarks.dat --alarm alarm.wav
    

Built With

  • 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.

References