GithubHelp home page GithubHelp logo

shamshul2007 / sleepy-driver-alert Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ankush3103/sleepy-driver-alert

0.0 0.0 0.0 41.31 MB

A deep learning project that detects if a driver is sleepy by focusing on the driver's eyes.

Python 100.00%

sleepy-driver-alert's Introduction

Sleepy Driver Alert - A Computer vision car safety project

Driver sleeping in a Tesla

Objective

A huge number of car accidents take place because the driver slips into a slumber and looses control of the car. One way to prevent such mishaps is using a deep learning program with convolutional neural networks to detect if the driver is feeling sleepy based on his or her eye movement.

Data

To solve this problem, we need a wide variety of data - people with different heights, skin colors, with and without correctional glasses, with varying amount of light and exposure. Collecting this data would have been a huge problem but fortunately a datset with this data already existed. The dataset has been taken from OpenCV's great haar cascade repository different images with varying features.

Methodology

(This program uses OpenCV, TensorFlow, Keras, and Pygame libraries)

  • We use openCV's input tools to capture an image

  • We then convert the image to greyscale so as to make it usable with openCV library.

  • Create a region of interest i.e the pair of eyes.

  • Use CNN classifier to detect wether the eyes are open or not.

  • Calculate a relative score for the given image as compared to obtained dataset to detect the amount of drowsiness.

  • If sleepy score is beyond a certain score (here, 15), raise an alarm for the driver and/or alert the authorities.

Running the program

  • You must have Python2.7 or higher installed.

  • You must have installed, the python libraries used in the program. You may do so by typing the following command in terminal or command prompt;
    pip install tensorflow keras pygame opencv-python-headless

  • Then you may clone the repository.

  • run the main file;
    python path/sleepy-driver-detector.py run or python path/alter_external_method.py run

  • Make sure you have the correct webcam permissions enabled (trust me i spent a lot of time trying to debug something when the actual issue was that my IDE did not have access to my webcam.)

  • And finally, don't sleep while driving like come on.

Issues

  • Main file (sleepy-driver-alert.py) does not run -- issues with openCV rectangle function. [Resolved]

sleepy-driver-alert's People

Contributors

ankush3103 avatar ph4ni 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.