Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Proceedings of the International Conference on Electronics and Renewable Systems (ICEARS 2022)

IEEE Xplore Part Number: CFP22AV8-ART; ISBN: 978-1-6654-8425-1

Image Recognition based Driver Drowsiness Detection


using Python
Inakollu Kiran Kumar Vipul Agarwal Munnangi Siva Reddy
Department of ECE Department of ECE Department of ECE
2022 International Conference on Electronics and Renewable Systems (ICEARS) | 978-1-6654-8425-1/22/$31.00 ©2022 IEEE | DOI: 10.1109/ICEARS53579.2022.9752167

KL University KL University KL University


Guntur, India Vijayawada, India Guntur, India
kirannaidu3331@gmail.co m agarvipul@gmail.com munnangisivareddy451@gmail.com

Abstract – This paper provides a detailed study to detect the


langour of the driver using python programming language and wide, with a similar view on the side of the road,
haar training algorithm to identify the eye movements of the particularly natural, where “anything can occur” without
driver by capturing image respectively. Here the horizontal and anyone else has a quieting impact and starts to take care.
vertical distance between two eyelids can be calculated, based on
the cut-off value the drowsiness of the driver will be calculated
and the alert signal will be triggered. Eye lids ratio is used to D.) Riding at an unfavorable time – Around evening time
calculate the euclidian distance by the 6 landmark points on the or after a good lunch. An enormous measure of food in the
single eye. The paper generalizes the results and solutions on the stomach causes a surge of blood from the mind. The
confined execution of the different procedures that are presented cerebrum starts to nap.
in the project. While the execution of the project gives this present
reality thought of how the framework functions and what changes E.) Taking medicine - There is a huge rundown of
should be possible to work on the utility of the general medications diminishing response, quieting the sensory
framework. Also, this paper expresses the outline of the system, eases torment. Likewise, improves the probability
perceptions made by the guide to assist with promoting
of nodding off dreary weighty work the day preceding the
improvement in the referenced field to accomplish the utility at
superior effectiveness for a more secure street. Moreover, the ride (ordinary for novices).
paper expresses the outline of the perceptions made by the guide
to assist with promoting improvement in the referenced field to F.) Decreasing watchfulness - Considerations start to
accomplish the utility at superior effectiveness for a more secure meander a long way from the subjects a serious excursion,
street. return recollections.
Keywords – Driver Drowsiness, Eye lids ratio, Euclidian
distance, Haar Algorithm, Python, 6 landmark points. Absence of focus and pressure in the hands and feet. On the
straights, you need to guide with "one finger". No longing to
I. INTRODUCTION make sharp developments. This rundown could proceed but
the outcome is the same, Eyes become "weighty" and flicker
time is enormously expanding. You need to keep your eyes
Vehicle accidents are by and large typical in case the driving is shut "no less than a couple of moments."
inadequate. These happen on most factors accepting the driver
is listless on the other hand if he is alcoholic. Driver
sluggishness is seen as a huge part of the vehicle setbacks. It Considering the facts let us now see the detailed report on
was shown that driving show deteriorates with extended year-wise vehicle accidents.
drowsiness with coming with regards to crashes setting up
more than 18% of all vehicle incidents. Nevertheless, the Year Road Persons Persons No. of
presence lost once can’t be reminded. Many reasons fall under Accidents (in Injured (in Died (in vehicles
the category prompting nodding off in the driver’s seat as thousands) thousands) Nos.) (in
follows: thousand)
2015 464.7 482.4 1,48,707 2,10,023
A.) Exhaustion – The driver has been in the driver’s seat 2016 473.0 485.5 1,51,801 2,30,031
for quite some time, or he has played out the dreary
2017 445.7 456.2 1,50,093 2,53,311
weighty work the day preceding ride (ordinary for
novices). 2018 445.5 446.5 1,52,780 2,54,127
2019 437.4 439.2 1,54,732 2,56,475
B.) Liquor inebriation – Indeed, even a little “permitted” 2020 315.5 320.3 90,045 1,45,241
portion of liquor of 0.35 ppm can drastically improve
the probability of nodding off the driver. Figure-1 Number of vehicles and road accidents in
India.
C.) Dreary Street – Street with practically no highlights,

