Drowsiness Detection Application


Drowsiness while driving is common problem in the world. Especially, during long distance drives when a person is alone. A number of commercial solutions are available in the industry. In this small project, an attempt has been made to develop an efficient solution in this regard. We can use this application to detect drowsiness while driving; it can help us to avoid crashes caused by fatigue by alarming drivers to take a break in time. In this product, we measure physical activities like eye blinking (open/close state of eyes), duration in which eye remained close, sagging posture, and leaning of head. We can set a threshold value for each posture and when the threshold value crosses the limit, an alert (in this case a siren) blows out.

Flow of the Application:

  1. Consider a person who is driving a car and a drowsiness detection enabled cam is fixed on the cars’ dashboard, where his face can be viewed properly. Here we have used dlib to detect facial landmark as shown in figure 1 below:

Figure 1: Facial Landmark detection

  • In the second stage, it identifies the eye region by using the eye aspect ratio (EAR) [1]. In this work, the authors proposed a fast and reliable method to detect eye blinking. It estimates the landmark positions, extracts a single scalar quantity – eye aspect ratio (EAR) – characterizing the eye-opening in each frame. Further, an SVM classifier detects eye blinks as a pattern of EAR values in a short temporal window.

Figure 2: Eye detection

  • In the third stage we will incorporate a condition that if the eyes remains closed for more than 5 secs (editable), a sound will be alarmed. This is done by calculating the Eucledian distance if the eyes are closed for a period of time. It compute the euclidean distance between the horizontal eye landmark (x, y)-coordinates
  • In our case we monitor the eye aspect ratio and if it falls and does not increase again, it means person has fallen asleep.

Figure 3: Eyes closed

Platform Specifications used:

  • Language: Python
  • Libraries: OpenCV, dlib
  • Classifiers: SVM

Other Potential Applications:

  1. Attention detection during online/video conferences
  2. Watchman during night duties

Demo Video:


 [1] Soukupová, Tereza and Jan Cech. “Real-Time Eye Blink Detection using Facial Landmarks.” (2016).


No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *