DROWSINESS DETECTION AND MONITORING SYSTEM

- Wakefulness of a driver is an extremely important factor that needs to be continuously monitored.. A drowsy driver can be a cause of several mishaps and accidents on highways which could lead to loss of money, physical injuries, and the most important, loss of human life. Drowsiness detection system is a car safety technology that helps to prevent and thus reduce accidents caused by the driver getting drowsy. The system is designed for four-wheeler vehicles (or more) wherein the driver's fatigue or drowsiness is detected and alerts are generated. The proposed method will use a USB camera that captures the driver's face and eyes and processes the images to detect the driver’s fatigue. On the detection of drowsiness, the programmed system cautions the driver through an alarm to ensure vigilance. The proposed method consists of various stages to determine the wakefulness of the driver.


I. I NTRODUCTION
 Drowsiness can be defined as a state or feeling of being lethargic; sleepiness.  Losing attention while driving has proven to be a major cause of accidents. These mishaps can be prevented by the implementation of such a system.  This system can provide monitoring of the state of wakefulness of the driver and also generate alerts when necessary.  The most accurate way of detecting these factors is by using EEG signals. But, in our proposed system we will be making use of image processing techniques since such a system would be easier and more convenient to install.  Image processing here involves multiple steps, starting from detection of a face, detection of eye position and its status. Corresponding information relevant to the main problem will be generated and further analytics will be performed to create meaningful data out of it.

II. PROBLEM DEFINITION
 Since we have successfully established the fact that drowsiness has been a major cause of road accidents, we have also need a solution to it.  The primary aim of this system is to monitor the status of the driver and creating corresponding alerts in case of any anomaly.

IV. APPLIED METHODOLOGY
Among all the methods under research right now, detection directly using brain waves has proven to yield the most accurate results. This system suggests a different method inspired by multiple existing methodologies. It involves measuring physical changes like body posture, the inclination of the driver's head, and wakefulness of the eye. Brain wave detection would require the driver to wear a headset for monitoring purposes every time he/she is driving. The proposed system is much more feasible and practical for implementation, without adding any prominent cost to the existing car price.
The system being non-intrusive causes no discomfort to the driver and does not affect his/her state while driving. Though external factors like light exposure could cause problems in detection but with advancing image processing techniques, and ever-improving lens qualities, this problem can surely be solved. Status of the eye will continuously be monitored and a corresponding Eyes Aspect Ratio (EAR) will be calculated. This value will be compared to a pre-defined value and alerts will be generated depending upon these comparisons.
Since micro napping could be a loophole in this system, the system will also carry a threshold value i.e. a timer will be maintained to clock the time for which the eyes remain in an undesired state.

Figure 1: Proposed Methodology
One of the applications of Computer Vision is being made use of here. We can perform a variety of facial applications, including facial recognition and even aiding in law enforcement to help detect, recognize, and track criminals. OpenCV provides a variety of methods to detect faces in images. All these methods are different from each other in terms of accuracy and speed. We need to identify the best suitable method for our application. Our purpose here is to detect the driver's drowsiness state, which can easily be termed as a real-time application.
Haar Cascades: Object detection using Haar Cascade classifiers was initially proposed by Paul Viola and Michael Jones. The method makes use of machine learning technique where a cascade function is trained as a model with inputs as multiple positive and negative images. Once the model is trained, it is used to detect objects in an image. Here, the desired object is a human face. We need our system to be quick in detecting and obtaining the desired characteristics from a given input and to assist with this Haar Cascades are the preferred choice.

Facial Landmarks:
Followed by the detection of faces in an image, a more complex problem is encountered, that is the detection of facial features. These features consist of the eyes, nose, mouth, and the jawline. Locating these features with respect to the each other is an important pre requisite for further calculations. We have solved this problem by plotting all the features on the face as "facial landmarks". This can be understood as a simple coordinate system wherein all the prominent features are highlighted using boundaries. The boundaries are basically a set of coordinates which can help determine the position of these features on a face. Following is an image explaining how the plotting is exactly done.  Based on Raspberry Pi, the system camera that will capture the live feed of the driver's face.  Predefined values corresponding to the position of the eyes and other factors will be continuously compared with the upcoming values.  The system will detect any kind of anomal generate an alert.  One of the alerts would be an alarm inside the car that will generate a noise until the driver is in a healthy situation and can continue driving.  The second alert would be in terms of a message/call to emergency contacts.  Data that is being derived from this will be sent to a cloud platform where it will be stored, analyzed and relevant information will be generated.

Figure 3: Flow of Operation
 The above flowchart has an entity "If eyes closed found"; briefly indicates the basic operation action will carry various conditions and constraints to make the system smart and fool

VI. OBTAINED RESULTS
The face is detected on exposure to the web camera attached to the system. Once the face has successfully been detected, the image processing part is initiated. Various characteristics are obtained one of which is EAR: Eyes Aspect Ratio and it plays the most crucial role in determining the result with the highest possible accuracy. Following are few of the obtained results; Based on Raspberry Pi, the system will consist of a camera that will capture the live feed of the Predefined values corresponding to the position of the eyes and other factors will be continuously compared with the upcoming values. The system will detect any kind of anomaly and One of the alerts would be an alarm inside the car that will generate a noise until the driver is in a healthy situation and can continue driving. econd alert would be in terms of a message/call to emergency contacts. this will be sent to a cloud platform where it will be stored, analyzed and relevant information will be generated.

: Flow of Operation
The above flowchart has an entity "If eyes closed briefly indicates the basic operation. This ious conditions and constraints make the system smart and foolproof.

RESULTS
The face is detected on exposure to the web camera Once the face has successfully been is initiated. Various characteristics are obtained one of which is EAR: Eyes and it plays the most crucial role in highest possible accuracy.

VII. STATISTICAL ANALYSIS
The initial model that was trained with inputs as multiple faces in different states was used to calculate an average value of the Eye Aspect Ratio (EAR). average value of "0.3", below which the driver's state can be determined as drowsy. Another important and pro the most critical value is then defined after calculating this average, i.e. the number of consecutive frames be considered for calculation. This value carries significance in correspondence to the real time application of the system. The above table shows values obtained during testing of the system where the threshold value for the number of was "8", meaning that if EAR is less than 0.3 for 8 consecutive frames, only then will the state be determined as drowsy. If EAR goes below 0.3 for less than 8 frames, drowsiness alert will not be generated.
Following is the result of a study perf system over a time span of 1 month. This graph helps us understand the importance of data that can be generated using this system. The initial model that was trained with inputs as multiple faces in different states was used to calculate an average Eye Aspect Ratio (EAR). We obtained an , below which the driver's state can ermined as drowsy. Another important and probably defined after calculating this number of consecutive frames that should This value carries significance the real time application of the system.

: EAR Calculation
State Wake Wake Drowsy Drowsy Wake The above table shows values obtained during testing of the system where the threshold value for the number of frames was "8", meaning that if EAR is less than 0.3 for 8 consecutive frames, only then will the state be determined as drowsy. If EAR goes below 0.3 for less than 8 frames, Following is the result of a study performed using the . This graph helps us understand the importance of data that can be generated : Percentage Distribution

VIII. CONCLUSION
Using the EAR and other characteristics the drowsiness state of the driver is detected and necessary actions are initiated. Primary action will be going off of the alarm that will cause the driver to wake up and return acceptable wakefulness. This system, if implemented properly, can help save multiple lives that are l mishaps on roads. We are working towards making and more efficient use of all the technologies being used in this project and are positive of coming up with something even more innovative.
In order to make this a complete storage, corresponding analytics, and notification generation will completely be done on a cloud platform (AWS Greengrass).