978-1-6654-8425-1/22/$31.00 ©2022 IEEE 992

Authorized licensed use limited to: Academia Navala Mircea cel Batran Constanta. Downloaded on December 12,2022 at 11:34:40 UTC from IEEE Xplore. Restrictions apply.
Proceedings of the International Conference on Electronics and Renewable Systems (ICEARS 2022)
IEEE Xplore Part Number: CFP22AV8-ART; ISBN: 978-1-6654-8425-1

II. LITERATURE REVIEW IV. METHODOLOGY

The made framework is a steady structure. It uses After surveying several different papers and journals, the
pictures dealing with eye and face areas line or edge detection following methodologies have been identified:
features. Haar-training based course algorithm used for the
front area. The estimation objects are used to follow the eyes Python: Python is a deciphered undeniable level broadly useful
constantly. To perceive the eye state of the driver, the eye lids programming language. Its plan theory stresses code coherence
ratio estimation gave (Dhruv Pandey, 2021). This paper is with its utilization of huge indentation and efficient library
based on encouraging a non- intrusive system that can functions. Python language builds just as its article arranged
distinguish exhaustion and issue a rebuke on time. The dataset methodology means to assist software engineers with
will screen the drowsy drivers eyes lids position by a video composing clear, logical code for little and huge scope
from the camera. By encouraging an estimation, the early projects. It is powerfully composed, and trash collected. It is
drowsy signs of driver shortcoming can be recognized to avoid regularly portrayed as a "batteries included" language because
an incident. Right, when the signs of depletion have been of its thorough standard library. Main advantage of python as
recognized outcome is solid and seat strap alarm is given to mentioned it is dynamically typed which gives the advantage
alert the driver (Jang Seok-Woo, 2020). Alarm will be to execute the code line by line. Python reliably positions as
deactivated rather than naturally. The speedier computation perhaps the most famous programming language in recent
focuses on the reached landmark points as milestones. This times. Python's standard library is extremely broad, offering a
structure will recognize the driver's shortcoming by the wide scope of offices as shown by the long chapter by chapter
treatment of the eye region. After picture getting, the primary guide recorded underneath. The library contain s worked-in
period of taking care of his face identification. Accepting eyes modules (written in C) that give admittance to framework
are glinting commonly no rebuke is given. Assuming the eyes usefulness, for example, document I/O that would somehow be
are closed for over 4 seconds, this structure issues alerted to the distant to Python software engineers, just as modules written in
driver. The notification is in the eye lids ratio which is ready by Python that give normalized answers for some issues that
the customer using haar calculation. The eye lids ratio should happen in regular programming. A portion of these modules is
be more imperative than 0.19 on the off chance that it isn't by generally intended to empower and upgrade the compactness
and large that then the system will propose back the notification of python programs by abstracting away stage points of
as alert (Biswal, Anil Kumar & Singh 2021). The idea is to interest into stage-neutral APIs.
cultivate languor detection, for instance, splendid watches to
perceive drowsiness. V. HAAR TRAINING ALGORITHM

A brief explanation is given here for the drowsiness


III. BLOCK DIAGRAM detection system working and its process. For this drowsiness
detection, we nab the live video from the camera. Imutils is the
python library that supports capturing images from a video file
(AVI). Here, first we initialize the capture from a AVI by
setting zero which grabs the frame from the default camera.
After getting the frame this will be converted into a grayscale
by us (Kyong Hee Lee, Whui Kim, 2019). Using Matplotlib
library we can convert the color image into a grayscale image.
This Grayscale frame that is being used in this project will give
us the binary image. Then we change the position of the eye
and locate it using the centroid method by which we can
position the eye center in the face for tracking purposes. To
find the centroid of a picture, the image first has got to be
binarized. The centroid program now calculates the centroid
based on where the majority of black pixels are located and
positioned in the eye (Lorraine Saju, Christeena J, 2016). For
example, if you've got an entire black 18 x 18 BMP, then the
centroid would be located within the near center of that square.
After getting this centroid we have to mark the position of the
eye with a oval shape by the connected component technique
by which we can easily figure out how many components of
pixels of the eye are connected. Assuming that the eyes of the
driver are found during following then its X and Y facilitates
are distinguished or found by tracking down centroid of
shapes. This gives the center directions of the consideration
Figure-2 Flow chart understudy. This strategy that is utilized till now is for the
location of eye squinting. Because of image recognition, we
will choose by interfacing circle whether the driver is sleepy or
dynamic (Varsha E Dahiphale, 2015).

