0% found this document useful (0 votes)
166 views20 pages

Drowsiness Detection System PDF

This document describes a project to develop a drowsiness detection system using Python. The system aims to detect when a driver is feeling sleepy by continuously monitoring their eye state in real-time using a camera. If the driver's eyes are closed for a few seconds, the system will generate an alarm to alert the driver. The system focuses on the region of interest around the eyes rather than the full face. It uses a pre-trained model to detect facial landmarks and determine drowsiness based on eye positioning. The goal is to create an affordable solution to reduce accidents caused by drowsy driving.

Uploaded by

Francis Xavier K
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
166 views20 pages

Drowsiness Detection System PDF

This document describes a project to develop a drowsiness detection system using Python. The system aims to detect when a driver is feeling sleepy by continuously monitoring their eye state in real-time using a camera. If the driver's eyes are closed for a few seconds, the system will generate an alarm to alert the driver. The system focuses on the region of interest around the eyes rather than the full face. It uses a pre-trained model to detect facial landmarks and determine drowsiness based on eye positioning. The goal is to create an affordable solution to reduce accidents caused by drowsy driving.

Uploaded by

Francis Xavier K
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Drowsiness Detection System

VISVESVARAYA TECHNOLOGICAL UNIVERSITY


Jnana Sangama, Belgaum-590014

A PROJECT REPORT
ON

“Drowsiness Detection System”


Using Python
As prescribed by VTU for seventh semester project, with regard to the subject
MAJOR PROJECT PHASE-1
FOR

BACHELOR OF ENGINEERING
IN
INFORMATION SCIENCE AND ENGINEERING
Submitted by:
Jonathan Abhishek P. (1KN19IS016)
Francis Xavier K. (1KN19IS012)
Syeda Muskan. (1KN19IS034)
Nadiya N. (1KN19IS23)
Under the guidance of:
Mrs. Rashmi Purad
Prof. Dept of CSE

DEPARTMENT OF INFORMATION SCIENCE AND ENGINEERING


K.N.S INSTITUTE OF TECHNOLOGY
BANGALORE-560064
2022-2023

1
Drowsiness Detection System

DEPARTMENT OF INFORMATION SCIENCE AND ENGINEERING


K.N.S INSTITUTE OF TECHNOLOGY
BANGALORE-560064

CERTIFICATE
Certified that the seminar entitled “Drowsiness detection system” carried out by
JONATHAN ABHISHEK P(1KN19IS016), FRANCIS XAVIER K(1KN19IS012),
SYEDA MUSKAN(1KN19IS034), NADIYA N(1KN19IS023) Bonafide student of KNS
Institute of Technology, Bangalore in partial fulfilment for the award of degree in Bachelor
of Engineering in Information Science and Engineering of Visveraya Technological
University, Belagavi during the year 2022-2023.The project report has been approved as it
satisfies the academic requirements with respect to project work prescribed for the said degree.

Mrs. Rashmi Purad. Dr. Suresh S. Dr. SM Prakash.


Project Guide H.O.D Dept of CSE Principal, KNSIT

External Viva:

Name of Examiners Signature with date

2
Drowsiness Detection System

AKNOWLEDGEMENT

The satisfaction and euphoria that accompany the successful completion of any task
would be incomplete with the mention of the people of who made it possible, whose constant
guidance and support crowned our efforts with success.
I take this opportunity to express my profound gratitude to my respected Principal
Dr. SM Prakash for his constant support and encouragement.
I am grateful to the Head of Dept. Dr Suresh S, for his unfailing encouragement and
suggestions given to me during the course of Seminar work.
Guidance and deadlines play a very important role in successful completion of the
seminar report on time. I also convey my gratitude to Mrs. Rashmi Purad, Asst. Professor,
Dept of CSE, for having constantly monitored the development of the seminar report and
setting up precise deadlines.
Finally, a note of thanks for the Department of Information Science and Engineering both
teaching and non-teaching staff for their co-operation extended to me.

