Coder Social home page Coder Social logo

manojpgupta / ddd-estimator-opencv Goto Github PK

View Code? Open in Web Editor NEW

This project forked from smasis001/ddd-estimator-opencv

0.0 1.0 0.0 79.08 MB

Driver Alertness Detection using Ensemble of Regression Trees and Implemented in OpenCV

Python 0.90% Jupyter Notebook 99.10%

ddd-estimator-opencv's Introduction

Driver Drowsiness and Distraction Estimator (DD&D Estimator) with OpenCV

What is DD&D Estimator?


A python class to gauge in real time the level of drowsiness and distraction of a driver using OpenCV, Dlib, a pre-trained model and a number of computer vision techniques.

It's the first step of a bigger project that involves 3 repositories aimed at producing a good prototype to tackle driver drowsiness and distraction.

How does it work?


It focuses on detecting any or all of the following 3 events:

  • Head movement beyond a threshold → distraction
  • Eye gaze beyond a threshold → distraction
  • Yawn beyond a threshold → drowsiness
  • Eye closure beyond a threshold → drowsiness

and then with this estimating a level of distraction from 1-10 (modelled after the subjective "KSS" alertness scale) using the following formula:

The idea is to have something measurable that can be used to alert the driver (or even used for training purposes).

State of the Repo


This repo was committed after project was finished so there's no plans of maintaining it but we'd love to get your thoughts. It's by no means perfect since the underlying model has limitations with occluded faces and is not illumination and angle invariant. Also, there are issues with interference from other passenger or camera closeness or facial hair. This is why another dataset was trained on producing a slightly better model (in another repo) but it's a good start.

Quick Start


1. Clone or download repo

git clone https://github.com/smasis001/ddd-estimator-opencv

2. Install the requirements

3. Run one of the demos

the demo for live testing using your device’s front-facing camera

python demo1.pyx

or the demo for testing using a video file

python demo2.pyx /path/to/video.avi

They both have the same command line arguments:

Command Meaning
'p' Show facial landmarks
'b' Show bounding cube used for head pose estimation
'g' Show gaze line used for gaze direction estimation
'e' Show eye info used for eye openness estimation
'm' Show mouth info used for yawn estimation
'd' Show drowsiness & distraction info used for calculating KSS (active by default)
'n' Show nothing
'r' Refresh/clear the frame of all info back to defaults
'l' Save log file
'q' Quit the program
‘h’ Help ~ show this information

4. Batch Processing

if you want to calculate some distraction or drowsiness metric over time for a folder of video files then this script will get the job done and output csv files with the same name of every video file

python batch_process.pyx /path/to/videos/

The dataset we used for testing can be found here. There's also a couple of python notebooks used during the data exploration and testing phases in the test folder.

Authors


Serg Masis

Jay Rodge

References


  • V. Kazemi, J. Sullivan, One millisecond face alignment with an ensemble of regression trees, IEEE Conference on Computer Vision and Pattern Recognition (CVPR), IEEE Computer Society, 2014, p. 1867-1874 (ISBN: 978-1-4799-5118-5)

  • Shahid A., Wilkinson K., Marcu S., Shapiro C.M. (2011) Karolinska Sleepiness Scale (KSS). In: Shahid A., Wilkinson K., Marcu S., Shapiro C. (eds) STOP, THAT and One Hundred Other Sleep Scales. Springer, New York, NY

  • S. Abtahi, M. Omidyeganeh, S. Shirmohammadi, and B. Hariri, “YawDD: A Yawning Detection Dataset”, Proc. ACM Multimedia Systems, Singapore, March 19 -21 2014, pp. 24-28. DOI: 10.1145/2557642.2563678

ddd-estimator-opencv's People

Watchers

 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.