978-1-6654-8425-1/22/$31.00 ©2022 IEEE 993

Authorized licensed use limited to: Academia Navala Mircea cel Batran Constanta. Downloaded on December 12,2022 at 11:34:40 UTC from IEEE Xplore. Restrictions apply.
Proceedings of the International Conference on Electronics and Renewable Systems (ICEARS 2022)
IEEE Xplore Part Number: CFP22AV8-ART; ISBN: 978-1-6654-8425-1

#For horizontal eye landmarks (x, y)-coordinates


Mainly, this algorithm uses edge or line detection features C = dist.euclidean(eye[1], eye[4])
which are also used in “Rapid Object Detection using a
Boosted Cascade of Simple Features” (Viola and Jones,2001).
The algorithm gives a lot of positive images consisting of faces, # Compute the eye lids ratio
and a lot of negative images not consisting of any face to train elr = (A + B) / (2.0 * C)
on them. The system is trained to compute the euclidian
distance between the sets of vertical eye landmarks (x, y) # Extract the left and right eye
coordinates and the of horizontal eye landmarks (x, y) coordinates
coordinates. By using the eye lids ratio, the system response
will be generated. In this paper, we considered that if the eye leftEye = shape[lStart:lEnd]
lids ratio is greater than 0.19 the driver is in normal condition rightEye = shape[rStart:rEnd]
and fit to drive the vehicle and, if the eye lids ratio is less
than 0.19 then the driver is detected as drowsy, and the alarm # Compute the eye lids ratio for both eyes
will trigger to make him alert.
leftEAR = eye_lids_ratio(leftEye)
rightEAR = eye_lids_ratio(rightEye)

# Now average the eye lids ratio together for both eyes

elr = (leftELR + rightELR) / 2.0

VII. OUTPUT

Figure-3 Eye Coordinate

FORMULA

VI. PSEUDOCODE

import numpy as npy


import playsound
import argparse Figure – 4 Eye lids Ratio is greater than 0.19
import imutils
import time
import dlib
import cv
def sound_alarm(path):
# To play an alarm sound
playsoun d.pla ysou nd(p ath)

def eye_lids_ratio(eye):
#For vertical eye landmarks (x, y)-coordinates

A = dist.euclidean(eye[2], eye[6])
B = dist.euclidean(eye[3], eye[5])
Figure – 5 Eye lids Ratio is 0.40

978-1-6654-8425-1/22/$31.00 ©2022 IEEE 994

Authorized licensed use limited to: Academia Navala Mircea cel Batran Constanta. Downloaded on December 12,2022 at 11:34:40 UTC from IEEE Xplore. Restrictions apply.
Proceedings of the International Conference on Electronics and Renewable Systems (ICEARS 2022)
IEEE Xplore Part Number: CFP22AV8-ART; ISBN: 978-1-6654-8425-1

In real-time this project can also be further extended by


connecting different types of GPS trackers/Sensors to the
framework to notify the status of the vehicle and the driver
to the nearby station or hospital in case of emergency.
However, there are few flaws in the induced dataset but the
use of python makes the framework efficient by discarding
all the vulnerabilities. Finally, this system cites untroubled
drawbacks of the planned framework and mechanism to
overcome those drawbacks.

IX. REFERENCES