3
Drowsiness Detection System

TABLE OF CONTENTS:

• ABSTRACT

• INTRODUCTION

• LITERATURE SURVEY

• METHODOLOGY AND REQUIREMENTS

• PROPOSED SYSTEM

• FORMULA

• CONCLUSIONS AND LIMITATIONS

• REFERENCES

• BIBLIOGRAPHY

4
Drowsiness Detection System

ABSTRACT:
In today’s time, the accidents due to the sleepiness of the driver are increasing heavily. Due
the tiredness or fatigue of all the work, most of the drivers feel low in terms of energy. As a
result, they tend to feel sleepy during the drive time. Because of these fatigues, the chances
of accidents to happen increase immensely. So, the aim of this project is to design a model
such that it detects the drowsiness of the driver and generate alarm whenever the driver feels
drowsy or sleepy. In most of the high-end cars, these models are integrated within itself but
for the cars which are used by the general public lacks this technology. In this project, we are
using Python as an implementation language. This project we are focusing on creating an
affordable model for the drowsiness detection which will be efficient as well as cheap in
terms of cost and availability. The focus of this project is heavily based on the facial
detection with the ROI of both eyes instead of the whole face. In today’s time, the accidents
due to the sleepiness of the driver are increasing heavily. Due the tiredness or fatigue of all
the work, most of the drivers feel low in terms of energy. As a result, they tend to feel sleepy
during the drive time. Because of these fatigues, the chances of accidents to happen increase
immensely. So, the aim of this project is to design a model such that it detects the drowsiness
of the driver and generate alarm whenever the driver feels drowsy or sleepy. In most of the
high-end cars, these models are integrated within itself but for the cars which are used by the
general public lacks this technology. In this project, we are using Python as an
implementation language. This project we are focusing on creating an affordable model for
the drowsiness detection which will be efficient as well as cheap in terms of cost and
availability. The focus of this project is heavily based on the facial detection with the ROI of
both eyes instead of the whole face .
The correctness of this model is hugely dependent on the quality of camera. The quality of
detection degrades if the driver’s eyes are not clearly visible for the detection. It can happen
because of the Sunglasses or spectacles having light reflection or any other kind of obstacles
between the eyes and the camera. Also, if the driver is not facing the camera properly, the
accuracy is compromised.
In this project, there is no dataset training as the model used for facial recognition is pre
trained. The 4shape_predictor_68_face_landmarks.dat is used to detect the face in a frame or
image. The output is based on status of the object created for the algorithm (i.e., driver’s
eyes). The following result is generated as per the positioning of the eyes.

5
Drowsiness Detection System

The Detection of Drowsiness using a Driver Monitoring System (2019), research has
established the ability to detect drowsiness with various kind of sensors. The author studied
drowsy driving in a high-fidelity driving simulator and evaluated the ability of an automotive
production ready Driver Monitoring System to detect drowsy driving. Additionally, this
feature was compared to and combined with signals from vehicles-based sensors. [3]Real-time
Driver Drowsiness Detection based on Driver’s Face Image Behavior using a System of
Computer Interaction Implemented in a Smartphone (2018), this study has shown promising
result in applying the vehicular driver surveillance based on Artificial Vision Techniques and
implemented in a smart-phone. The implemented system allows an efficient detection of the
indicators that appear in drowsiness, as long as the measurements are carried out under the
established conditions. The correct functioning of the system depends on these conditions.

6
Drowsiness Detection System

