A Novel Approach to Detect Driver Drowsiness and Alcohol Intoxication using Haar Algorithm with Raspberry Pi

Drowsiness in driver and alcohol consumption are the critical cause of road accident and death. Lives of pedestrian and passengers are put to risk as drivers tend to fall asleep and also when the driver is in his drunken state. Detection of driver drowsiness and its indication is an active research area now. There are 3 methods for detection of driver fatigue which includes vehicle-based method, behavioural method, and physiological based method. We adopt behavioural method. This project is aimed towards developing a prototype of drowsiness and alcohol detection system using Haar algorithm with raspberry pi. This project proposes a real time detection of driver’s drowsiness as well as alcohol intoxication and subsequently alerting them. The primary purpose of this drowsiness and alcohol detection system is to develop a system that can reduce the number of accidents from drowsiness and drunk driving of vehicle. It consists of camera which is placed in front of the driver to detect the face. An alcohol sensor which is a gas sensor used to sense the drinking state of driver. Haar algorithm is used for face detection. The results demonstrate the accuracy and robustness of the hybridized of image processing technique. Thus, it can be concluded the proposed approach is an effective solution for a real-time of driver drowsiness and alcohol detection.


Introduction
Driver fatigue and alcohol intoxication are the most significant factors in a large number of car accidents and death. Each year, there are about 1,50,000 road accidence in the India alone is due to the alcohol consumption or driver drowsiness. Developing various technologies for monitoring and preventing drowsiness while driving is a major trend and challenge in the domain of accidence avoidance systems. The main aim of the proposed system is to reduce the number of accidents due to driver fatigue and alcohol intake increase the transportation safety. There are many technologies for drowsiness detection and can be on divided into three main sections:

1) Physiological method 2) Vehicle based method 3) Behavioural based method
The first one is the physiological based method. And this type measures the physiological parameters such as EEG, ECG, EMG, EOG etc. For the measurement of each parameters different type of sensors are to be used. Therefore, it is an expensive method and also it requires more computational time, so this method cannot be implemented in real time. The second one is based on vehicle behaviour. This type measures vehicle behaviours such as speed and position of the vehicle. These techniques may be considered as non-intrusively but they have multiple limitations such as the type of the car, the driving conditions, geometry of the road steering pattern i.e. each driver's has different style of driving and the geometry of the road is not uniform it varies, so here is a chance to create a false alarm. Furthermore, it needs special equipment and preparation and can be expensive and not practical. The third one is based on the behavioural based. This type measures biological factor such as eyes movement, and here we adopt behavioural method which depend upon facial expressions such as state of eye whether the eye is closed or open. These techniques are generally characterized with the best detection accuracy. This type benefit from the dynamic behaviour of the human face and eye since they have a high degree of variability, face detection is considered to be a difficult problem in computer vision research, whereas the eyes can be considered salient and relatively stable feature on the face in comparison with other facial features. Those features will be provided to a Haar cascade classifier to determine whether those features represent an opened or closed eye.
Many researches have been developed based on analyzing the eye-image. Khushaba  contour and the shape of the entire face and the eyes were located and tracked using the Eigen eye method and finally the eye status is detected using correlation and edge detection methods.
A method for driver fatigue detection using image processing techniques has been proposed by Eriksson and Papanikotopoulos in 1997 and Singh and Papanikolopoulos in 1999. The presented method by Eriksson and Papanikotopoulos (1997) detected the facial areas of an image using symmetric property of faces and then it located the vertical position of the eyes using the pixel's differences. The proposed method by Singh and Papanikolopoulos in 1999 used the Gaussian distribution of skin color in order to locate the face and then it located the eye using the Sobel vertical edge operator. In addition, they used template matching for detecting and tracking the eye images.
A vision-based real time driver fatigue detection system based on the distance of the eyelid has built by Dong and Wu (2005). It located the face using the characteristics of skin colors and then it detected the eyes using projection and dynamic template matching.
Existing method for driver drowsiness detection can be divided into two approaches: contact approaches and noncontact. In contact approaches, drivers wear or touch some devices to get physiological parameters for detecting the level of their fatigue. Another one is non-contact approach uses an algorithm called SVM. Support Vector Machine (SVM) is a classification and regression prediction tool that uses machine learning theory. SVM used to detect the face from frame. It classify data through determination of a set of support vectors. The camera will be positioned in front of the driver to capture the front face image. From the video, the frames are extracted to obtain 2-D images. Face is detected in the frames using histogram of oriented gradients (HOG) and linear support vector machine (SVM) for object detection. After detecting the face, facial landmarks like positions of eye, nose, and mouth are marked on the images. From the facial landmarks, eye aspect ratio, mouth opening ratio and position of the head are quantified and using these features and machine learning approach, a decision is obtained about the drowsiness of the driver. Disadvantages of existing system are: While cropping the region of interest components in the video is not accurate, Algorithm of SVM will not support all the time, expensive due to more sensors are used, not reliable and may damage retina also dependence on ambient light ie; system will not work in night conditions. Drowsiness in driver and alcohol consumption of drivers are the major cause of road accident and death. The truck drivers who drive for a long hour, bus drivers of long distance or overnight buses are more susceptible to this problem. Every year a large number of injuries and death occur due to drowsiness. Hence detection of driver drowsiness and its indication is an active area of research. Basic drowsiness detection system has three blocks: acquisition system, processing system and warning system. Here, the video of the driver's frontal face is captured in acquisition system. The captured video is then transferred to the processing block where it is processed online to detect drowsiness. If drowsiness is detected, an alarm is send to the driver from the warning system. We have proposed a camera based system to detect driver drowsiness from the face image. Technology used here is image processing and Haar algorithm. Along with the driver drowsiness detection system we provide an alcohol detection system here. An alcohol sensor is a gas sensor which is used to sense the drinking state of driver. After detecting the content of alcohol, an alert is given to the driver and breaking system is applied automatically.
It provides applications such as automobile, security, vehicle tracking. The proposed system will start by capturing the video frames one by one using web camera. The system will detect the face in the frame image for each frame. This is achieved by making use of the Haar algorithm for face detection. Each Haar cascade stage consists of combination of different Haar features and each feature in turn is classified by a Haar feature classifier. For this system, the eye and the face classifiers are required. The Haar Classifier Cascade files built-in there with the Open CV contains different classifiers for the face and eye detection. The inbuilt OpenCV xml "haarcascade_frontalface_alt2.xml" file is used to search and detect the face in individual frames. Once the face detection function has detected the face of the driver, the eyes detection function tries to detect the driver's eyes. After International Journal of Research in Engineering, Science and Management Volume-3, Issue-9, September-2020 journals.resaim.com/ijresm | ISSN (Online): 2581-5792 | RESAIM Publishing 50 getting eyes, the algorithm then counts the number of open eyes from each frame and determines the drowsiness. If the criteria are satisfied, then the driver is said to be drowsy. The buzzer connected to the system performs actions to correct the driver abnormal behavior. At the same time a breaking system system is applied to the vehicle model through motor driver IC L293D. For the detection of alcohol, a high-sensitivity alcohol sensor is used. The alcohol detection system works on a simple principle, if a driver has been drinking, the alcohol breath analyzer sensor will detect the presence of alcohol in the driver's breath, an alert will come and the vehicle engine will stop immediately.