Figure – 6 Eye lids Ratio is less than 0.19 [1] Kyong Hee Lee, Whui Kim, Hyun Kyun Chai, Byung
Tai Jan. “Feature Extraction Methods Used to
Estimate a Driver’s Level of Drowsiness”, IEEE,
February 2019.
[2] Jang, Seok-Woo & Ahn, Byeongtae
“Implementation of Detection System for Drowsy
Driving Prevention Using Image Recognition and
IoT” May 2020.
[3] Loraine Saju, Christena J, Farhana Yasmin, Surekha
Mariam, “Drowsiness detection of system for drivers
using HAAR algorithm”, IJEAST, Vol. 1, Issue 6,
April 2016.
[4] Dwip joy Sarkar, Atanu C, “Embedded System
Application for Driver Drowsiness and Intoxication
Detection”, IJETT, April 2014.
[5] Srinivas Batchu, S Praveen Kumar, “Driver
Figure – 7 Eye lids Ratio is 0.11 Drowsiness Detection to decrease the Major Road
Accidents in Automotives”, IRJET, April 2015.
[6] Hardeep Singh, JS Bhatia and Jasbir Kaur, “Eye
VII I. CONCLUSION Tracking based Driver Drowsiness Monitoring and
Alerting System”, IEEE, January 2011.
This project gives the idea about the driver drowsiness [7] Fouzia, Roopa Lakshmi R, Jayanth Kumar A Rathod,
detection using python coding method. In this framework the Aswitha S, Supriya K, “Driver Drowsiness Detection
dataset (haar algorithm) helped us to recognize the image by System Based on Visual Features.”, IEEE, April
dividing the face into pixels and several eye points was marked 2018.
and the distance between them is calculated, the abnormality of [8] Varsha E Dahiphale, Satyanarayana R, “A Real-
the driver is identified in the drowsy conditions and that will be Time Computer Vision for Continuous Face
notified by the buzzer(alarm). This helps us to reduce the mis Detection and Tracking”, IJCA, July 2015.
happenings that causes accidents. These kinds of systems also [9] Tianyi Hong, Huabiao Qin, “Drivers Drowsiness
monitor and control the actions of the driver. Using python Detection in Embedded Systems”, IEEE, December
programming gives the flexibility to understand the scenario 2007.
and implement the framework in simple and easier way. This [10] Dhruv Pandey, Eye Aspect Ratio (EAR) and
system framework can also be developed by adding different Drowsiness detector using dlib April 2021.
types of sensors/trackers while implementing them in the [11] Bagus G. Pratama, IgiArdiyanto, Teguh B. Adji,
hardware. The framework is based on computer vision. The “Driver Drowsiness Based on Image, Bio- Signal,
main point of the paper is to foster product instrument and Driver Behavior”, IEEE, July 2017.
recognition of the condition of drowsiness. It was viewed as an [12] Chris Schwarz, John Gaspar, Thomas Miller & Reza
ideal and precise technique. It bunches languor identification Yousefian, “Detection of drowsiness using a driver
strategies of two sorts, driver based, and vehicle based. It monitoring system”, in Journal of Traffic Injury
additionally gives a study of the various driver as well as Prevention (Taylor and Francis Online), 2019.
vehicle based procedures. The framework depends on the shape [13] Viola and Jones proposed Object Detection
indicator and distance calculation. It gives a non-meddling way Framework for Real Time Face Detection in Video
to deal with languor location. In the future, the recurrence of Footage, 2001.
yawning can likewise be utilized as a boundary to distinguish [14] Biswal, Anil Kumar & Singh, Debabrata “IoT-Based
languor. To distinguish languor, certain facial highlights were Smart Alert System for Drowsy Driver Detection.”
recognized. This framework utilizes the idea of video handling 2021.
and nabbing the video from camera. It additionally refers to
specific hindrances of the proposed framework and strategies to
conquer those burdens.

978-1-6654-8425-1/22/$31.00 ©2022 IEEE 995

Authorized licensed use limited to: Academia Navala Mircea cel Batran Constanta. Downloaded on December 12,2022 at 11:34:40 UTC from IEEE Xplore. Restrictions apply.

You might also like