Skip to content

srungta/drowsiness-detector

Repository files navigation

drowsiness-detector

Intent

Detecting drowsiness of eyes using open cv :)

Inspiration

This code is based on the blog post here. The inspiration to do this comes from akshaybahadur21's github repo.

Overview

The code flow is simple:

  • Get a camera feed.
  • In each frame, find the eyes.
  • The height to width ratio of the eye tells us whether how open or closed it is.
  • If the ratio is high, that means the eyes are more open and vice versa.
  • if the ration goes below a threshold (EYE_AR_THRESHOLD), we consider the eyes as closed.
  • if the eyes remain closed for EYE_AR_CONSECUTIVE_FRAMES number of frames, we sound the alarm.

And that's it.

How to run

  • Clone the repo.
  • Run pip install -r requirements.txt in the directory.

[I recommend creating separate environments [like miniconda env] for this installations]

  • Run python detector.py

About

Detecting drowsiness of eyes using open cv :)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages