0% found this document useful (0 votes)
25 views52 pages

Iskocopykalle

The document provides an overview of driver drowsiness detection methods and then discusses various literature on the topic. It describes the proposed system architecture and software design which involves face detection, eye and mouth tracking to determine drowsiness. UML diagrams including class, use case and activity diagrams are also discussed.

Uploaded by

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

Iskocopykalle

The document provides an overview of driver drowsiness detection methods and then discusses various literature on the topic. It describes the proposed system architecture and software design which involves face detection, eye and mouth tracking to determine drowsiness. UML diagrams including class, use case and activity diagrams are also discussed.

Uploaded by

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

CHAPTER 1

INTRODUCTION

1.1 Overview

1.2. Scope

1
1.3. Definitions and Acronyms

1.4 User Needs

1.4.1 VEHICLE BASED METHOD

DISADVANTAGE
 .

1.4.2 BEHAVIORAL BASED METHOD

2
DISADVANTAGES
 .

1.4.3 PHYSIOLOGICAL BASED METHOD

DISADVANTAGES
 .

1.5 Assumptions and Dependencies

3
ADVANTAGES
 No Database:

4
CHAPTER 2

LITERATURE

SURVEY

2.1 INTRODUCTION

5
2.2 JOURNAL 1

TITLE: Intelligent Video-Based Drowsy Driver Detection System under Various


Illuminations and Embedded Software Implementation

AUTHORS: R. Kumaran, R. Deepak Kumar, M. Karthik Kumar, B. Rahul

PUBLISHED ON: 04-08-2020

PUBLISHED BY: International Journal Of Engineering Research and Technology


(IJERT)

ABSTRACT:

DRAWBACKS:

 The proposed system is not cost effective.


 It only pivots on one aspect of drowsiness signs, eye closing.

6
2.3 JOURNAL 2

TITLE: Driver Fatigue Detection based on Eye Tracking and Dynamic Template
Matching

AUTHORS: W. B. Horng, C.Y. Chen, Y. Chang, C.H. Fan

PUBLISHED ON: 14 Jan 2021

PUBLISHED BY: International Journal of Vehicular Technology

ABSTRACT:

DRAWBACKS:

 Face detection is not efficient as it uses varying steps.


 The average precision rate is 88.9% which is comparatively low.
 Drowsiness detection through eye is the only priority.

7
2.4 JOURNAL 3

TITLE: Monitoring Driver Fatigue using Facial Analysis Techniques

AUTHORS: S. Singh, N. P. Papanikolopoulus

PUBLISHED ON: 5 Aug 2020

PUBLISHED BY: Institute of Electrical and Electronics Engineers (IEEE)

ABSTRACT:

DRAWBACKS:

 D

8
CHAPTER 3

SYSTEM ANALYSIS

3.1 INTRODUCTION

9
3.2 SOFTWARE REQUIREMENTS

3.3 HARDWARE REQUIREMENTS

10
CHAPTER 4

SOFTWARE DESIGN
Software design is a mechanism to transform user requirements into some
suitable form, which helps the programmer in software coding and implementation.
The software design phase is the first step in SDLC (Software Design Life Cycle),
which moves the concentration from the problem domain to the solution domain.

4.1 ARCHITECTURAL DESIGN

The architecture of a system describes its major components, their relationships


(structures), and how they interact with each other. Architecture serves as a blueprint
for a system. It provides an abstraction to manage the system complexity and establish
a communication and coordination mechanism among components. It defines a
structured solution to meet all the technical and operational requirements, while
optimizing the common quality attributes like performance and security.

The architectural design is the highest abstract version of the system. It


identifies the software as a system with many components interacting with each other.
At this level, the designers get the idea of proposed solution domain.

An architectural design diagram of the proposed driver drowsiness monitoring


system has been depicted in Figure 4.1. At first, the video was recorded using a
webcam. 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 and mouth are marked on the images. From the facial landmarks,
eye aspect ratio, mouth opening ratio are quantified and using these features and
machine learning approach, a decision is obtained about the drowsiness of the driver.
If drowsiness is detected, an alarm will be sent to the driver to alert him/her.

11
Figure 4.1 Architectural design

12
4.2 UML DIAGRAMS

The Unified Modelling Language (UML) is one of the most exciting tools in the
world of system development today. The UML enables system builders to create blue
prints that capture their vision in a standard ease-to-understand way and communicate
them to others.

THE COMPONENTS OF UML

The UML consists of a number of graphical elements that combine to form


diagram. Because it is a language the UML has used for combining these elements.
The purpose of the diagram is to present multiple views of a system.

BASIC BUILDING BLOCKS OF UML

The vocabulary of the UML encompasses three kinds of building blocks

 Things
 Relationships
 Diagrams

TYPES OF UML DIAGRAMS

 Class diagram
 Use case diagram
 Sequence diagram
 Collaboration diagram
 State chart diagram
 Activity diagram
 Component diagram
 Deployment diagram

13
4.2.1 CLASS DIAGRAM

Class diagrams are the main building blocks of every object-oriented methods.
It is a static diagram. It represents the static view of an application. Class diagram is
not only used for visualizing, describing, and documenting different aspects of a
system but also for constructing executable code of the software application.

Class diagram describes the attributes and operations of a class and also the
constraints imposed on the system. The class diagrams are widely used in the
modeling of object-oriented systems because they are the only UML diagrams, which
can be mapped directly with object-oriented languages.

Class diagram is a static diagram and it is used to model the static view of a
system. The static view describes the vocabulary of the system. Generally, UML
diagrams are not directly mapped with any object-oriented programming languages
but the class diagram is an exception. Class diagram clearly shows the mapping with
object- oriented languages such as Java, C++, etc. From practical experience, class
diagram is generally used for construction purpose.

