Code Monkey home page Code Monkey logo

drowsiness-detection's Introduction

drowsiness-detection

A simple project that constantly monitors the driver and plays an alert sound to wake the driver up if he/she is drowsy.

Dependencies :

  1. opencv
  2. scipy
  3. dlib
  4. sounddevice
  5. soundfile
  6. numpy

Working :

Using the dlib library, we can find the facial landmarks such as eyes, nose, ears, mouth,etc as illustrated in the below figure.

Alt

A shape detector is required as well, which is provided in the repo. Referring to the paper Real-Time Eye Blink Detection using Facial Landmarks, Tereza Soukupova and Jan Cech,(2016), Eye Aspect Ratio(EAR) is given by the following formula :

Alt

where, p1,...,p6 are as shown below : Alt

The coordinates for each landmark point can be found using the part number as listed in the Facial Landmarks picture above, which is then used to compute the Eye Aspect Ratio.

The authors of the above referred paper suggest to take the average of EAR of both eyes. A threshold is set for the EAR below which the driver is said to be drowsy. If the driver is 'drowsy' for 30 consecutive frames, a loud alarm sound is played in order to wake the driver up.

Usage

To run the program, simply type the following command :

python3 Drownsiness_Detection.py

Applications

Can be implemented on a microcontroller(after optimizing the code) and used in cars to sound an alarm if the driver is found to be drowsy.

References

Real-Time Eye Blink Detection using Facial Landmarks, Tereza Soukupova and Jan Cech,(2016)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.