Proposed Method and Design
Haar algorithm contain two features: (a) Haar cascade (b) Haar like features. Haar cascade is a machine learning object detection algorithm used to identify an image or video. An approach where a lot of positive and negative images are used to train the classifier. Haar cascade classifier is shown in fig. 2.  fig. 4 describes the overall methodology that was used to detect the drowsiness. The proposed system will start by recording the video frames one by one. For each frame, the system will detect the face using Haar face detection algorithm and then it will detect the eye image from the face image using Haar eye detection algorithm. The eye image will be converted into gray scale and then the eye-image will be classified using a classifier to detect whether it was opened or closed. If the eye is closed for a certain amount of time, then the system will start an alarm to notify the driver and at the same time a breaking system is applied to the vehicle using a motor driver.

B. Alcohol detection algorithm
Flowchart in fig. 5 describes alcohol detection algorithm. For the detection of alcohol, an MQ 2 sensor is used. The alcohol detection systems work on a simple principle, if a driver has been drunk, the sensor will detect the presence of alcohol in the driver's breath, an alert will come and the vehicle engine will stop immediately.

Results and Discussion
The inexpensive hardware was selected in order to demonstrate that the proposed approach is efficient and can work under low-quality images generated by the camera. The

Conclusion
The aim of this study is to address solution to the major causes of road accident. The present proposed method based mainly on two main phases, the first phase is to detect and preprocess the eye images using image processing technique and the second phase is to build a classification model that will able to classify whether the eye is opened or closed and then start an alarm. For the detection of alcohol, a high-sensitivity alcohol sensor is used. This research is to find the simplest and most efficient approach to solve the drowsiness detection problem and alcohol detection, using simplest approach in order to utilize this system in real time situation so the processing time will be minimised.
The results show that this method is flexible for developing practical and ready to use drowsiness detection application and comprehensive solution.