Class diagram shows a collection of classes, interfaces, associations,


collaborations, and constraints. It is also known as a structural diagram.

PURPOSE OF CLASS DIAGRAM

The purpose of the class diagram is to model the static view of an application.
Class diagrams are the only diagrams which can be directly mapped with object-
oriented languages and thus widely used at the time of construction.

The purpose of the class diagram can be summarized as

 This is the only UML which can appropriately depict various aspects of OOPs
concept.
 Analysis and design of the static view of an application.
 Describe responsibilities of a system.
 Base for component and deployment diagrams.

14
Figure 4.2 Class Diagram

15
4.2.2 USE CASE DIAGRAM

A use case diagram is a graphical depiction of a user's possible interactions


with a system. A use case diagram shows various use cases and different types of
users the system has and will often be accompanied by other types of diagrams as
well. The use cases are represented by either circles or ellipses. The actors are often
shown as stick figures.

A use case diagram is used to represent the dynamic behavior of a system. It


encapsulates the system's functionality by incorporating use cases, actors, and their
relationships. It models the tasks, services, and functions required by a
system/subsystem of an application. It depicts the high-level functionality of a system
and also tells how the user handles a system.

Use case diagrams are typically developed in the early stage of development
and are used to gather the requirements of a system including internal and external
influences. These requirements are mostly design requirements. Hence, when a
system is analyzed to gather its functionalities, use cases are prepared and actors are
identified. When the initial task is complete, use case diagrams are modelled to
present the outside view.

PURPOSE OF USE CASE DIAGRAM

The main purpose of a use case diagram is to portray the dynamic aspect of a
system. It accumulates the system's requirement, which includes both internal as well
as external influences. It invokes persons, use cases, and several things that invoke the
actors and elements accountable for the implementation of use case diagrams. It
represents how an entity from the external environment can interact with a part of the
system.

In brief, the purposes of use case diagrams can be said to be as follows

 It gathers the system's needs.


 It depicts the external view of the system.
 It recognizes the internal as well as external factors that influence the system.
 It represents the interaction between the actors.

16
Figure 4.3 Use Case Diagram

17
4.2.3 ACTIVITY DIAGRAM

In UML, an activity diagram is used to display the sequence of activities.


Activity diagrams show the workflow from a start point to the finish point detailing
the many decision paths that exist in the progression of events contained in the
activity.

The activity diagram is used to demonstrate the flow of control within the
system rather than the implementation. It models the concurrent and sequential
activities.

The activity diagram helps in envisioning the workflow from one activity to
another. It put emphasis on the condition of flow and the order in which it occurs. The
flow can be sequential, branched, or concurrent, and to deal with such kinds of flows,
the activity diagram has come up with a fork, join, etc.

It is also termed as an object-oriented flowchart. It encompasses activities


composed of a set of actions or operations that are applied to model the behavioral
diagram. It is the same as that of a flowchart but not exactly a flowchart itself. It is
used to depict the flow between several activities.

PURPOSE OF ACTIVITY DIAGRAM

Activity is a particular operation of the system. Activity diagrams are not only
used for visualizing the dynamic nature of a system, but they are also used to
construct the executable system by using forward and reverse engineering techniques.

The only missing thing in the activity diagram is the message part. It does not
show any message flow from one activity to another. Activity diagram is sometimes
considered as the flowchart. Although the diagrams look like a flowchart, they are
not. It shows different flows such as parallel, branched, concurrent, and single.

The purpose of an activity diagram can be described as

 Draw the activity flow of a system.


 Describe the sequence from one activity to another.
 Describe the parallel, branched and concurrent flow of the system.

18
Figure 4.4 Activity Diagram

19
4.3 MODULES

There are four modules in this system.

 Data Acquisition
 Frame Extraction
 Face Detection & Facial Landmark Detection
 Calculate

4.3.1 DATA ACQUISITION

Using this module we will connect application to webcam using OPENCV built-in
function called VideoCapture. Video is recorded using webcam and processed in a
laptop.

4.3.2 FRAME EXTRACTION

Using this module we will grab frames from webcam and then extract each picture
frame by frame and convert image into 2 dimensional array.

4.3.3 FACE DETECTION & FACIAL LANDMARK DETECTION

We will detect faces from images and then extract facial features from the frames.

4.3.4 CALCULATE

Using this module we will calculate distance with Euclidean Distance formula to
check whether given face distance closer to eye blinks or yawning, if eyes blink for 20
frames continuously and mouth open as yawn then it will alert driver.

20
CHAPTER 5

IMPLEMENTATION

5.1 INTRODUCTION

Implementation is the stage where the theoretical design is turned into a


working system. The most crucial stage in achieving a new successful system is
giving confidence on the new system for the users that it will work efficiently and
effectively. The system can be implemented only after thorough testing is done and if
it is found to work according to the specification.

5.2 SELECTION OF APPROPRIATE TECHNOLOGY

Before implementing the system, we need to select the domain, programming


language, Algorithm etc.

5.2.1 DOMAIN

MACHINE LEARNING

Machine learning (ML) is a type of artificial intelligence (AI) that allows


software applications to become more accurate at predicting outcomes without being
explicitly programmed to do so. Machine learning algorithms use historical data as
input to predict new output values.

Recommendation engines are a common use case for machine learning. Other
popular uses include fraud detection, spam filtering, malware threat detection,
business process automation (BPA) and Predictive maintenance.

Classical machine learning is often categorized by how an algorithm learns to