INTRODUCTION:
The most common type of accident in today’s world is the accident occurring due to the
sleepiness of the driver irrespective of day and night. The death rate of accidents due to this
has spiked to 21% over the world. This shows how serious this problem is. The Drowsiness
Detection is a safe technology that can prevent accidents that are caused by drivers who fall
asleep while driving. The objective of this python project is to build a Drowsiness Detection
Model which will detect that a driver’s eyes are closed for a few seconds. The implementation
of this project uses a pre-built model of face landmark for easy deployment on edge of
computationally less efficient devices. The project has a direct application in the automotive
sector. This paper is aimed at designing a Drowsiness Detection Model, which takes the
driver’s eyes as ROI (Region of Interest) and continuously senses (in real-time) the eye lid to
detect whether the driver is feeling sleepy or not. If the driver feels sleepy, the model will
generate Sound Alarm to bring the driver back to his/her conscious state. This model is also
effective even when the driver is wearing a spectacle. The number of accidents show just how
much grave this matter is and that’s why we chose to develop this project that is intended to
reduce these accidents. The most common kind of accident in today’s world is the accident
occurring due to the sleepiness of the driver irrespective of day and night. The death rate of
accidents due to this has spiked to 21% over the world. This shows how serious this problem
is. The Drowsiness Detection is a safe technology that can prevent accidents that are caused
by drivers who fall asleep while driving. The objective of this python project is to build a
Drowsiness Detection Model which will detect that a driver’s eyes are closed for a few
seconds. The implementation of this project uses a pre-built model of face landmark for easy
deployment on edge of computationally less efficient devices. The project has a direct
application in the automotive sector.

This paper is aimed at designing a Drowsiness Detection Model, which takes the driver’s eyes
as ROI (Region of Interest) and continuously senses (in real-time) the eye lid to detect whether
the driver is feeling sleepy or not. If the driver feels sleepy, the model. will generate Sound
Alarm to bring the driver back to his/her conscious state. This model is also effective even
when the driver is wearing a spectacle. The number of accidents show just how much grave
this matter is and that’s why we chose to develop this project that is intended to reduce these
accidents.

7
Drowsiness Detection System

The most common type accident in today’s world is the accident occurring due to the
sleepiness of the driver irrespective of day and night. The death rate of accidents due to this
has spiked to 21% over the world. This shows how serious this problem is. The Drowsiness
Detection is a safe technology that can prevent accidents that are caused by drivers who fall
asleep while driving. The objective of this python project is to build a Drowsiness Detection
Model which will detect that a driver’s eyes are closed for a few seconds. The implementation
of this project uses a pre-built model of face landmark for easy deployment on edge of
computationally less efficient devices. The project has a direct application in the automotive
sector. This paper is aimed at designing a Drowsiness Detection Model, which takes the
driver’s eyes as ROI (Region of Interest) and continuously senses (in real-time) the eye lid

8
Drowsiness Detection System

LITERATURE SURVEY:
The survey has been done which consists of present research and technologies on this
Drowsiness Detection. The idea of this survey is to understand the field of study, and also to
understand where we should be putting our efforts while designing this project.
[1] Driver Drowsiness Detection System Using Computer Vision (2021), this paper includes
to detect a driver’s drowsiness based on eyelid movement and yawning and is reliable to give
appropriate voice alerts in real-time.
[2] The Detection of Drowsiness using a Driver Monitoring System (2019), research has
established the ability to detect drowsiness with various kind of sensors. The author studied
drowsy driving in a high-fidelity driving simulator and evaluated the ability of an automotive
production ready Driver Monitoring System to detect drowsy driving. Additionally, this
feature was compared to and combined with signals from vehicles-based sensors.
[3] Real-time Driver Drowsiness Detection based on Driver’s Face Image Behaviour using a
System of Computer Interaction Implemented in a Smartphone (2018), this study has shown
promising result in applying the vehicular driver surveillance based on Artificial Vision
Techniques and implemented in a smart phone. The implemented system allows an efficient
detection of the indicators that appear in drowsiness, as long as the measurements are carried
out under the established conditions. The correct functioning of the system depends on these
conditions.
The principal objective is to design or develop a Drowsiness Detection Model which detects
the eye movements of the driver to acknowledge the sleepy pattern and generate the Sound
Alarm whenever the driver feels drowsy. The secondary objective of this project is to make
the model platform independent, computationally less efficient devices and cheap for the low-
end spec platform. Also, to make detection algorithm accurate in terms of sensing the face.

