Code Monkey home page Code Monkey logo

drowsiness-detection's Introduction

Drowsiness Detection

Introduction

This project is aimed towards solving the problem of detecting the tiredness level of drivers. If the driver is found to be drowsy, an alarm will be triggered to make him or her more attentive. This is done using the techniques like deep learning and computer vision for object detection. The project was implemented on a raspberry pi and a video camera.

Hardware Required:

  1. Raspberry Pi 3
  2. Picamera

This project uses python 3 along with openCV for image processing and dlib for facial landmarks detection. Since raspberry pi provides limited memory and processing speed, we used a combination of Haar Cascades and HOG to detect the face and the eyes of the driver.

Haar cascade was used for detecting the face since it is inexpensive from a computation standpoint whereas HOG was used for detecting eyes in the face. HOG although, computationally expensive provides accurate boundaries for eyes. To perform this successfully, we used dlib, which is a free to use library on python to detect eyes using HOG.

Once the boundary of the eyes are found, we then find the aspect ratio, ie length/height of the eye and if it is below a certain threshold the program triggers an alarm

Setup

Note:The user should be comfortable using linux based operating systems and raspberry pi.

Install OpenCV, Dlib and Numpy on your raspberry pi. Download the repository and connect the picamera module if you are using a USB web camera, you need to make a slight change in the code. on the line no. 80, set the usePicamera=False. You also need to download the .dat file for dlib facial landmarks.

Run the following command in the program directory:

python drowsiness.py --cascade haarcascade_frontalface_default.xml --shape-predictor shape_predictor_68_face_landmarks.dat

drowsiness-detection's People

Contributors

heisenberg141 avatar

Stargazers

 avatar

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.