become more accurate in its predictions.

There are three basic approaches:

 Supervised Learning
 Unsupervised Learning
 Reinforcement Learning

21
Here in our system we use supervised learning approach.

SUPERVISED LEARNING: In this type of machine learning, data scientists supply


algorithms with labeled training data and define the variables they want the algorithm
to assess for correlations. Both the input and the output of the algorithm is specified.

HOW DOES SUPERVISED MACHINE LEARNING WORK?

Supervised machine learning requires the data scientist to train the algorithm with
both labeled inputs and desired outputs. Supervised learning algorithms are good for
the following tasks:

 BINARY CLASSIFICATION: Dividing data into two categories.


 MULTI-CLASS CLASSIFICATION: Choosing between more than two
types of answers.
 REGRESSION MODELING: Predicting continuous values.

5.2.2 PROGRAMING LANGUAGE

PYTHON

Python is a high-level, general-purpose programming language. Its design


philosophy emphasizes code readability with the use of significant indentation.
Python is a popular programming language. It was created by Guido van Rossum, and
released in 1991.

It is used for

 web development (server-side)


 software development
 mathematics
 system scripting

LIBRARIES

A python library is a collection of utility methods, classes, and modules that your
application code can use to perform specific tasks without writing the functionalities
from scratch. It contains bundles of code that can be used repeatedly in different
programs. It makes python programming simpler and convenient for the programmer,
as we don’t need to write the same code again and again for different programs.
Python
22
libraries play a very vital role in fields of Machine Learning, Data Science, Data
Visualization, etc.

We use the following libraries in our system.

TKinter

Python offers multiple options for developing GUI (Graphical User Interface).
Out of all the GUI methods, TKinter is the most commonly used method. It is a
standard python interface to the Tk GUI toolkit shipped with Python. Python with
TKinter is the fastest and easiest way to create the GUI applications. Creating a GUI
using TKinter is an easy task.

NumPy

NumPy is a python library used for working with arrays. It also has functions
working for in domain of linear algebra, fourier transform, and matrices.

In Python we have lists that serve the purpose of arrays, but they are slow to
process. NumPy arrays are stored at one continuous place in memory unlike lists, so
process can access and manipulate them very efficiently.

OpenCV

OpenCV is an open-source software library for computer vision and machine


learning. The OpenCV full form is Open Source Computer Vision Library. It provides
a wide range of features, including object detection, face recognition, and tracking.
This library provides videoCapture() method which is used to connect application to
the webcam.

Dlib

Dlib is one of the most powerful and easy-to-go open-source library consisting
of machine learning library/algorithms and various tools for creating software. Dlib is
mostly used for face recognition purposes. They analyzed the object/face using the
functions called HOG (Histogram of oriented gradients) and CNN (Convolutional
Neural Networks).

We use inbuilt functions like frontal_face_detector(), shape_predictor() to


recognize the face of the driver.

23
Scikit-learn (SKlearn)

Scikit-learn is the most useful and robust library for machine learning in
python. It features various algorithms like support vector machine, random forests,
and k- neighbours, and it also supports python numerical and scientific libraries like
NumPy and SciPY.

Imutils

A series of convenience functions to make basic image processing functions


such as translation, rotation, resizing, skeletonization, displaying Matplotlib images,
sorting contours, detecting edges, and much more easier with OpenCV.

5.2.3. ALGORITHM

SUPPORT VECTOR MACHINE (SVM)

Machine learning involves predicting and classifying data and to do so we


employ various machine learning algorithms according to the dataset. Support Vector
Machine is a linear model for classification and regression problems. It can solve
linear and non-linear problems and work well for many practical problems.

The idea of SVM is simple: The algorithm creates a line or a hyperplane


which separates the data into classes. As a simple example, for a classification task
with only two features (like the image above), you can think of a hyperplane as a line
that linearly separates and classifies a set of data.

Intuitively, the further from the hyperplane our data points lie, the more
confident we are that they have been correctly classified. We therefore want our data
points to be as far away from the hyperplane as possible, while still being on the
correct side of it. So when new testing data is added, whatever side of the hyperplane
it lands will decide the class that we assign to it.

How do we find the right hyperplane?

The distance between the hyperplane and the nearest data point from either set
is known as the margin. The goal is to choose a hyperplane with the greatest possible
margin between the hyperplane and any point within the training set, giving a greater
chance of new data being classified correctly.

24
CHAPTER 6

SOURCE

CODE

from tkinter import *


import tkinter
from scipy.spatial import distance as dist
from imutils import face_utils
import numpy as np
import imutils
import dlib
import cv2

main = tkinter.Tk()
main.title("Driver Drowsiness Monitoring")
main.geometry("500x400")

def EAR(drivereye):
point1 = dist.euclidean(drivereye[1], drivereye[5])
point2 = dist.euclidean(drivereye[2], drivereye[4])
# compute the euclidean distance between the horizontal
distance = dist.euclidean(drivereye[0], drivereye[3])
# compute the eye aspect ratio
ear_aspect_ratio = (point1 + point2) / (2.0 * distance)
return ear_aspect_ratio

def MOR(drivermouth):
# compute the euclidean distances between the horizontal
point = dist.euclidean(drivermouth[0], drivermouth[6])
# compute the euclidean distances between the vertical
point1 = dist.euclidean(drivermouth[2], drivermouth[10])
point2 = dist.euclidean(drivermouth[4], drivermouth[8])
25
# taking average

26
Ypoint = (point1+point2)/2.0
# compute mouth aspect ratio
mouth_aspect_ratio = Ypoint/point
return mouth_aspect_ratio