9
Drowsiness Detection System

METHODOLOGY AND REQUIREMENTS:

In the past, the facial detection was not prominent and if it was carried out, it was not accurate.
So, the previous model of drowsiness detection was of average performance. At that time
multiple problems were loaded these systems, one of the most important was the accuracy of
the facial detection algorithm. Because of which the performance of the system was heavily
compromised. So now in this model, the facial detection process is carried out by the facial
detection algorithm, shape_predictor_68_face_landmarks which is pre-trained by the Dlib
model for face landmark detection. Dlib has excellent Face Detection and Face Landmarks
algorithms built in. Also, it provides pretrained model for facial landmark detection. The ROI
(Region of Interest), that is the eye of driver is created using the faculties of the immotile
module of Python. The Euclidean distance for eye ratio is calculated using the distance of the
SciPy. Spatial module. The alarm sound is carried out by the Py game module which is
initiated when driver is detected to be drowsy or sleepy. So now in this model, the facial
detection process is carried out by the facial detection algorithm,
[4]shape_predictor_68_face_landmarks.dat which is pre-trained by the Dlib model for face
landmark detection. Dlib has excellent Face Detection and Face Landmarks algorithms built
in. Also, it provides pretrained model for facial landmark detection. The ROI (Region of
Interest), that is the eyes of driver is created using the face_utils of the imutils module of
Python. The Euclidean distance for eye ratio is calculated using the distance of the scipy.spatial
module. The alarm sound is carried out by the pygame module which is initiated when driver
is detected to be drowsy or sleepy

10
Drowsiness Detection System

RASBERRY PI MICROCONTOLLER/IMAGER:

11
Drowsiness Detection System

DROWSINESS DETECTION DESIGN:


-System Architecture
During the driving of heavy vehicle (including car), this model uses web-cam to take live video
feed as input. This feed will be used as an input for the detection of drowsiness in the driver.
The feed will be processed by the OpenCV module and with the help of Dlib the landmarks
are established, which in this case are eyes. The calculation of eye aspect ratio is calculated by
the Euclidean distance formula which is used to measure the eye closure and generate warning
if the value is decreased than the defined threshold value and ultimately the alarm will set off.

Detailed Design

12
Drowsiness Detection System

