Giter VIP home page Giter VIP logo

drowsiness-detection-opencv's Introduction

Drowsiness-Detection-OpenCV

Python application to assist drivers to alert when they feel drowsy and thus reduce number of accidents. Based on research paper : http://vision.fe.uni-lj.si/cvww2016/proceedings/papers/05.pdf

Major dependency and my configurations

  • Python (Python 3.7.3)
  • OpenCV (cv2 4.4.0)
  • Dlib (dlib 19.21.1)
  • Numpy (numpy 1.16.1)

How to install Dlib:

dlib has a number of state-of-the-art implementations, including: Facial landmark detection,Correlation tracking,Deep metric learning https://github.com/davisking/dlib
References to install dlib (worked for me on windows 10): https://medium.com/@aaditya.chhabra/install-dlib-python-api-for-windows-pc-97fe35e01cd

Main command :conda install -c conda-forge dlib
Other reference to install dlib :

Basic working:

First we will try to find facial landmarks using dlib after that we will detect different part of face for example left eye,nose,jaw etc. Then we will extend this application to continous live video stream. One we are done with these we will try to findnumber of blinks of eyes using the concept of "eye aspect ratio" or EAR which is depected as below alt text

Eye aspect ratio can be defined as:

alt text

Using the above equation we will notice if we are able to properly capture these six coordinates and eye closes the EAR will be close to zero and can be a case of blinking or drowsiness. If eyes are closed (EAR < threshold) for few frames we can alert the user as this might be case of drowsiness. Here threshold = 0.3 and number of frames is 48.

Working example:

  • Example of drowsiness detection :

alt text

  • Example of capturing facial landmarks :

alt text

  • Example of facial part detection :

alt text alt text

  • Example of capturing facial landmarks on video:

alt text

  • Example of counting eye blinks :

alt text

Reference

I have followed tutorial of pyimagesearch https://www.pyimagesearch.com/2017/04/03/facial-landmarks-dlib-opencv-python/

drowsiness-detection-opencv's People

Contributors

prakhargurawa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.