def startMonitoring():
pathlabel.config(text="Webcam Connected Successfully")
webcamera = cv2.VideoCapture(0)
svm_predictor_path = 'SVMclassifier.dat'
EYE_AR_THRESH = 0.25
EYE_AR_CONSEC_FRAMES = 10
MOU_AR_THRESH = 0.75

COUNTER = 0
yawnStatus = False
yawns = 0
svm_detector = dlib.get_frontal_face_detector()
svm_predictor = dlib.shape_predictor(svm_predictor_path)
(lStart, lEnd) = face_utils.FACIAL_LANDMARKS_IDXS["left_eye"]
(rStart, rEnd) = face_utils.FACIAL_LANDMARKS_IDXS["right_eye"]
(mStart, mEnd) = face_utils.FACIAL_LANDMARKS_IDXS["mouth"]
while True:
ret, frame = webcamera.read()
frame = imutils.resize(frame, width=640)
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
prev_yawn_status = yawnStatus
rects = svm_detector(gray, 0)

for rect in rects:


shape = svm_predictor(gray, rect)
shape = face_utils.shape_to_np(shape)
leftEye = shape[lStart:lEnd]
rightEye = shape[rStart:rEnd]
mouth = shape[mStart:mEnd]

27
leftEAR = EAR(leftEye)
rightEAR = EAR(rightEye)
mouEAR = MOR(mouth)
ear = (leftEAR + rightEAR) / 2.0
leftEyeHull = cv2.convexHull(leftEye)
rightEyeHull = cv2.convexHull(rightEye)
mouthHull = cv2.convexHull(mouth)
cv2.drawContours(frame, [leftEyeHull], -1, (0, 255, 255), 1)
cv2.drawContours(frame, [rightEyeHull], -1, (0, 255, 255), 1)
cv2.drawContours(frame, [mouthHull], -1, (0, 255, 0), 1)

if ear < EYE_AR_THRESH:


COUNTER += 1
cv2.putText(frame, "Eyes Closed ", (10,30),cv2.FONT_HERSHEY_
SIMPLEX, 0.7, (0,0,255), 2)
if COUNTER >= EYE_AR_CONSEC_FRAMES:
cv2.putText(frame, "DROWSINESS ALERT!", (10, 50),cv2.FONT_
HERSHEY_SIMPLEX, 0.7, (0,0,255), 2)
else:
COUNTER = 0
cv2.putText(frame, "Eyes Open ", (10, 30),cv2.FONT_HERSHEY_
SIMPLEX, 0.7, (0,255,0), 2)
cv2.putText(frame, "EAR: {:.2f}".format(ear), (480, 30),
cv2.FONT_HERSHEY_SIMPLEX, 0.7, (0,0,255),2)
if mouEAR > MOU_AR_THRESH:
cv2.putText(frame, "Yawning, DROWSINESS ALERT! ", (10,70),
cv2.FONT_HERSHEY_SIMPLEX, 0.7, (0,0,255), 2)
yawnStatus = True
output_text = "Yawn Count: " + str(yawns + 1)
cv2.putText(frame, output_text, (10,100),cv2.FONT_HERSHEY_
SIMPLEX,0.7,(255,0,0),2)
else:
yawnStatus = False
if prev_yawn_status == True and yawnStatus == False:

28
yawns+=1
cv2.putText(frame, "MAR: {:.2f}".format(mouEAR), (480, 60),
cv2.FONT_HERSHEY_SIMPLEX, 0.7, (0,0,255), 2)
cv2.putText(frame,"Visual Behaviour & Machine Learning Drowsiness
@ DROWSINESS”, (370,470), cv2. FONT_HERSHEY_COMPLEX,
0.6,(153,51,102),1)
cv2.imshow("Frame", frame)
key = cv2.waitKey(1) & 0xFF
if key == ord("q"):
break
cv2.destroyAllWindows()
webcamera.release()

font = ('times', 16, 'bold')