Take Image as Input from a Camera: With a webcam, we will take images as input. We use
the method provided by OpenCV, cv2.VideoCapture(0) to access the camera and set the
capture object cap.read() will read each frame and we store the image in a frame variable.
Detect Face in the Image and Create a Region of Interest (ROI):OpenCV algorithm for
objectdetection takes grey images in the input. face_utils.
FACIAL_LANDMARKS_68_IDXS[“EYE_L/ R"] is used to define eyes from the Model
itself.
Detect the eyes from ROI and feed it to the classifier: The same procedure to detect faces
is used to detect eyes. We can use an OpenCV Cascade Classifier to detect a face and eye.

13
Drowsiness Detection System

PROPOSED SYSTEM:

For this project, there are many criteria that can be added and optimized to increase the
effectiveness of the system. The first criteria would be road user’s connection and the stand-
alone mobile application. The workflow of proposed system of detecting a sleepy driver to
avoid an accident is shown in Fig. 1. In addition, an alert message can be generated to notify
its live location of the drowsy driver via telegram to alert other road user's and perform a quick
response if something unwanted happen. Drowsiness detection system is dominantly requiring
detection of eye blink movement. The recorded blink detection through computer webcam can
be done by calculating EAR using OPENCV platform and Dlib prediction, also known as Dlib
pre trained Neural network-based prediction. The EAR can be calculated based on the eye
coordinates returned from OPENCV using the EAR formula as shown in (1) [7][8].
Drowsiness detection system is dominantly requiring detection of eye blink movement. The
recorded blink detection through computer webcam can be done by calculating EAR using
OPENCV platform and Dlib prediction, also known as Dlib pre trained Neural network
based prediction. The EAR can be calculated based on the eye coordinates returned from
OPENCV using the EAR formula as shown in (1) [7][8].

14
Drowsiness Detection System

15
Drowsiness Detection System

16
Drowsiness Detection System

17
Drowsiness Detection System

CONCLUSIONS AND LIMITATIONS:


The Drowsiness Detection Model is competent of detecting the sleepiness by keeping of the
eye’s movement of the driver. The inputs are obtained from the facial detection algorithm
which is pre trained by the Dlib model of facial recognition. The model deals with the eye’s
aspect ratio to detect the region of interest. The eye’s aspect ratio is calculated using the EAR
function. The alert is generated if the value of the detection counter exceeds the threshold value
defines inside the driver code. The focus for developing this project is to reduce the number
of accidents which occur due to the sleepiness of the drivers. The correctness of this model is
hugely dependent on the quality of camera. The quality of detection degrades if the driver’s
eyes are not clearly visible for the detection. It can happen because of the Sunglasses or
spectacles having light reflection or any other kind of obstacles between the eyes and the
camera. Also, if the driver is not facing the camera properly, the accuracy is compromised.
The principal objective is to design or develop a Drowsiness Detection Model which detects
the eye movements of the driver to acknowledge the sleepy pattern and generate the Sound
Alarm whenever the driver feels drowsy. The secondary objective of this project is to make
the model platform independent, computationally less efficient devices and cheap for the low-
end spec platform. Also, to make detection algorithm accurate in terms of sensing the face.

18
Drowsiness Detection System

REFERENCES:
[1]. Mahek Jain, Bhavya Bhageerathi, Sowmya Rani C N, “Driver Drowsiness Detection System Using
Computer Vision”, International Journal of Engineering and Advanced Technology (IJEAT), ISSN: 2249-
8958 (Online), Volume – 11 Issue – 1, October 2021.
[2]. Chris Schwarz, John Gaspar, Thomas Miller, Reza Yousefian, “The Detection of Drowsiness using a
Driver Monitoring System (2019)”, Traffic Injury Prevention, 2019, Volume 20, No. SUP1, S157-S161.
[3]. Eddie E. Galarza, Fabricio D. Egas, Franklin M. Silva, Paola M. Velasco, Eddie D. Galarza, “Real-time
Driver Drowsiness Detection based on Driver’s Face Image Behaviour using a System of Computer
Interaction Implemented in a Smartphone (2018)”, Universidad de las Fuerzas Armadas –ESPE, Sangolquí,
Ecuador.
[4]. Shape_predictor_68_face_landmarks.dat, is a tool that takes in an image containing some object and
outputs a set of points location that define the pose of the object. It is also used in detecting the face in a
frame or image.

19
Drowsiness Detection System

BIBLIOGRAPHY:

Nishant Prajapati –He is currently student of B. Tech third year, Department of Computer
Science, Rameshwaram Institute of technology & Management, Lucknow, India. And working
on Drowsiness Detection Model.

Yash Srivastav –He is currently student of B. Tech third year, Department of Computer
Science, Rameshwaram Institute of Technology & Management, Lucknow, India. And
working on Drowsiness Detection Model.

Apoorva Mishra –She is currently student of B. Tech third year, Department of Computer
Science, Babu Banarasi Das Engineering College, Lucknow, India. And working on
Drowsiness Detection Model.

Shyam Dwivedi – He is currently working as an Assistant Professor and Head of Department


in Rameshwaram Institute of Technology & Management, Lucknow, India. He is M. Tech –
2012 BIT Mesra, Ranchi, he has a teaching experience of 10 years and 1-year TCS Industrial

Brajesh Mishra - He is currently working as an Assistant Professor in Rameshwaram Institute


of Technology & Management, Lucknow, India. He is M. Tech (ENV) IET 2011 and M. Tech
(CSE) Integral University 2015 and pursuing PhD (CSE) Rama University.

20

You might also like