title = Label(main, text='Driver Drowsiness Monitoring System using Visual\n
Behaviour and Machine Learning',anchor=W, justify=LEFT)
title.config(bg='black', fg='white')
title.config(font=font)
title.config(height=3, width=120)
title.place(x=0,y=5)

font1 = ('times', 14, 'bold')


upload = Button(main, text="Start Behaviour Monitoring Using Webcam",
command=startMonitoring)
upload.place(x=50,y=200)
upload.config(font=font1)

pathlabel = Label(main)
pathlabel.config(bg='DarkOrange1', fg='white')
pathlabel.config(font=font1)
pathlabel.place(x=50,y=250)

main.config(bg='chocolate1')
main.mainloop()

29
CHAPTER 7
TESTING

7.1 INTRODUCTION
Software Testing is defined as an activity to check whether the actual results
match the expected results and to ensure that the software system is Defect free. It
involves execution of a software component or system component to evaluate one or
more properties of interest. Software testing also helps to identify errors, gaps or
missing requirements in contrary to the actual requirements. It can be either done
manually or using automated tools. Some prefer saying Software testing as a White
Box and Black Box Testing.

In simple terms, Software Testing means Verification of Application Under


Test (AUT). Software testing is a critical element of software quality and assurance
and represents ultimate review of specifications, design and coding. Testing is an
exposure of the system to trial input to see whether it produces correct output.

The process of software testing aims not only at finding faults in the existing
software but also at finding measures to improve the software in terms of efficiency,
accuracy and usability. It mainly aims at measuring specification, functionality and
performance of a software program or application.

Software Testing can be done in two ways:


 VERIFICATION: It refers to the set of tasks that ensure that software
correctly implements a specific function.
 VALIDATION: It refers to a different set of tasks that ensure that the
software that has been built is traceable to customer requirements.

VERIFICATION: “Are we building the product right?”


VALIDATION: “Are we building the right product?”

30
IMPORTANCE OF SOFTWARE TESTING:
The importance of software testing is imperative. Software Testing is important
because of the following reasons:
 Software Testing points out the defects and errors that were made during the
development phases. It looks for any mistake made by the programmer during
the implementation phase of the software.
 It ensures that the customer finds the organization reliable and their
satisfaction in the application is maintained. Sometimes contracts include
monetary penalties with respect to the timeline and quality of the product and
software testing prevent monetary losses.
 It also ensures the Quality of the product. Quality product delivered to the
customers helps in gaining their confidence. It makes sure that the software
application requires lower maintenance cost and results in more accurate,
consistent and reliable results.
 Users are not inclined to use software that has bugs. They may not adopt
software if they are not happy with the stability of the application. Testing is
important for the product to stay in business.
 It’s important to ensure that the application should not result in any failures
because it can be very expensive in the future or in the later stages of the
development.

APPLICATIONS OF SOFTWARE TESTING:


 Cost Effective Development: Early testing saves both time and cost in many
aspects, however reducing the cost without testing may result in improper
design of a software application rendering the product useless.
 Product Improvement: During the SDLC phases, testing is never a time
consuming process. However, diagnosing and fixing the errors identified
during proper testing is a time-consuming but productive activity.
 Test Automation: Test Automation reduces the testing time, but it is not
possible to start test automation at any time during software development. Test
automaton should be started when the software has been manually tested and
is stable to some extent. Moreover, test automation can never be used if
requirements keep changing.

31
 Quality Check: Software testing helps in determining following set of
properties of any software such as
 Functionality
 Reliability
 Usability
 Efficiency
 Maintainability
 Portability

7.1.1 TYPES OF SOFTWARE TESTING:


Software Testing can be broadly classified into two types:
1. MANUAL TESTING:
Manual testing is a software testing process in which test cases are executed
manually without using any automated tool. All test cases executed by the tester
manually according to the end user's perspective. It ensures whether the application is
working, as mentioned in the requirement document or not. Test cases are planned
and implemented to complete almost 100 percent of the software application. Test
case reports are also generated manually.
Manual Testing is one of the most fundamental testing processes as it can find
both visible and hidden defects of the software. The difference between expected
output and output, given by the software, is defined as a defect. The developer fixed
the defects and handed it to the tester for retesting.
Manual testing is mandatory for every newly developed software before
automated testing. This testing requires great efforts and time, but it gives the surety
of bug-free software. Manual Testing requires knowledge of manual testing
techniques but not of any automated testing tool.
TYPES OF MANUAL TESTING:
There are various methods used for manual testing. Each technique is used according
to its testing criteria.
Types of manual testing are given below:
 White Box Testing
 Black Box Testing

32
ADVANTAGES OF MANUAL TESTING:
 It does not require programming knowledge while using the Black box method.
 It is used to test dynamically changing GUI design.
 Tester interacts with software as a real user so that they are able to discover
usability and user interface issues.
 It ensures that the software is a hundred percent bug-free.
 It is cost-effective.
 Easy to learn for new testers.
DISADVANTAGES OF MANUAL TESTING:
 It requires a large number of human resources.
 It is very time-consuming.
 Tester develops test cases based on their skills and experience. There is no
evidence that they have covered all functions or not.
 Test cases cannot be used again. Need to develop separate test cases for each
new software.
 It does not provide testing on all aspects of testing.
 Since two teams work together, sometimes it is difficult to understand each
other's motives, it can mislead the process.

2. AUTOMATION TESTING:
Automation testing, which is also known as Test Automation, is when the
tester writes scripts and uses another software to test the product. This process
involves automation of a manual process. Automation Testing is used to re-run the
test scenarios that were performed manually, quickly, and repeatedly.
Apart from regression testing, automation testing is also used to test the
application from load, performance, and stress point of view. It increases the test
coverage, improves accuracy, and saves time and money in comparison to manual
testing.

ADVANTAGES OF AUTOMATION TESTING:


 Automation testing takes less time than manual testing.
 A tester can test the response of the software if the execution of the same
operation is repeated several times.

33
 Automation Testing provides re-usability of test cases on testing of different
versions of the same software.
 Automation testing is reliable as it eliminates hidden errors by executing test
cases again in the same way.
 Automation Testing is comprehensive as test cases cover each and every
feature of the application.
 It does not require many human resources, instead of writing test cases and
testing them manually, they need an automation testing engineer to run them.
 The cost of automation testing is less than manual testing because it requires a
few human resources.

DISADVANTAGES OF AUTOMATION TESTING:


 Automation Testing requires high-level skilled testers.
 It requires high-quality testing tools.
 When it encounters an unsuccessful test case, the analysis of the whole event
is complicated.
 Test maintenance is expensive because high fee license testing equipment is
necessary.
 Debugging is mandatory if a less effective error has not been solved, it can
lead to fatal results.

7.1.2 TESTING ACTIVITIES:


Software level testing can be majorly classified into 4 levels:
1. Unit Testing
2. Integration Testing
3. System Testing
4. Acceptance Testing

34
Figure 7.1 Levels of Testing

1. UNIT TESTING:
Unit Testing is a software testing technique by means of which individual
units of software i.e., group of computer program modules, usage procedures and
operating procedures are tested to determine whether they are suitable for use or not.
It is a testing method using which every independent module is tested to determine if
there are any issue by the developer himself. It is correlated with functional
correctness of the independent modules.
Unit Testing is defined as a type of software testing where individual
components of a software are tested. Unit Testing of software product is carried out
during the development of an application. An individual component may be either an
individual function or a procedure. Unit Testing is typically performed by the
developer.
Unit testing focuses on the building blocks of the software system, that is,
objects and subsystems. They are three motivations behind focusing on components.
First, unit testing reduces the complexity of the overall test activities, allowing us to
focus on smaller units of the system. Unit testing makes it easier to pinpoint and
correct faults given that few computers are involved in this test. Unit testing allows
parallelism in the testing activities; that is each component can be tested
independently of one another.
The specific candidates for unit testing are chosen from the object model and
the system decomposition of the system. In principle, all the objects developed during
the development process should be tested.

35
OBJECTIVE OF UNIT TESTING:
The objective of Unit Testing is:
 To isolate a section of code.
 To verify the correctness of code.
 To test every function and procedure.
 To fix bug early in development cycle and to save costs.
 To help the developers to understand the code base and enable them to make
changes quickly.
 To help for code reuse.

ADVANTAGES:
 Reduces Cost of Testing as defects are captured in very early phase.
 Unit Tests, when integrated with build gives the quality of the build as well.
 Unit Testing allows developers to learn what functionality is provided by a
unit and how to use it to gain a basic understanding of the unit API.
 Unit testing allows the programmer to refine code and make sure the module
works properly.
 Unit testing enables to test parts of the project without waiting for others to be
completed.

2. INTEGRATION TESTING:
Integration testing is the second level of the software testing process comes
after unit testing. In this testing, units or individual components of the software are
tested in a group. The focus of the integration testing level is to expose defects at the
time of interaction between integrated components or units.
Unit testing uses modules for testing purpose, and these modules are combined
and tested in integration testing. The Software is developed with a number of software
modules that are coded by different coders or programmers. The goal of integration
testing is to check the correctness of communication among all the modules.
In integration testing, testers test the interfaces between the different modules.
These modules combine together to form a bigger component or the system. Hence, it
becomes very crucial to validate their behavior when they work together. Apart from
the interfaces, they also test the integrated components. Integration testing is the next

36
level of testing after unit testing. Testers do it after completion of the unit testing
phase. Integration testing techniques can be a white box or black box depending on
the project requirements.

OBJECTIVES OF INTEGRATION TESTING:


Integration testing reduces the risk of finding the defects in integrated
components in the System testing phase. Integration defects can be complex to fix and
they can be time-consuming as well. Finding them early in the cycle eliminates the
risk of making too many changes at the System testing phase. As each of the
integrating components has been tested in the integration phase, the System testing
can focus on end-to-end journeys and user-specific flows.
 Reducing risk by testing integrating components as they become available.
 Verify whether the functional and non-functional behaviours of the interfaces
are designed as per the specification.
 To build confidence in the quality of the interfaces.
 To find defects in the components, system or in the interfaces.
 Prevents defects from escaping to higher test levels of testing i.e. System
testing.

GUIDELINES FOR INTEGRATION TESTING:


 First, determine the test case strategy through which executable test cases can
be prepared according to test data.
 Examine the structure and architecture of the application and identify the
crucial modules to test them first.
 Design test cases to verify each interface in detail.
 Choose input data for test case execution. Input data plays a significant role in
testing.
 Fix defects and retest.

ADVANTAGES OF INTEGRATION TESTING:


 It helps to find defects from links and interfaces between the modules.
 It boosts the confidence level of the team in the product as it validates the
group of modules together.
 Integration tests run faster than the end-to-end test scenarios.

37
 It results in higher code coverage.
 It starts in the early stages when the entire module may not be ready. Hence, it
avoids the bugs getting into the system.

3. SYSTEM TESTING:
System Testing is a type of software testing that is performed on a complete
integrated system to evaluate the compliance of the system with the corresponding
requirements.
In other words, System Testing means testing the system as a whole. All the
modules/components are integrated in order to verify if the system works as expected
or not. System Testing is done after Integration Testing. This plays an important role
in delivering a high-quality product.
The purpose of a system test is to evaluate the end-to-end system
specifications. Usually, the software is only one element of a larger computer-based
system. Ultimately, the software is interfaced with other software/hardware systems.
System Testing is actually a series of different tests whose sole purpose is to exercise
the full computer-based system.
In system testing, integration testing passed components are taken as input.
The goal of integration testing is to detect any irregularity between the units that are
integrated together. System testing detects within both the integrated units and the
whole system. The result of system testing is the observed behavior of a component or
a system when it is tested.
System Testing is carried out on the whole system in the context of either
system requirement specifications or functional requirement specifications or in the
context of both. System testing tests the design and behavior of the system and also
the expectations of the customer.

OBJECTIVES OF SYSTEM TESTING:


The primary objectives of System testing are as below:
 One of the primary objectives of System testing is to reduce risk. Even after
individual testing of components, risk of how they will all come together to
form a complete System still exists. System testing eliminates this risk by
ensuring that it will function as per customer requirements.

38
 System testing must verify whether the design of the functional and non-
functional behaviours of the system is as per the customer’s specifications.
 Validate that the system is complete and will work as expected.
 System testing aims to build confidence in the quality of the system as a whole.
 System testing also aims to find defects and to prevent defects from escaping
to higher test levels or production. Additionally, it is the only phase that
occurs on the full System just before the User Acceptance testing. So it’s
critical to find all the possible defects at this stage, and they don’t leak to
production.
 System Testing results are used by stakeholders to make release decisions. The
Entry criteria for User Acceptance testing is the basis completion of System
Testing. System testing may also adhere to legal or regulatory requirements or
standards.

GUIDELINES FOR SYSTEM TESTING:


 The very first step is to create a Test Plan.
 Create System Test Cases and test scripts.
 Prepare the test data required for this testing.
 Execute the system test cases and script.
 Report the bugs. Re-testing the bugs once fixed.
 Regression testing to verify the impact of the change in the code.
 Repetition of the testing cycle until the system is ready to be deployed.
 Sign off from the testing team.

ADVANTAGES OF SYSTEM TESTING:


 It covers a complete end to end software testing.
 The business requirements and system software architecture are both tested in
system testing.
 Appropriate system testing help in relieving after production goes live issues
and bugs.
 System testing is led in a situation like a production condition or some of the
time it is finished with production parallel test condition where the same data
input is feed to the exiting framework and new framework to look at the
differences in functionalities removed and added. This causes the client to
39
understand the new framework better and feel great with new functionalities
included or existing functionalities revised or removed.

4. ACCEPTANCE TESTING:
Acceptance Testing is a method of software testing where a system is tested
for acceptability. The major aim of this test is to evaluate the compliance of the
system with the business requirements and assess whether it is acceptable for delivery
or not.
The standard definition of Acceptance testing is given as, “It is a formal
testing according to user needs, requirements and business processes conducted to
determine whether a system satisfies the acceptance criteria or not and to enable the
users, customers or other authorized entities to determine whether to accept the
system or not.”
Acceptance Testing is the last phase of software testing performed after
System Testing and before making the system available for actual use.
The main goal behind acceptance testing is to check whether the developed
software product passes the acceptance norms defined on the basis of user and
business requirements, so as to declare it acceptable or non-acceptable for its use by
the users. Acceptance testing is one of the last types of software testing performed
over a software or application. It is conducted by a pool of targeted users to ensure the
readiness and quality of the system from user's perspective, which allows the team to
meet their needs and expectations.

OBJECTIVES OF ACCEPTANCE TESTING:


Following are the three major objectives of Acceptance Testing:
 Confirm that the system meets the agreed-upon criteria.
 Identify and resolve discrepancies, if there are any.
 Determine the readiness of the system for cut-over to live operations. The final
acceptance of a system for deployment is conditioned upon the outcome of the
acceptance testing. The acceptance test team produces an acceptance test
report which outlines the acceptance conditions.

40
ADVANTAGES OF ACCEPTANCE TESTING:
Acceptance testing has the following benefits, complementing those which can be
obtained from unit tests:
 Encouraging closer collaboration between developers on the one hand and
customers, users or domain experts on the other, as they entail that business
requirements should be expressed
 Providing a clear and unambiguous “contract” between customers and
developers; a product which passes acceptance tests will be considered
adequate (though customers and developers might refine existing tests or
suggest new ones as necessary).
 Decreasing the chance and severity both of new defects and regressions
(defects impairing functionality previously reviewed and declared acceptable).

7.2 DESIGN OF TEST CASES AND SCENARIOS


7.2.1 TEST CASE DESIGN:
The design of tests for software and other engineering products can be as
challenging as the initial design of the product. Test case methods provide the
developer with a systematic approach to testing. Moreover, these methods provide a
mechanism that can help to ensure the completeness of tests and provide the highest
like hood for uncovering errors in software.
Any Engineered product can be tested in either of the two ways.
i Knowing the specified function that a product has been designed to perform,
tests can be conducted. These tests demonstrate whether each function is full
operational and at the same time searches for errors in each function.
ii Knowing the internal workings of a product, tests can be conducted to ensure
that internal operations are performed according to specifications and all
internal components hence been adequately exercised.

Test case design methods are divided into two types:


1. White-box testing
2. Black-box testing

41
1. WHITE-BOX TESTING
White –box testing, sometimes called glass-box testing is a test, case designed
method that uses the control structure of the procedural design to derive test cases.
Using white-box testing methods, the s/w engineer can derive test cases that guarantee
that all independent paths within a module have been exercised at least once. Exercise
all logical decisions on their true and false sides. Execute all loops at their boundaries
and within their operational bounds. Exercise internal data structures to ensure their
validity.
 Basis path testing is a white-box testing technique. The basis path
method enables the test case designer to derive a logical complexity
measure of a procedural design and use this measure as a guide for
defining a basis set are guaranteed to exercise every statement in the
program at least one-time during testing.

ADVANTAGES:
 As the tester has knowledge of the source code, it becomes very easy to find
out which type of data can help in testing the application effectively.
 It helps in optimizing the code.
 Extra lines of code can be removed which can bring in hidden defects.
 Due to the tester's knowledge about the code, maximum coverage is attained
during test scenario writing.

DISADVANTAGES:

 Due to the fact that a skilled tester is needed to perform white-box testing, the
costs are increased.
 Sometimes it is impossible to look into every nook and corner to find out
hidden errors that may create problems, as many paths will go untested.
 It is difficult to maintain white-box testing, as it requires specialized tools like
code analyzers and debugging tools.

42
2. BLACK BOX TESTING

Black-box testing, also called behavioural testing, focuses on the functional


requirements of the s/w. Black-box testing enables the software engineer to derive
sets of input conditions that will fully exercise all functional requirements of a
program. It is a complementary approach that is likely to uncover a different class of
errors that white box methods could not.

Black-box testing attempted to find errors in the following categories.

 Incorrect or missing functions.


 Interface errors.
 Errors in data structures or external data base access.
 Behaviour or performance errors.
 Initialization and termination errors.

Black-box testing purposely disregards control structure; attention is focused


on information domain. By applying black-box techniques, we derive a set of cases
that satisfies the criteria test cases that reduce, by a count that is greater than one, the
number of additional test cases that must be designed to achieve reasonable testing.
Test cases that tell us something about the presence or absence of classes of errors,
rather than an error associated only with the specified.

ADVANTAGES

 Well suited and efficient for large code segments.


 Code access is not required.
 Clearly separates user's perspective from the developer's perspective through
visibly defined roles.
 Large numbers of moderately skilled testers can test the application with no
knowledge of implementation, programming language, or operating systems.

DISADVANTAGES

 Limited coverage, since only a selected number of test scenarios is actually


performed.
 Inefficient testing, due to the fact that the tester only has limited knowledge
about an application.

43
 Blind coverage, since the tester cannot target specific code segments or error-
prone areas.

7.2.2 SCENARIOS

S.NO. Description Detected Result Remarks


Stage

1 Verify the Unit Clickable Result satisfied


button is Testing
clickable or not.

2 Check the Unit yes Result satisfied


button name Testing
shows as per
requirement or
not.
3 Check that Unit Yes Result satisfied
window directs Testing
to the expected
video recording
screen when
user clicks on
the button.
4 Driver opens his Functional Displays the message Result satisfied
eyes. Testing as “Eyes Open”.
i.e. Eyes Open
State
5 Driver closes or Functional Displays the Result satisfied
blinks his eyes. message as “Eyes
Testing
i.e. Eyes Close Close” and gives
State drowsiness alert.
6 Driver starts Functional Displays the yawn Result satisfied
yawning. Testing count and gives
drowsiness alert.

Table 7.1 Testing Scenarios

44
CHAPTER 8
RESULTS
8.1 Run the
application

 The main file of our application is “DrowsinessDetector.py” file.

Figure 8.1 DrowsinessDetector.py file

 To run the application, open command prompt and run DrowsinessDetector.py


file.

45
Figure 8.2 Command Prompt Screen

46
8.2 OUTPUT SCREENS
 The main window of the application gets opened.
 Then click on start Start Behaviour Monitoring Using Webcam button.

Figure 8.3 Main Window

47
 We place a synthetic driver infront of the webcam.
 The webcam starts recording the video.
 It calculates the Eye Aspect Ratio and Mouth Opening Ratio and compares
with threshold values.
 As a result, it displays the message as “Eyes Open” as shown in Figure 8.4.

Figure 8.4 Eyes Open State

48
 Now the synthetic driver closes his eyes.
 It calculates the Eye Aspect Ratio and Mouth Opening Ratio and
compares with threshold values continuously.
 As a result, it displays the message as “Eyes Closed DROWSINESS ALERT”
as shown in Figure 8.5.

Figure 8.5 Eyes Closed State

49
 Now the synthetic driver starts yawning.
 It calculates the Eye Aspect Ratio and Mouth Opening Ratio and
compares with threshold values continuously.
 As a result, it displays the message as “Eyes Open Yawning, DROWSINESS
ALERT! Yawn Count: 4” as shown in Figure 8.6.

Figure 8.6 Yawn Count State

50
CHAPTER 9
CONCLUSIO
N

9.1 PROJECT CONCLUSION


A low cost, real time driver drowsiness monitoring system has been developed
based on visual behavior and machine learning. Here, visual behavior features like
eye aspect ratio, mouth opening ratio are computed from the streaming video,
captured by a webcam. An adaptive thresholding technique has been developed to
detect driver drowsiness in real time. The developed system works accurately with the
generated synthetic data. Subsequently, the feature values are stored and machine
learning algorithms have been used for classification. SVM have been explored here,
the sensitivity of SVM is 0.956 and specificity is 98%. Also, the system will be
implemented in hardware to make it portable for car system.

9.2 FUTURE ENHANCEMENT


In near future we could add more aspects to this system, like detection of head
bending to make the system more accurate. We could connect the application to the
wearable devices like smart watch. So that we could alert the driver through the
vibration of smart watch. We would add one more aspect to this like setting reminders
in drivers smart watch to notify him to take rest in the case of drowsiness.
Unfortunately, the accidents may happen. For this kind of situations we would
add one more module which automatically connects call to a emergency service or
concerned person.

51
CHAPTER 10

BIBLIOGRAPGHY

10.1 PAPER REFERENCES

 R. Kumaran, R. Deepak Kumar, B. Rahul, M. Karthok, "Intelligent Video-


Based Drowsy Driver Detection System under Various Illuminations and
Embedded Software Implementation", 2020 IJERT.
 S. Singh, N. P. papanikolopoulos, “Monitoring Driver Fatigue using Facial
Analysis Techniques”, IEEE Conference on Intelligent Transportation System.
 W. B. Horng, C. Y. Chen, Y. Chang, C. H. Fan, “Driver Fatigue Detection
based on Eye Tracking and Dynamic Template Matching”, IEEE International
Conference on Networking, Sensing and Control.

10.2 WEBSITES

 https://www.researchgate.net/publication/353922961_DRIVER_DROWSINE
SS_MONITORING_SYSTEM_USING_VISUAL_BEHAVIOUR_AND_MA
CHINE_LEARNING
 https://www.springerprofessional.de/en/svm-based-drivers-drowsiness-
detection-using-machine-learning-an/18570020
 https://www.semanticscholar.org/paper/Driver-drowsiness-monitoring-system-
using-visual-Kumar-Patra/1a179a87878e6168001f7333ae4135b6331c2133
 https://www.slideshare.net/venkatjavaprojects/driver-drowsiness-monitoring-
system-using-visual-behaviour-and-machine-learning

52

You might also like