0% found this document useful (0 votes)
37 views61 pages

DDTS Document

Uploaded by

SUBBU B
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)
37 views61 pages

DDTS Document

Uploaded by

SUBBU B
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/ 61

DRIVER DROWSINESS DETECTION SYSTEM

CHAPTER 1
INTRODUCTION
Sleep-deprived driving (commonly known as tired driving, drowsy driving, or
fatigued driving) is the operation of a motor vehicle while being cognitively impaired
by a lack of sleep. Sleep deprivation is a major cause of motor vehicle accidents, and
it can impair the human brain as much as inebriation can. According to a 1998 survey,
23% of adults have fallen asleep while driving. According to the United States
Department of Transportation, male drivers admit to have fallen asleep while driving
twice as much as female drivers. In the United States, 250,000 drivers fall asleep at
the wheel every day, according to the Division of Sleep Medicine at Harvard Medical
School and in a national poll by the National Sleep Foundation, 54% of adult drivers
said they had driven while drowsy during the past year with 28% saying they had
actually fallen asleep while driving. According to the National Highway Traffic Safety
Administration, drowsy driving is a factor in more than 100,000 crashes, resulting in
6,550 deaths and 80,000 injuries annually in the USA.When a person does not get an
adequate amount of sleep, their ability to function is affected. As listed below, their
coordination is impaired, have longer reaction time, impairs judgment, and memory
is impaired. The number of vehicles on the road is increasing day by day; road
accidents have become common in most parts of the country and the leading cause of
death. As we know, the person behind the steering is responsible for the road traffic
system and road traffic safety. The driver is responsible for himself in addition to the
passengers in the vehicle. Drowsiness is a human trait that is often ignored by many
people when it comes to their safety. But this characteristic can cause problems to the
driver and the passengers if it is not considered and reacted upon, or else it may lead
to an accident and be the cause of death. Driver Drowsiness is a demanding issue that
needs to be taken care of to improve road traffic safety. Driver drowsiness detection
is an essential component in modern-day driver monitoring systems because too many
traffic accidents are happening worldwide due to drivers’ drowsiness. Hence, we are
implementing an application which tends in detecting the drowsiness of a person that
can help in the early detection so that co passengers or driver may get an alert from
which the accidents can be prevented. With this Python project, we will be making a
drowsiness detection system. A countless number of people drive on the highway day
and night. Taxi drivers, bus drivers, truck drivers and people traveling long-distance

Dept. of CSE, S V College of Engineering 1


DRIVER DROWSINESS DETECTION SYSTEM

suffer from lack of sleep. Due to which it becomes very dangerous to drive when
feeling sleepy. The majority of accidents happen due to the drowsiness of the driver.
So, to prevent these accidents we will build a system using Python, OpenCV, and
Keras which will alert the driver when he feels sleepy.

Car accident is the major cause of death in which around 1.3 million people die every
year. Majority of these accidents are caused because of distraction or the drowsiness
of driver. The countless number of people drives for long distance every day and night
on the highway. Drowsiness appears in situations of stress and fatigue in an
unexpected and inopportune way, and it may be produced by sleep disorders, certain
type of medications, and even, boredom situations, for example, driving for a long
time. In this way, drowsiness produces danger situations and increases the probability
that an accident occurs. In this context, it is important to use new technologies to
design and to build systems that will monitor drivers, and measure their level of
attention throughout the whole driving process. To prevent such accidents, our team
has come up with a solution for this. In this system, a camera is used to record user's
visual characteristics. We use face detection and CNN techniques and try to detect the
drowsiness of driver, if he/she is drowsy then alarm will be generated. So that the
driver will get cautious and take preventive measures. Driver drowsiness detection
contributes to the decrease in the number of deaths occurring in traffic accident.
Humans have always invented machines and devised techniques to ease and protect
their lives, for mundane activities like traveling to work, or for more interesting
purposes like aircraft travel. With the advancement in technology, modes of
transportation kept on advancing and our dependency on it started increasing
exponentially. It has greatly affected our lives as we know it. Now, we can travel to
places at a pace that even our grandparents wouldn’t have thought possible. In modern
times, almost everyone in this world uses some sort of transportation every day. Some
people are rich enough to have their own vehicles while others use public
transportation. However, there are some rules and codes of conduct for those who
drive irrespective of their social status. One of them is staying alert and active while
driving.

Dept. of CSE, S V College of Engineering 2


DRIVER DROWSINESS DETECTION SYSTEM

CHAPTER 2
LITERATURE SURVEY

[1] Gwak, J., Hirao, A., Shino, and M: The purpose of this study is to investigate
the feasibility of classification of the alert states of drivers, particularly the slightly
drowsy state, based on hybrid sensing of vehicle-based, behavioral, and physiological
indicators with consideration for the implementation of these identifications into a
detection system. First, we measured the drowsiness level, driving performance,
physiological signals (from electroencephalogram and electrocardiogram results), and
behavioral indices of a driver using a driving simulator and driver monitoring system.
Next, driver alert and drowsy states were identified by machine learning algorithms,
and a dataset was constructed from the extracted indices over a period of 10 s. Finally,
ensemble algorithms were used for classification.

[2] You, F., Li, X., Gong, Y., Wang, H., Li, H: This paper proposed a real-time
driving drowsiness detection algorithm that considers the individual differences of
driver. A deep cascaded convolutional neural network was constructed to detect the
face region, which avoids the problem of poor accuracy caused by artificial feature
extraction. Based on the Dlib toolkit, the landmarks of frontal driver facial in a frame
are found. According to the eyes landmarks, a new parameter, called Eyes Aspect
Ratio, is introduced to evaluate the drowsiness of driver in the current frame. Taking
into account differences in size of driver’s eyes, the proposed algorithm consists of
two modules: offline training and online monitoring. In the first module, a unique
fatigue state classifier, based on Support Vector Machines, was trained which taking
the Eyes Aspect Ratio as input. Then, in the second module, the trained classifier is
application to monitor the state of driver online. Because the fatigue driving state is
gradually produced, a variable which calculated by number of drowsy frames per unit
time is introduced to assess the drowsiness of driver.

[3] Mehta, S., Dadhich, S., Gumber, S., Bhatt, A.J: In this paper, a light-weight,
real time driver’s drowsiness detection system was developed and implemented on
Android application. The system records the videos and detects driver’s face in every
frame by employing image processing techniques. The system is capable of detecting
facial landmarks, computes Eye Aspect Ratio (EAR) and Eye Closure Ratio (ECR) to

Dept. of CSE, S V College of Engineering 3


DRIVER DROWSINESS DETECTION SYSTEM

detect driver’s drowsiness based on adaptive thresholding. Machine learning


algorithms have been employed to test the efficacy of the proposed approach.

[4] Song, F., Tan, X., Liu, X., Chen, S: In this paper, an approach was proposed to
deal with the problem of detecting whether the eyes in a given still face image are
closed, which has wide potential applications in human–computer interface design,
facial expression recognition, driver fatigue detection, and so on. The approach
combines the strength of multiple feature sets to characterize the rich information of
eye patches (concerning both local/global shapes and local textures) and to construct
the eye state model. To further improve the model’s robustness against image noise
and scale changes, we propose a new feature descriptor named Multi-scale Histograms
of Principal Oriented Gradients (MultiHPOG).

[5] Savas, B.K., Becerikli, Y: In this article, a Multi-tasking Convolutional Neural


Network (ConNN∗) model was proposed to detect driver drowsiness/fatigue. Eye and
mouth characteristics are utilized for driver’s behavior model. Changes to these
characteristics are used to monitor driver fatigue. With the proposed Multi-task
ConNN model, unlike the studies in the literature, both mouth and eye information are
classified into a single model at the same time. Driver fatigue is determined by
calculating eyes’ closure duration/Percentage of eye closure (PERCLOS) and
yawning frequency/frequency of mouth (FOM).

[6] Bavkar, S., Iyer, B., Deosarkar, S: The proposed method employs absolute
gamma band power used as a feature and ensemble subspace K-NN used as a classifier
to categorize alcoholics and normal subject. Furthermore, an Improved Binary
Gravitational Search Algorithm (IBGSA) is reported as an optimization tool to select
the optimum EEG channels for the rapid screening of alcoholism. The results obtained
by the proposed method are compared with the optimization algorithms like a genetic
algorithm (GA), binary particle swarm optimization (BPSO), and binary gravitational
search algorithm (BGSA).

[7] Bavkar, S., Iyer, B., Deosarkar, S: The paper reports a methodology for the
detection of optimal channels for alcoholism analysis using EEG data. The proposed
technique employs the Empirical Mode Decomposition (EMD) technique to extract
the amplitude and frequency modulated bandwidth features from the Intrinsic Mode

Dept. of CSE, S V College of Engineering 4


DRIVER DROWSINESS DETECTION SYSTEM

Function (IMF) and ensemble subspace K-NN as a classifier to classify alcoholics and
normal. The optimum channels are selected, using a harmony search algorithm. The
fitness value of discrete binary harmony search (DBHS) optimization algorithms is
calculated using accuracy and sensitivity achieved by the ensemble subspace K-
Nearest Neighbor classifier.

[8] Sathasivam, S., Mahamad, A.K., Saon, S., Sidek, A., Som, M.M., Ameen, and
H.A: In this paper, image detection drowsiness system is proposed to detect the state
of the car driver using Eye Aspect Ratio (EAR) technique. A developed system that
occupied with the Pi camera, Raspberry Pi 4 and GPS module are used to detect and
analyze continuously the state of eye closure in real time. This system able to
recognize whether the driver is drowsy or not, with the initial, wearing spectacles, dim
light and micro sleep condition.

Summary: From the above-mentioned review, authors have implemented the some
of hybrid algorithms [1], some of the machine learning algorithms [4] [6] using the
different datasets that which also includes EEG data [7] and used the only eye ratios
[8] to detect the drowsiness. By the above-mentioned methods, we may get the
accuracy but, when coming to accurate results these methods may not perform really
well. Hence, we are introducing a deep learning method that which is performed using
the CNN based transfer learning method (MobileNet) that which provides not only
the good accuracy but also with the good detection of drowsiness.

Dept. of CSE, S V College of Engineering 5


DRIVER DROWSINESS DETECTION SYSTEM

CHAPTER 3
SYSTEM ANALYSIS
3.1 Existing Method:
This model emphasizes an existing method that which was designed using the some
of the algorithms of machine learning. Here the process does not perform accurately
with the algorithms that were used and detection is not up to the expected levels
accuracy.
Disadvantages:
• Less feature compatibility
• Improper detection

3.2 Proposed System:


In our proposed method we are performing the drowsiness detection. We are using the
CNN based transfer learning model (MobileNet) for the training the data. Once after
the training we are using the OpenCV library. The process starts with capturing the
live video stream from the camera and is processed to be sent to the model to predict
drowsiness. Each frame is checked for checking the state of the eyes as open or closed.
Suppose the state of the eyes is closed for more than a specific time set in the system.
If drowsiness is detected, the system will alert the driver and the passengers with a
siren. Flow of proposed method is shown below.

Advantages:

• Accurate classification
• Less complexity

• High performance

3.3 Feasibility Study:


The feasibility of the project is analyzed in this phase and business proposal is put
forth with a very general plan for the project and some cost estimates. During system
analysis the feasibility study of the proposed system is to be carried out. This is to
ensure that the proposed system is not a burden to the company. For feasibility
analysis, some understanding of the major requirements for the system is essential.

Three key considerations involved in the feasibility analysis are,

Dept. of CSE, S V College of Engineering 6


DRIVER DROWSINESS DETECTION SYSTEM

Economic Feasibility
This study is carried out to check the economic impact that the system will
have on the organization. The amount of fund that the company can pour into
the research and development of the system is limited. The expenditures must
be justified. Thus, the developed system as well within the budget and this was
achieved because most of the technologies used are freely available. Only the
customized products had to be purchased.
Technical Feasibility
This study is carried out to check the technical feasibility, that is, the technical
requirements of the system. Any system developed must not have a high
demand on the available technical resources. This will lead to high demands
on the available technical resources. This will lead to high demands being
placed on the client. The developed system must have a modest requirement,
as only minimal or null changes are required for implementing this system.
Social Feasibility
The aspect of study is to check the level of acceptance of the system by the
user. This includes the process of training the user to use the system efficiently.
The user must not feel threatened by the system, instead must accept it as a
necessity. The level of acceptance by the users solely depends on the methods
that are employed to educate the user about the system and to make him
familiar with it. His level of confidence must be raised so that he is also able
to make some constructive criticism, which is welcomed, as he is the final user
of the system.

Dept. of CSE, S V College of Engineering 7


DRIVER DROWSINESS DETECTION SYSTEM

3.4 Block Diagram for Proposed System:

Fig 3.1: Block diagram of proposed system

Dept. of CSE, S V College of Engineering 8


DRIVER DROWSINESS DETECTION SYSTEM

3.5 Architecture:

Fig 3.2: Architecture

Dept. of CSE, S V College of Engineering 9


DRIVER DROWSINESS DETECTION SYSTEM

CHAPTER 4
SOFTWARE AND HARDWARE REQUIREMENTS

Hardware Specifications:
• Processor : I3/Intel Processor
• RAM : 8GB (min)
• Hard Disk : 128 GB

Software Specifications:
• Operating System : Windows 10
• Server-side Script : Python 3.6
• IDE : PyCharm
• Libraries Used : NumPy, IO, OS, Karas, TensorFlow, OpenCV.

Dept. of CSE, S V College of Engineering 10


DRIVER DROWSINESS DETECTION SYSTEM

CHAPTER 5
SYSTEM DESIGN

5.1 Input Design:


In an information system, input is the raw data that is processed to produce output.
During the input design, the developers must consider the input devices such as PC,
MICR, OMR, etc. Therefore, the quality of system input determines the quality of
system output. Well-designed input forms and screens have following properties −
• It should serve specific purpose effectively such as storing, recording, and
retrieving the information.
• It ensures proper completion with accuracy.
• It should be easy to fill and straightforward.
• It should focus on user’s attention, consistency, and simplicity.
• All these objectives are obtained using the knowledge of basic design principles
Objectives for Input Design:
• To design data entry and input procedures
• To reduce input volume
• To design source documents for data capture or devise other data capture
methods
• To design input data records, data entry screens, user interface screens, etc.
• To use validation checks and develop effective input controls.
5.2 Output Design:
The design of output is the most important task of any system. During output design,
developers identify the type of outputs needed, and consider the necessary output
controls and prototype report layouts.
Objectives of Output Design:
• To develop output design that serves the intended purpose and eliminates the
production of unwanted output.
• To develop the output design that meets the end user’s requirements.
• To deliver the appropriate quantity of output.
• To form the output in appropriate format and direct it to the right person.

Dept. of CSE, S V College of Engineering 11


DRIVER DROWSINESS DETECTION SYSTEM

5.3 Uml Diagrams:


UML stands for Unified Modeling Language. UML is a standardized general-purpose
modeling language in the field of object-oriented software engineering. The standard
is managed, and was created by, the Object Management Group.
The goal is for UML to become a common language for creating models of object-
oriented computer software. In its current form UML is comprised of two major
components: a Meta-model and a notation. In the future, some form of method or
process may also be added to; or associated with, UML.
The Unified Modeling Language is a standard language for specifying, Visualization,
Constructing and documenting the artifacts of software system, as well as for business
modeling and other non-software systems. The UML represents a collection of best
engineering practices that have proven successful in the modeling of large and
complex systems. The UML is a very important part of developing object-oriented
software and the software development process. The UML uses mostly graphical
notations to express the design of software projects.
Goals:
The Primary goals in the design of the UML are as follows:
1. Provide users a ready-to-use, expressive visual modelling Language so that they
can develop and exchange meaningful models.
2. Provide extendibility and specialization mechanisms to extend the core
concepts.
3. Be independent of particular programming languages and development process.
4. Provide a formal basis for understanding the modelling language.
5. Encourage the growth of OO tools market.
6. Support higher level development concepts such as collaborations, frameworks,
patterns and components.
7. Integrate best practices.

5.4 Use Case Diagram:


 A use case diagram in the Unified Modeling Language (UML) is a type of
behavioral diagram defined by and created from a Use-case analysis.
 Its purpose is to present a graphical overview of the functionality provided by a
system in terms of actors, their goals (represented as use cases), and any dependencies
between those use cases.

Dept. of CSE, S V College of Engineering 12


DRIVER DROWSINESS DETECTION SYSTEM

 The main purpose of a use case diagram is to show what system functions are
performed for which actor. Roles of the actors in the system can be depicted.

Load model
Input video
Train the model

Captures video View detected object

System User

Pre-process data

Stops video

Stops video capturing Detetcts object

Fig 5.1: Usecase Diagram For System & User

5.4 Class Diagram:


In software engineering, a class diagram in the Unified Modeling Language (UML) is
a type of static structure diagram that describes the structure of a system by showing
the system's classes, their attributes, operations (or methods), and the relationships
among the classes. It explains which class contains information

Fig 5.2: Class Diagram

Dept. of CSE, S V College of Engineering 13


DRIVER DROWSINESS DETECTION SYSTEM

5.5 Sequence Diagram:


 A sequence diagram in Unified Modeling Language (UML) is a kind of
interaction diagram that shows how processes operate with one another and in what
order.

 It is a construct of a Message Sequence Chart. Sequence diagrams are


sometimes called event diagrams, event scenarios, and timing diagrams

System User

Load model

Train model

Input video

Captures video

Pre-process data

Detects object

View detected object

Stops video

Stops video capture

Fig 5.3: Sequence Diagram For User & System

Dept. of CSE, S V College of Engineering 14


DRIVER DROWSINESS DETECTION SYSTEM

5.6 Collaboration Diagram:


In collaboration diagram the method call sequence is indicated by some numbering technique
as shown below. The number indicates how the methods are called one after another. We have
taken the same order management system to describe the collaboration diagram. The method
calls are similar to that of a sequence diagram. But the difference is that the sequence diagram
does not describe the object organization whereas the collaboration diagram shows the object
organization.

1: Load model
2: Train model
4: Captures video
5: Pre-process data
6: Detects object
9: Stops video capture

System User

3: Input video
7: View detected object
8: Stops video

Fig 5.4: Collaboration Diagram

5.7 Deployment Diagram


Deployment diagram represents the deployment view of a system. It is related to the
component diagram. Because the components are deployed using the deployment
diagrams. A deployment diagram consists of nodes. Nodes are nothing but physical
hardware’s used to deploy the application.

Fig 5.5: Deployment Diagram

Dept. of CSE, S V College of Engineering 15


DRIVER DROWSINESS DETECTION SYSTEM

5.8 Activity Diagram:


Activity diagrams are graphical representations of workflows of stepwise activities
and actions with support for choice, iteration and concurrency. In the Unified
Modeling Language, activity diagrams can be used to describe the business and
operational step-by-step workflows of components in a system. An activity diagram
shows the overall flow of control.

System User

Load model

Train model Input video

Captures video

Pre-process data View detected object

Detects object

Stops video Stops video

Fig 5.6: Activity Diagram

Dept. of CSE, S V College of Engineering 16


DRIVER DROWSINESS DETECTION SYSTEM

5.9 Component Diagram:


A component diagram, also known as a UML component diagram, describes the
organization and wiring of the physical components in a system. Component
diagrams are often drawn to help model implementation details and double-check that
every aspect of the system's required function is covered by planned development.

Fig 5.7: Component Diagram

5.10 ER Diagram:
An Entity–relationship model (ER model) describes the structure of a database with
the help of a diagram, which is known as Entity Relationship Diagram (ER Diagram).
An ER model is a design or blueprint of a database that can later be implemented as a
database. The main components of E-R model are: entity set and relationship set.
An ER diagram shows the relationship among entity sets. An entity set is a group of
similar entities and these entities can have attributes. In terms of DBMS, an entity is
a table or attribute of a table in database, so by showing relationship among tables and
their attributes, ER diagram shows the complete logical structure of a database. Let’s
have a look at a simple ER diagram to understand this concept.

Fig 5.8: ER Diagram

Dept. of CSE, S V College of Engineering 17


DRIVER DROWSINESS DETECTION SYSTEM

5.11 DFD Diagram:


A Data Flow Diagram (DFD) is a traditional way to visualize the information flows
within a system. A neat and clear DFD can depict a good amount of the system
requirements graphically. It can be manual, automated, or a combination of both. It
shows how information enters and leaves the system, what changes the information
and where information is stored. The purpose of a DFD is to show the scope and
boundaries of a system as a whole. It may be used as a communications tool between
a systems analyst and any person who plays a part in the system that acts as the starting
point for redesigning a system.
Context level diagram

Level-1 diagram

Dept. of CSE, S V College of Engineering 18


DRIVER DROWSINESS DETECTION SYSTEM

Level-2 diagram

Fig 5.12: Data Flow Diagrams

Dept. of CSE, S V College of Engineering 19


DRIVER DROWSINESS DETECTION SYSTEM

CHAPTER 6
ALGORITHM
6.1. Convolutional Neural Network
Step1: Convolutional Operation
The first building block in our plan of attack is convolution operation. In this step, we
will touch on feature detectors, which basically serve as the neural network's filters.
We will also discuss feature maps, learning the parameters of such maps, how patterns
are detected, the layers of detection, and how the findings are mapped out.

Fig 6.1: Convolution Operation -1


Dept. of CSE, S V College of Engineering 20
DRIVER DROWSINESS DETECTION SYSTEM

Step (1b): ReLU Layer


The second part of this step will involve the Rectified Linear Unit or Relook. We will
cover Relook layers and explore how linearity functions in the context of
Convolutional Neural Networks.
Not necessary for understanding CNN's, but there's no harm in a quick lesson to
improve your skills.

Fig 6.2: Convolution Operation-2

Step 2: Pooling Layer

In this part, we'll cover pooling and will get to understand exactly how it generally
works. Our nexus here, however, will be a specific type of pooling; max pooling. We'll
cover various approaches, though, including mean (or sum) pooling. This part will
end with a demonstration made using a visual interactive tool that will definitely sort
the whole concept out for you.
Max Pooling:
Max pooling is a pooling operation that selects the maximum element from the region

Dept. of CSE, S V College of Engineering 21


DRIVER DROWSINESS DETECTION SYSTEM

of the feature map covered by the filter. Thus, the output after max-pooling layer
would be a feature map containing the most prominent features of the previous feature
map.

Fig 6.3: Max Pooling Operation


Average Pooling:

Average pooling computes the average of the elements present in the region of feature
map covered by the filter. Thus, while max pooling gives the most prominent feature
in a particular patch of the feature map, average pooling gives the average of features
present in a patch.

Fig 6.4: Average Pooling Operation

Dept. of CSE, S V College of Engineering 22


DRIVER DROWSINESS DETECTION SYSTEM

Step 3: Flattening:

This will be a brief breakdown of the flattening process and how we move from pooled
to flattened layers when working with Convolutional Neural Networks.

Step 4: Full Connection:

In this part, everything that we covered throughout the section will be merged
together. By learning this, you'll get to envision a fuller picture of how Convolutional
Neural Networks operate and how the "neurons" that are finally produced learn the
classification of images.

Summary:
In the end, we'll wrap everything up and give a quick recap of the concept covered in
the section. If you feel like it will do you any benefit (and it probably will), you should
check out the extra tutorial in which Softmax and Cross-Entropy are covered. It's not
mandatory for the course, but you will likely come across these concepts when
working with Convolutional Neural Networks and it will do you a lot of good to be
familiar with them.

Fig 6.5: Block diagram of CNN

Dept. of CSE, S V College of Engineering 23


DRIVER DROWSINESS DETECTION SYSTEM

Fig 6.6: CNN Architecture

MobileNet:
MobileNet is an efficient and portable CNN architecture that is used in real world
applications. MobileNets primarily use depth wise separable convolutions in place of
the standard convolutions used in earlier architectures to build lighter models.
MobileNets introduce two new global hyperparameters (width multiplier and
resolution multiplier) that allow model developers to trade off latency or accuracy for
speed and low size depending on their requirements.
Architecture:
MobileNets are built on depth wise separable convolution layers. Each depth wise
separable convolution layer consists of a depth wise convolution and a point wise
convolution. Counting depth wise and point wise convolutions as separate layers, a
MobileNet has 28 layers.A standard MobileNet has 4.2 million parameters which can
be further reduced by tuning the width multiplier hyperparameter appropriately.
The size of the input image is 224 × 224 × 3.
A single standard convolution unit (denoted by Conv in the table above) looks like
this:

Fig 6.7: MobileNet architecture

Dept. of CSE, S V College of Engineering 24


DRIVER DROWSINESS DETECTION SYSTEM

CHAPTER 7
MODULE IMPLEMENTATION
Modules
1. Creating a Dataset
2. Training
3. Testing
Module Description
 Create Dataset:
The dataset for the eye images is collected from the kaggle website (kaggle.com).
The size of overall dataset is 263 MB. From which we have are splitting the data into
(Training images, Testing images), where the Training images dataset size is 250MB
and Testing images size is 13MB.
 Training:
We are using the pre-processed training dataset to train our model using CNN with
Mobile Net algorithm.
CNN algorithm consists of 4 layers: Input layer, Convolution Layer, pooling layer,
Flatten layer and dense layer.
In input layer we consider images as input.
In Convolution layer, we convert image into matric format. Here matrix size is 1024
X 1024 (rows X columns).
In the pooling layer the numerical values will be stored. To change the numerical data
to binary data, we use machine learning algorithm named Softmax (supervised
learning algorithm). In Softmax layer we will convert the numerical data to binary.
In flatten layer and dense the classes of total dataset (2 types) is stored which will be
in the binary data format.
We use fit generator method for saving the data in the form of .h5. Here model is a
format for storing the binary data.
Deep learning algorithms are well suited for large data sets and also training deep
learning networks needs large computation power. With GPUs / TPUs easily available
on pay per use basis or for free (like Google collab), it is possible today to train a large
neural network on cloud-like say Resnet 152 (152 layers) on ImageNet database which
has around 14 million images. But is a multi-core GPU-enabled machine just enough
to train huge models. Technically yes, but it might take weeks to train the model. So

Dept. of CSE, S V College of Engineering 25


DRIVER DROWSINESS DETECTION SYSTEM

how do we reduce the training time? Any scalability issue can be solved using 2
approaches — scale-up or scale-out. We all know if we choose to scale up the capacity
maxes out at some point, so the better alternative is scale-out. But, how do you do
distributed training, if I have a model training using Jupiter notebook where do I start,
can I perform distributed training for any deep learning model? This blog aims to
answer these questions with a practical approach.
 Testing:
By using the OpenCV technique we use the video based data through webcam. Here
we will detect the faces of the individuals, it will check whether the eyes of the
individuals are opened or closed. If eyes of the individuals are closed then alert will
be given by playing a siren. You cannot trust a model you’ve developed simply
because it fits the training data well. The reason for this is simple: You forced the
model to fit the training data!
The solution is model validation. Validation uses your model to predict the output in
situations outside your training data, and calculates the same statistical measures of fit
on those results. This means you need to divide your data set into two different data
files. The first is a training data set, which you use to generate your model, while the
second is a validation data set, which you use to check your model’s accuracy against
data you didn’t use to train the model.

Dept. of CSE, S V College of Engineering 26


DRIVER DROWSINESS DETECTION SYSTEM

CHAPTER 8
PROCESS OF EXECUTION

Step-1: Upload (Live)


Upload a video as a live feed using a webcam (or any camera attached in a farm).

Step-2: View
Video can be viewed live in a dialog box.

Step-3: Preprocessing:
Data Preprocessing is a technique that is used to convert the raw data into a
clean data set. Cleaning the data refers to removing the null values, filling the null
values with meaningful value, removing duplicate values, removing outliers,
removing unwanted attributes. If dataset contains any categorical records means
convert those categorical variables to numerical values.
In this case, we are taking a live video feed in the form of images and resizing them
to a standard size.

Step-4: Identifying Features:


We use MobileNet SSD pretrained model which identifies features in any image using
a Convolution Neural Network (CNN) model.

Step-5: The Model:


• SSD (Single Shot Detector) is a popular algorithm in object detection.
• It’s generally faster than RCNN.
• SSD has two components: a backbone model and SSD head. Backbone model
usually is a pre-trained image classification network as a feature extractor.
• Here, we will use MobileNet SSD model to detect the objects.
• Here, VGG Net is used as a backbone model to extract the features from the
images.
• Convolution layers (CNN) are then used for object detection in the images using
the feature map generated by VGG net layer.
• The model is able to detect multiple objects in any given image.
• For the purpose of classification, the model uses softmax in the last layer.

Dept. of CSE, S V College of Engineering 27


DRIVER DROWSINESS DETECTION SYSTEM

• Softmax takes in a vector of numbers and converts them to probabilities which


are then used for image generating results.
• Softmax converts logits into probabilities by taking the exponents from every
output and then normalize each of these numbers by the sum of such exponents, such
that the entire output vector adds up to one.

Step-6: Prediction:
A live video feed is taken in frame by frame as individual images. These images the
then fed into the model after preprocessing to detect animals (if any exists).

Step-7: User Interface:


A dialog box opens up while taking in the live video feed. The frames or images from
the video are used to detect objects. The objects are then bounded in a bounding box
along with a label, animal count and the probability of success in also displayed in
there.

Dept. of CSE, S V College of Engineering 28


DRIVER DROWSINESS DETECTION SYSTEM

CHAPTER 9
SOURCE CODE
data_preparation.py:
import os
import shutil
import glob
from tqdm import tqdm

Raw_DIR = r'C:\Users\ymts0258\Desktop\mrlEyes_2018_01'
for dirpath, dirname, filenames in os.walk(Raw_DIR):
for i in tqdm([f for f in filenames if f.endswith('.png')]):
if i.split('_')[4] == '0':
shutil.copy(src=dirpath + '/' + i, dst='dataset/train/Close Eye')
elif i.split('_')[4] == '1':
shutil.copy(src=dirpath + '/' + i, dst='dataset/train/Open Eye')

model_training.py
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Dense,GlobalAveragePooling2D
from tensorflow.keras.applications import MobileNet
from tensorflow.keras.applications.mobilenet import preprocess_input

base_model=MobileNet(weights='imagenet',include_top=False) #imports the


mobilenet model and discards the last 1000 neuron layer.

x=base_model.output
x=GlobalAveragePooling2D()(x)
x=Dense(1024,activation='relu')(x) #we add dense layers so that the model can learn
more complex functions and classify for better results.
x=Dense(1024,activation='relu')(x) #dense layer 2
x=Dense(512,activation='relu')(x) #dense layer 3
Dept. of CSE, S V College of Engineering 29
DRIVER DROWSINESS DETECTION SYSTEM

preds=Dense(2,activation='softmax')(x)
model=Model(inputs=base_model.input,outputs=preds)

for i,layer in enumerate(model.layers):


print(i,layer.name)

for layer in model.layers:


layer.trainable=False
# or if we want to set the first 20 layers of the network to be non-trainable
for layer in model.layers[:20]:
layer.trainable=False
for layer in model.layers[20:]:
layer.trainable=True

train_datagen=ImageDataGenerator(preprocessing_function=preprocess_input)
#included in our dependencies

train_generator=train_datagen.flow_from_directory('dataset/train',
target_size=(224,224),
color_mode='rgb',
batch_size=32,
class_mode='categorical',
shuffle=True)

test_set = train_datagen.flow_from_directory('dataset/test',
target_size=(224,224),
batch_size=32,
class_mode='categorical')

Dept. of CSE, S V College of Engineering 30


DRIVER DROWSINESS DETECTION SYSTEM

model.compile(optimizer='Adam',loss='categorical_crossentropy',metrics=['accuracy
'])
step_size_train=train_generator.n//train_generator.batch_size
history=model.fit_generator(generator=train_generator,
steps_per_epoch=200,
epochs=10)

model.save("models/Model.h5")
from matplotlib import pyplot as plt

plt.style.use("ggplot")
plt.figure()
plt.plot(history.history['accuracy'],'r',label='Testing accuracy',color='green')
# plt.plot(history.history['val_accuracy'],label='validation accuracy')
plt.xlabel('# Epochs')
plt.ylabel('Accuracy')
plt.legend()
plt.savefig("models/model.png")
plt.show()
acc=history.history['accuracy'][-1]
print(acc)

testing_data.py
import cv2
import tensorflow as tf
from tensorflow.keras.models import load_model
import numpy as np
from pygame import mixer

face_cascade = cv2.CascadeClassifier(cv2.data.haarcascades +
'haarcascade_frontalface_default.xml')

Dept. of CSE, S V College of Engineering 31


DRIVER DROWSINESS DETECTION SYSTEM

eye_cascade = cv2.CascadeClassifier(cv2.data.haarcascades +
'haarcascade_eye.xml')
model = load_model('models/Model.h5')
mixer.init()
sound = mixer.Sound('Alarm/alarm1.wav')
cap = cv2.VideoCapture(0)
Score = 0
while True:
ret, frame = cap.read()
height, width = frame.shape[0:2]
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
faces = face_cascade.detectMultiScale(gray, scaleFactor=1.2, minNeighbors=3)
eyes = eye_cascade.detectMultiScale(gray, scaleFactor=1.1, minNeighbors=1)

cv2.rectangle(frame, (0, height - 50), (200, height), (0, 0, 0),


thickness=cv2.FILLED)

for (x, y, w, h) in faces:


cv2.rectangle(frame, pt1=(x, y), pt2=(x + w, y + h), color=(255, 0, 0),
thickness=3)

for (ex, ey, ew, eh) in eyes:


# cv2.rectangle(frame,pt1=(ex,ey),pt2=(ex+ew,ey+eh), color= (255,0,0),
thickness=3 )

# preprocessing steps
eye = frame[ey:ey + eh, ex:ex + ew]
eye = cv2.resize(eye, (224, 224))
eye = eye / 255
eye = eye.reshape(224, 224, 3)
eye = np.expand_dims(eye, axis=0)
# preprocessing is done now model prediction

Dept. of CSE, S V College of Engineering 32


DRIVER DROWSINESS DETECTION SYSTEM

prediction = model.predict(eye)

print(prediction)
classes=['Eyes Closed','Eyes Opended']
result=classes[np.argmax(prediction)]
print(np.argmax(prediction))
print(result)
# if eyes are closed
if result == 'Eyes Closed':
cv2.putText(frame, 'closed', (10, height - 20),
fontFace=cv2.FONT_HERSHEY_COMPLEX_SMALL, fontScale=1,
color=(255, 255, 255),
thickness=1, lineType=cv2.LINE_AA)
cv2.putText(frame, 'Score' + str(Score), (100, height - 20),
fontFace=cv2.FONT_HERSHEY_COMPLEX_SMALL,
fontScale=1, color=(255, 255, 255),
thickness=1, lineType=cv2.LINE_AA)
Score = Score + 1
if (Score > 15):
try:
sound.play()
except:
pass

# if eyes are open


elif prediction[0][1] > 0.90:
cv2.putText(frame, 'open', (10, height - 20),
fontFace=cv2.FONT_HERSHEY_COMPLEX_SMALL, fontScale=1,
color=(255, 255, 255),
thickness=1, lineType=cv2.LINE_AA)
cv2.putText(frame, 'Score' + str(Score), (100, height - 20),
fontFace=cv2.FONT_HERSHEY_COMPLEX_SMALL,

Dept. of CSE, S V College of Engineering 33


DRIVER DROWSINESS DETECTION SYSTEM

fontScale=1, color=(255, 255, 255),


thickness=1, lineType=cv2.LINE_AA)
Score = 0
cv2.imshow('DDTS', frame)
if cv2.waitKey(33) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()

Dept. of CSE, S V College of Engineering 34


DRIVER DROWSINESS DETECTION SYSTEM

CHAPTER 10
SYSTEM TESTING
The purpose of testing is to discover errors. Testing is the process of trying to discover
every conceivable fault or weakness in a work product. It provides a way to check the
functionality of components, sub-assemblies, assemblies and/or a finished product It
is the process of exercising software with the intent of ensuring that the Software
system meets its requirements and user expectations and does not fail in an
unacceptable manner. There are various types of tests. Each test type addresses a
specific testing requirement.

10.1 TYPES OF TESTS

10.1.1 Unit testing

Unit testing involves the design of test cases that validate that the internal program
logic is functioning properly, and that program inputs produce valid outputs. All
decision branches and internal code flow should be validated. It is the testing of
individual software units of the application .it is done after the completion of an
individual unit before integration. This is a structural testing, that relies on knowledge
of its construction and is invasive. Unit tests perform basic tests at component level
and test a specific business process, application, and/or system configuration. Unit
tests ensure that each unique path of a business process performs accurately to the
documented specifications and contains clearly defined inputs and expected results.

10.1.2 Integration testing

Integration tests are designed to test integrated software components to determine if


they actually run as one program. Testing is event driven and is more concerned with
the basic outcome of screens or fields. Integration tests demonstrate that although the
components were individually satisfaction, as shown by successfully unit testing, the
combination of components is correct and consistent. Integration testing is specifically
aimed at exposing the problems that arise from the combination of components.

Dept. of CSE, S V College of Engineering 35


DRIVER DROWSINESS DETECTION SYSTEM

10.1.3 Functional test

Functional tests provide systematic demonstrations that functions tested are available
as specified by the business and technical requirements, system documentation, and
user manuals.

Functional testing is centered on the following items:

Valid Input : identified classes of valid input must be accepted.

Invalid Input : identified classes of invalid input must be rejected

Functions : identified functions must be exercised.

Output : identified classes of application outputs must be exercised

Systems/Procedures : interfacing systems or procedures must be invoked.

Organization and preparation of functional tests is focused on requirements, key


functions, or special test cases. In addition, systematic coverage pertaining to identify
Business process flows; data fields, predefined processes, and successive processes
must be considered for testing. Before functional testing is complete, additional tests
are identified and the effective value of current tests is determined.

10.1.4 System Test

System testing ensures that the entire integrated software system meets requirements.
It tests a configuration to ensure known and predictable results. An example of system
testing is the configuration-oriented system integration test. System testing is based
on process descriptions and flows, emphasizing pre-driven process links and
integration points.

10.1.4.1 White Box Testing

White Box Testing is a testing in which in which the software tester has knowledge
of the inner workings, structure and language of the software, or at least its purpose.
It is purpose. It is used to test areas that cannot be reached from a black box level.

10.1.4.2 Black Box Testing

Black Box Testing is testing the software without any knowledge of the inner
workings, structure or language of the module being tested. Black box tests, as most
other kinds of tests, must be written from a definitive source document, such as

Dept. of CSE, S V College of Engineering 36


DRIVER DROWSINESS DETECTION SYSTEM

specification or requirements document, such as specification or requirements


document. It is a testing in which the software under test is treated, as a black box.
you cannot “see” into it. The test provides inputs and responds to outputs without
considering how the software works.

10.2 Unit Testing

Unit testing is usually conducted as part of a combined code and unit test phase of
the software lifecycle, although it is not uncommon for coding and unit testing to be
conducted as two distinct phases.

Test strategy and approach

Field testing will be performed manually and functional tests will be written in detail.

10.2.1 Test objectives

• All field entries must work properly.

• Pages must be activated from the identified link.

• The entry screen, messages and responses must not be delayed.

10.2.2 Features to be tested

• Verify that the entries are of the correct format

• No duplicate entries should be allowed

• All links should take the user to the correct page.

10.3 Integration Testing

Software integration testing is the incremental integration testing of two or more


integrated software components on a single platform to produce failures caused by
interface defects. The task of the integration test is to check that components or
software applications, e.g., components in a software system or – one step up –
software applications at the company level – interact without error.

10.4 Acceptance Testing

User Acceptance Testing is a critical phase of any project and requires significant
participation by the end user. It also ensures that the system meets the functional
requirements.

Dept. of CSE, S V College of Engineering 37


DRIVER DROWSINESS DETECTION SYSTEM

10.5 TEST CASES:

Input Output Result


Input text Video streaming Drowsiness
detection

10.5.1 Test cases Model building:

Dept. of CSE, S V College of Engineering 38


DRIVER DROWSINESS DETECTION SYSTEM

CHAPTER 12

CONCLUSION

In this we have implemented a drowsiness detection application which is used to save


the road accidents caused by drowsiness of drivers by detecting the state of a driver
with our proposed method. The method we are used here CNN based transfer learning
algorithm of deep learning this algorithms is mainly used to train the consider dataset
once after training opencv is used for the testing purpose. Where our proposed method
shows accurate prediction of drowsiness or normal state of a person.

Dept. of CSE, S V College of Engineering 39


DRIVER DROWSINESS DETECTION SYSTEM

CHAPTER 13

REFERENCES

1. Gwak, J., Hirao, A., Shino, M: An investigation of early detection of driver


drowsiness using ensemble machine learning based on hybrid sensing. Appl. Sci.
10(8), 2890 (2020). https://doi.org/10.3390/app10082890

2. Kepesiova, Z., Ciganek, J., Kozak, S.: Driver drowsiness detection using
convolutional neural networks. In: 2020 Cybernetics & Informatics (K&I) (2020).
https://doi.org/10.1109/ki48306.2020.9039851

3. You, F., Li, X., Gong, Y., Wang, H., Li, H.: A real-time driving drowsiness
detection algorithm with individual differences consideration. IEEE Access 7,
179396–179408 (2019). https://doi.org/10.1109/access.2019.2958667

4. Mehta, S., Dadhich, S., Gumber, S., Bhatt, A.J.: Real-time driver drowsiness
detection system using eye aspect ratio and eye closure ratio. SSRN Electron. J.
(2019). https://doi.org/10.2139/ssrn.3356401

5. Sathasivam, S., Mahamad, A.K., Saon, S., Sidek, A., Som, M.M., Ameen, H.A.:
Drowsiness detection system using eye aspect ratio technique. In 2020 IEEE Student
Conference on Research and Development (SCOReD) (2020).
https://doi.org/10.1109/scored50371.2020.9251035

6. Abtahi, S., Omidyeganeh, M., Shirmohammadi, S., Hariri, B.: YawDD: yawning
detection dataset. IEEE Dataport (2020). https://doi.org/10.21227/e1qm-hb90.

7. Song, F., Tan, X., Liu, X., Chen, S.: Eyes closeness detection from still images with
multi-scale histograms of principal oriented gradients. Pattern Recogn. (2014).

8. Savas, B.K., Becerikli, Y.: Real time driver fatigue detection system based on multi-
task ConNN. IEEE Access 8, 12491–12498 (2020).
https://doi.org/10.1109/access.2020.2963960

Dept. of CSE, S V College of Engineering 40


DRIVER DROWSINESS DETECTION SYSTEM

9. Bavkar, S., Iyer, B., Deosarkar, S.: Rapid screening of alcoholism: an EEG based
optimal channel selection approach. IEEE Access 7, 99670–99682 (2019).
https://doi.org/10.1109/ACCESS.2019.2927267

10. Bavkar, S., Iyer, B., Deosarkar, S.: BPSO based method for screening of
alcoholism. In: Kumar, A., Mozar, S. (eds.) ICCCE 2019. Lecture Notes in Electrical
Engineering, vol. 570, pp. 47–53. Springer, Singapore (2020).
https://doi.org/10.1007/978-981-13-8715-9_6

11. Bavkar, S., Iyer, B., Deosarkar, S.: Optimal EEG channels selection for alcoholism
screening using EMD domain statistical features and harmony search algorithm.
Biocybern. Biomed. Eng. 41(1), 83–96 (2021)

12. Deshpande, P., Iyer, B.: Research directions in the internet of every things (IoET).
In: 2017 International Conference on Computing, Communication and Automation
(ICCCA), Greater Noida, pp. 1353–1357 (2017).
https://doi.org/10.1109/CCAA.2017.8230008

13. Deshmukh, D., Iyer, B.: Design of IPSec virtual private network for remote access.
In: 2017 International Conference on Computing, Communication and Automation
(ICCCA), Greater Noida, pp. 716–719 (2017).
https://doi.org/10.1109/CCAA.2017.8229894

14. Iyer, B., Patil, N.: IoT enabled tracking and monitoring sensor for military
applications. Int. J. Syst. Assur. Eng. Manag. 9, 1294–1301 (2018).
https://doi.org/10.1007/s13198-018-0727-8

Dept. of CSE, S V College of Engineering 41


DRIVER DROWSINESS DETECTION SYSTEM

CHAPTER 14

BIBILOGRAPHY

Software Installation For Machine Learning Projects:


Installing Python:

1. To download and install Python visit the official website of


Python https://www.python.org/downloads/ and choose your version.

2. Once the download is complete, run the exe for install Python. Now click on
Install Now.

3. You can see Python installing at this point.


4. When it finishes, you can see a screen that says the Setup was successful. Now
click on "Close".

Installing PyCharm:

1. To download PyCharm visit the


website https://www.jetbrains.com/pycharm/download/ and click the
"DOWNLOAD" link under the Community Section.

Dept. of CSE, S V College of Engineering 42


DRIVER DROWSINESS DETECTION SYSTEM

2. Once the download is complete, run the exe for install PyCharm. The setup
wizard should have started. Click “Next”.

3. On the next screen, Change the installation path if required. Click “Next”.

4. On the next screen, you can create a desktop shortcut if you want and click on
“Next”.

5. Choose the start menu folder. Keep selected Jet Brains and click on “Install”.

6. Wait for the installation to finish.


7. Once installation finished, you should receive a message screen that PyCharm
is installed. If you want to go ahead and run it, click the “Run PyCharm Community
Edition” box first and click “Finish”.

8. After you click on "Finish," the Following screen will appear.

Dept. of CSE, S V College of Engineering 43


DRIVER DROWSINESS DETECTION SYSTEM

9. You need to install some packages to execute your project in a proper way.

10. Open the command prompt/ anaconda prompt or terminal as administrator.

11. The prompt will get open, with specified path, type “pip install package name”
which you want to install (like NumPy, pandas, sea born, scikit-learn, Matplotlib,
Pyplot)

Ex: Pip install NumPy

INTRODUCTION TO PYTHON

✓ Python
What Is a Script?
Up to this point, I have concentrated on the interactive programming capability of
Python. This is a very useful capability that allows you to type in a program and to
have it executed immediately in an interactive mode
Scripts are reusable:

Dept. of CSE, S V College of Engineering 44


DRIVER DROWSINESS DETECTION SYSTEM

Basically, a script is a text file containing the statements that comprise a Python
program. Once you have created the script, you can execute it over and over without
having to retype it each time.
Scripts are editable:
Perhaps, more importantly, you can make different versions of the script by modifying
the statements from one file to the next using a text editor. Then you can execute each
of the individual versions. In this way, it is easy to create different programs with a
minimum amount of typing.
You will need a text editor Just about any text editor will suffice for creating Python
script files. You can use Microsoft Notepad, Microsoft WordPad, Microsoft Word, or
just about any word processor if you want to.

Difference between a script and a program:


Script:
Scripts are distinct from the core code of the application, which is usually written in a
different language, and are often created or at least modified by the end-user. Scripts
are often interpreted from source code or byte code, whereas the applications they
control are traditionally compiled to native machine code.
Program:
The program has an executable form that the computer can use directly to execute the
instructions.
The same program in its human-readable source code form, from which executable
programs are derived (e.g., compiled)
Python:
What is Python? Chances you are asking yourself this. You may have found this book
because you want to learn to program but don’t know anything about programming
languages. Or you may have heard of programming languages like C, C++, C#, or
Java and want to know what Python is and how it compares to “big name” languages.
Hopefully I can explain it for you.
Python concepts:
If you’re not interested in the how’s and whys of Python, feel free to skip to the next
chapter. In this chapter I will try to explain to the reader why I think Python is one of
the best languages available and why it’s a great one to start programming with.
• Open-source general-purpose language.

Dept. of CSE, S V College of Engineering 45


DRIVER DROWSINESS DETECTION SYSTEM

• Object Oriented, Procedural, Functional


• Easy to interface with C/ObjC/Java/Fortran
• Easy-is to interface with C++ (via SWIG)
• Great interactive environment
• Great interactive environment
Python is a high-level, interpreted, interactive and object-oriented scripting language.
Python is designed to be highly readable. It uses English keywords frequently where
as other languages use punctuation, and it has fewer syntactical constructions than
other languages.
• Python is Interpreted − Python is processed at runtime by the interpreter. You
do not need to compile your program before executing it. This is similar to PERL and
PHP.
• Python is Interactive − you can actually sit at a Python prompt and interact with
the interpreter directly to write your programs.
• Python is Object-Oriented − Python supports Object-Oriented style or
technique of programming that encapsulates code within objects.
• Python is a Beginner's Language − Python is a great language for the beginner-
level programmers and supports the development of a wide range of applications from
simple text processing to WWW browsers to games.

History of Python
Python was developed by Guido van Possum in the late eighties and early nineties at
the National Research Institute for Mathematics and Computer Science in the
Netherlands.
Python is derived from many other languages, including ABC, Modula-3, C, C++,
Algol-68, Smalltalk, and UNIX shell and other scripting languages.
Python is copyrighted. Like Perl, Python source code is now available under the GNU
General Public License (GPL).
Python is now maintained by a core development team at the institute, although Guido
van Possum still holds a vital role in directing its progress.

Python Features
Python's features include −
• Easy-to-learn − Python has few keywords, simple structure, and a clearly

Dept. of CSE, S V College of Engineering 46


DRIVER DROWSINESS DETECTION SYSTEM

defined syntax. This allows the student to pick up the language quickly.
• Easy-to-read − Python code is more clearly defined and visible to the eyes.
• Easy-to-maintain − Python's source code is fairly easy-to-maintained.
• A broad standard library − Python's bulk of the library is very portable and
cross-platform compatible on UNIX, Windows, and Macintosh.
• Interactive Mode − Python has support for an interactive mode which allows
interactive testing and debugging of snippets of code.
• Portable − Python can run on a wide variety of hardware platforms and has the
same interface on all platforms.
• Extendable − you can add low-level modules to the Python interpreter. These
modules enable programmers to add to or customize their tools to be more efficient.
• Databases − Python provides interfaces to all major commercial databases.
• GUI Programming − Python supports GUI applications that can be created and
ported to many system calls, libraries and windows systems, such as Windows MFC,
Macintosh, and the X Window system of Unix.
• Scalable − Python provides a better structure and support for large programs
than shell scripting.
Apart from the above-mentioned features, Python has a big list of good features, few
are listed below −
• It supports functional and structured programming methods as well as OOP.
• It can be used as a scripting language or can be compiled to byte-code for
building large applications.
• It provides very high-level dynamic data types and supports dynamic type
checking.
• IT supports automatic garbage collection.
• It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.

Dynamic vs. Static


Types Python is a dynamic-typed language. Many other languages are static typed,
such as C/C++ and Java. A static typed language requires the programmer to explicitly
tell the computer what type of “thing” each data value is.
For example, in C if you had a variable that was to contain the price of something,
you would have to declare the variable as a “float” type.

Dept. of CSE, S V College of Engineering 47


DRIVER DROWSINESS DETECTION SYSTEM

This tells the compiler that the only data that can be used for that variable must be a
floating point number, i.e. a number with a decimal point.
If any other data value was assigned to that variable, the compiler would give an error
when trying to compile the program.
Python, however, doesn’t require this. You simply give your variables names and
assign values to them. The interpreter takes care of keeping track of what kinds of
objects your program is using. This also means that you can change the size of the
values as you develop the program. Say you have another decimal number (a.k.a. a
floating point number) you need in your program. With a static typed language, you
have to decide the memory size the variable can take when you first initialize that
variable. A double is a floating point value that can handle a much larger number than
a normal float (the actual memory sizes depend on the operating environment).
If you declare a variable to be a float but later on assign a value that is too big to it,
your program will fail; you will have to go back and change that variable to be a
double.
With Python, it doesn’t matter. You simply give it whatever number you want and
Python will take care of manipulating it as needed. It even works for derived values.
For example, say you are dividing two numbers. One is a floating point number and
one is an integer. Python realizes that it’s more accurate to keep track of decimals so
it automatically calculates the result as a floating point number
Variables:
Variables are nothing but reserved memory locations to store values. This means that
when you create a variable you reserve some space in memory.
Based on the data type of a variable, the interpreter allocates memory and decides
what can be stored in the reserved memory. Therefore, by assigning different data
types to variables, you can store integers, decimals or characters in these variables.

Standard Data Types:


The data stored in memory can be of many types. For example, a person's age is stored
as a numeric value and his or her address is stored as alphanumeric characters. Python
has various standard data types that are used to define the operations possible on them
and the storage method for each of them.
Python has five standard data types −
• Numbers

Dept. of CSE, S V College of Engineering 48


DRIVER DROWSINESS DETECTION SYSTEM

• String
• List
• Tuple
• Dictionary
Python Numbers:
Number data types store numeric values. Number objects are created when you assign
a value to them
Python Strings:
Strings in Python are identified as a contiguous set of characters represented in the
quotation marks. Python allows for either pairs of single or double quotes. Subsets of
strings can be taken using the slice operator ([ ] and [:]) with indexes starting at 0 in
the beginning of the string and working their way from -1 at the end.
Python Lists:
Lists are the most versatile of Python’s compound data types. A list contains items
separated by commas and enclosed within square brackets ([]). To some extent, lists
are similar to arrays in C. One difference between them is that all the items belonging
to a list can be of different data type.
The values stored in a list can be accessed using the slice operator ([ ] and [:]) with
indexes starting at 0 in the beginning of the list and working their way to end -1. The
plus (+) sign is the list concatenation operator, and the asterisk (*) is the repetition
operator.
Python Tuples:
A tuple is another sequence data type that is similar to the list. A tuple consists of a
number of values separated by commas. Unlike lists, however, tuples are enclosed
within parentheses.
The main differences between lists and tuples are: Lists are enclosed in brackets ([ ])
and their elements and size can be changed, while tuples are enclosed in parentheses
(( )) and cannot be updated. Tuples can be thought of as read-only lists.
Python Dictionary:
Python's dictionaries are kind of hash table type. They work like associative arrays or
hashes found in Perl and consist of key-value pairs. A dictionary key can be almost
any Python type, but are usually numbers or strings. Values, on the other hand, can be
any arbitrary Python object.

Dept. of CSE, S V College of Engineering 49


DRIVER DROWSINESS DETECTION SYSTEM

Dictionaries are enclosed by curly braces ({ }) and values can be assigned and
accessed using square braces ([]).
Different modes in python:
Python has two basic modes: normal and interactive.
The normal mode is the mode where the scripted and finished .pie files are run in the
Python interpreter.
Interactive mode is a command line shell which gives immediate feedback for each
statement, while running previously fed statements in active memory. As new lines
are fed into the interpreter, the fed program is evaluated both in part and in whole

20 Python libraries:
1. Requests. The most famous http library written by Kenneth remits. It’s a must
have for every python developer.
2. Scrappy. If you are involved in web scraping then this is a must have library
for you. After using this library you won’t use any other.
3. Python. A guy toolkit for python. I have primarily used it in place of tinder.
You will really love it.
4. Pillow. A friendly fork of PIL (Python Imaging Library). It is more user
friendly than PIL and is a must have for anyone who works with images.
5. SQL Alchemy. A database library. Many love it and many hate it. The choice
is yours.
6. Beautiful Soup. I know it’s slow but this xml and html parsing library is very
useful for beginners.
7. Twisted. The most important tool for any network application developer. It
has a very beautiful ape and is used by a lot of famous python developers.
8. Numbly. How can we leave this very important library? It provides some
advance math functionalities to python.
9. Skippy. When we talk about numbly then we have to talk about spicy. It is a
library of algorithms and mathematical tools for python and has caused many
scientists to switch from ruby to python.
10. Matplotlib. A numerical plotting library. It is very useful for any data scientist
or any data analyzer.
11. Pygame. Which developer does not like to play games and develop them? This
library will help you achieve your goal of 2d game development.

Dept. of CSE, S V College of Engineering 50


DRIVER DROWSINESS DETECTION SYSTEM

12. Piglet. A 3d animation and game creation engine. This is the engine in which
the famous python port of mine craft was made
13. Pit. A GUI toolkit for python. It is my second choice after python for
developing GUI’s for my python scripts.
14. Pit. Another python GUI library. It is the same library in which the famous Bit
torrent client is created.
15. Scaly. A packet sniffer and analyzer for python made in python.
16. Pywin32. A python library which provides some useful methods and classes
for interacting with windows.
17. Notch. Natural Language Toolkit – I realize most people won’t be using this
one, but it’s generic enough. It is a very useful library if you want to manipulate
strings. But its capacity is beyond that. Do check it out.
18. Nose. A testing framework for python. It is used by millions of python
developers. It is a must have if you do test driven development.
19. Simply. Simply can do algebraic evaluation, differentiation, expansion,
complex numbers, etc. It is contained in a pure Python distribution.
20. IPython. I just can’t stress enough how useful this tool is. It is a python prompt
on steroids. It has completion, history, shell capabilities, and a lot more. Make sure
that you take a look at it.
Numpy:
Humpy’s main object is the homogeneous multidimensional array. It is a table of
elements (usually numbers), all of the same type, indexed by a tuple of positive
integers. In numbly dimensions are called axes. The number of axes is rank.
 Offers Matlab-ish capabilities within Python
 Fast array operations
 2D arrays, multi-D arrays, linear algebra etc.
Matplotlib
 High quality plotting library.
Python class and objects
These are the building blocks of OOP. Class creates a new object. This object can be
anything, whether an abstract data concept or a model of a physical object, e.g. a chair.
Each class has individual characteristics unique to that class, including variables and
methods. Classes are very powerful and currently “the big thing” in most

Dept. of CSE, S V College of Engineering 51


DRIVER DROWSINESS DETECTION SYSTEM

programming languages. Hence, there are several chapters dedicated to OOP later in
the book.
The class is the most basic component of object-oriented programming. Previously,
you learned how to use functions to make your program do something.
Now will move into the big, scary world of Object-Oriented Programming (OOP). To
be honest, it took me several months to get a handle on objects.
When I first learned C and C++, I did great; functions just made sense for me.
Having messed around with BASIC in the early ’90s, I realized functions were just
like subroutines so there wasn’t much new to learn.
However, when my C++ course started talking about objects, classes, and all the new
features of OOP, my grades definitely suffered.
Once you learn OOP, you’ll realize that it’s actually a pretty powerful tool. Plus many
Python libraries and APIs use classes, so you should at least be able to understand
what the code is doing.
One thing to note about Python and OOP: it’s not mandatory to use objects in your
code in a way that works best; maybe you don’t need to have a full-blown class with
initialization code and methods to just return a calculation. With Python, you can get
as technical as you want.
As you’ve already seen, Python can do just fine with functions. Unlike languages such
as Java, you aren’t tied down to a single way of doing things; you can mix functions
and classes as necessary in the same program. This lets you build the code
Objects are an encapsulation of variables and functions into a single entity. Objects
get their variables and functions from classes. Classes are essentially a template to
create your objects.
Here’s a brief list of Python OOP ideas:
 The class statement creates a class object and gives it a name. This creates a
new namespace.
 Assignments within the class create class attributes. These attributes are
accessed by qualifying the name using dot syntax: ClassName.Attribute.
 Class attributes export the state of an object and its associated behavior. These
attributes are shared by all instances of a class.
 Calling a class (just like a function) creates a new instance of the class.
 This is where the multiple copies part comes in.

Dept. of CSE, S V College of Engineering 52


DRIVER DROWSINESS DETECTION SYSTEM

 Each instance gets ("inherits") the default class attributes and gets its own
namespace. This prevents instance objects from overlapping and confusing the
program.
 Using the term self identifies a particular instance, allowing for per-instance
attributes. This allows items such as variables to be associated with a particular
instance.
Inheritance:
First off, classes allow you to modify a program without really making changes to it.
To elaborate, by sub classing a class, you can change the behaviour of the program by
simply adding new components to it rather than rewriting the existing components.
As we’ve seen, an instance of a class inherits the attributes of that class.
However, classes can also inherit attributes from other classes. Hence, a subclass
inherits from a superclass allowing you to make a generic superclass that is specialized
via subclasses.
The subclasses can override the logic in a superclass, allowing you to change the
behavior of your classes without changing the superclass at all.
Operator Overloading:
Operator overloading simply means that objects that you create from classes can
respond to actions (operations) that are already defined within Python, such as
addition, slicing, printing, etc.
Even though these actions can be implemented via class methods, using overloading
ties the behavior closer to Python’s object model and the object interfaces are more
consistent to Python’s built-in objects, hence overloading is easier to learn and use.
User-made classes can override nearly all of Python’s built-in operation methods
Exceptions:
I’ve talked about exceptions before but now I will talk about them in depth.
Essentially, exceptions are events that modify program’s flow, either intentionally or
due to errors.
They are special events that can occur due to an error, e.g. trying to open a file that
doesn’t exist, or when the program reaches a marker, such as the completion of a loop.
Exceptions, by definition, don’t occur very often; hence, they are the "exception to the
rule" and a special class has been created for them. Exceptions are everywhere in
Python.

Dept. of CSE, S V College of Engineering 53


DRIVER DROWSINESS DETECTION SYSTEM

Virtually every module in the standard Python library uses them, and Python itself
will raise them in a lot of different circumstances.
Here are just a few examples:
Accessing a non−existent dictionary key will raise a Key Error exception.
Searching a list for a non−existent value will raise a Value Error exception
Calling a non−existent method will raise an Attribute Error exception.
Referencing a non−existent variable will raise a Name Error exception.
Mixing data types without coercion will raise a Type Error exception.
One use of exceptions is to catch a fault and allow the program to continue working;
we have seen this before when we talked about files.
This is the most common way to use exceptions. When programming with the Python
command line interpreter, you don’t need to worry about catching exceptions.
Your program is usually short enough to not be hurt too much if an exception occurs.
Plus, having the exception occur at the command line is a quick and easy way to tell
if your code logic has a problem.
However, if the same error occurred in your real program, it will fail and stop working.
Exceptions can be created manually in the code by raising an exception.
It operates exactly as a system-caused exceptions, except that the programmer is doing
it on purpose. This can be for a number of reasons. One of the benefits of using
exceptions is that, by their nature, they don’t put any overhead on the code processing.
Because exceptions aren’t supposed to happen very often, they aren’t processed until
they occur.
Exceptions can be thought of as a special form of the if/elf statements. You can
realistically do the same thing with if blocks as you can with exceptions.
However, as already mentioned, exceptions aren’t processed until they occur; if blocks
are processed all the time.
Proper use of exceptions can help the performance of your program.
The more infrequent the error might occur, the better off you are to use exceptions;
using if blocks requires Python to always test extra conditions before continuing.
Exceptions also make code management easier: if your programming logic is mixed
in with error-handling if statements, it can be difficult to read, modify, and debug your
program.

Dept. of CSE, S V College of Engineering 54


DRIVER DROWSINESS DETECTION SYSTEM

User-Defined Exceptions:
I won’t spend too much time talking about this, but Python does allow for a
programmer to create his own exceptions.
You probably won’t have to do this very often but it’s nice to have the option when
necessary.
However, before making your own exceptions, make sure there isn’t one of the built-
in exceptions that will work for you.
They have been "tested by fire" over the years and not only work effectively, they
have been optimized for performance and are bug-free.
Making your own exceptions involves object-oriented programming, which will be
covered in the next chapter
To make a custom exception, the programmer determines which base exception to use
as the class to inherit from, e.g. making an exception for negative numbers or one for
imaginary numbers would probably fall under the Arithmetic Error exception class.
To make a custom exception, simply inherit the base exception and define what it will
do.
Python modules:
Python allows us to store our code in files (also called modules). This is very useful
for more serious programming, where we do not want to retype a long function
definition from the very beginning just to change one mistake. In doing this, we are
essentially defining our own modules, just like the modules defined already in the
Python library:
To support this, Python has a way to put definitions in a file and use them in a script
or in an interactive instance of the interpreter. Such a file is called a module;
definitions from a module can be imported into other modules or into
the main module.
Testing code:
• As indicated above, code is usually developed in a file using an editor.To test
the code, import it into a Python session and try to run it.
• Usually there is an error, so you go back to the file, make a correction, and test
again.
• This process is repeated until you are satisfied that the code works. This entire
process is known as the development cycle.

Dept. of CSE, S V College of Engineering 55


DRIVER DROWSINESS DETECTION SYSTEM

• There are two types of errors that you will encounter. Syntax errors occur when
the form of some command is invalid.
• This happens when you make typing errors such as misspellings, or call
something by the wrong name, and for many other reasons. Python will always give
an error message for a syntax error.
Functions in Python
It is possible, and very useful, to define our own functions in Python. Generally
speaking, if you need to do a calculation only once, then use the interpreter. But when
you or others have need to perform a certain type of calculation many times, then
define a function.
You use functions in programming to bundle a set of instructions that you want
to use repeatedly or that, because of their complexity, are better self-contained in
a sub-program and called when needed. That means that a function is a piece of
code written to carry out a specified task.
To carry out that specific task, the function might or might not need multiple
inputs. When the task is carved out, the function can or cannot return one or more
values.
There are three types of functions in python: Help (), min (), print ().Namespaces
in Python are implemented as Python dictionaries, this means it is a mapping from
names (keys) to objects (values). The user doesn't have to know this to write a Python
program and when using namespaces.
Some namespaces in Python:
• global names of a module
• local names in a function or method invocation
• built-in names: this namespace contains built-in functions (e.g. abs(), camp(),
...) and built-in exception names
Garbage Collection
Garbage Collector exposes the underlying memory management mechanism of
Python, the automatic garbage collector. The module includes functions for
controlling how the collector operates and to examine the objects known to the system,
either pending collection or stuck in reference cycles and unable to be freed.
Python XML Parser
XML is a portable, open source language that allows programmers to develop

Dept. of CSE, S V College of Engineering 56


DRIVER DROWSINESS DETECTION SYSTEM

applications that can be read by other applications, regardless of operating system


and/or developmental language.
What is XML? The Extensible Markup Language XML is a markup language much
like HTML or SGML. This is recommended by the World Wide Web Consortium and
available as an open standard. XML is extremely useful for keeping track of small to
medium amounts of data without requiring a SQL-based backbone. XML Parser
Architectures and APIs the Python standard library provides a minimal but useful set
of interfaces to work with XML.The two most basic and broadly used APIs to XML
data are the SAX and DOM interfaces. Simple API for XML SAX: Here, you register
call-backs for events of interest and then let the parser proceed through the document.
This is useful when your documents are large or you have memory limitations, it
parses the file as it reads it from disk and the entire file is never stored in memory.
Document Object Model DOM API : This is a World Wide Web Consortium
recommendation wherein the entire file is read into memory and stored in a
hierarchical tree − based form to represent all the features of an XML document.
SAX obviously cannot process information as fast as DOM can when working with
large files. On the other hand, using DOM exclusively can really kill your resources,
especially if used on a lot of small files. SAX is read-only, while DOM allows changes
to the XML file. Since these two different APIs literally complement each other, there
is no reason why you cannot use them both for large projects.
Python Web Frameworks:
A web framework is a code library that makes a developer’s life easier when building
reliable, scalable and maintainable web applications.
Why are web frameworks useful?
Web frameworks encapsulate what developers have learned over the past twenty years
while programming sites and applications for the web. Frameworks make it easier to
reuse code for common HTTP operations and to structure projects so other developers
with knowledge of the framework can quickly build and maintain the application.
Common web framework functionality:
Frameworks provide functionality in their code or through extensions to perform
common operations required to run web applications. These common operations
include:
1. URL routing

Dept. of CSE, S V College of Engineering 57


DRIVER DROWSINESS DETECTION SYSTEM

2. HTML, XML, JSON, and other output format tinplating


3. Database manipulation
4. Security against Cross-site request forgery (CSRF) and other attacks
5. Session storage and retrieval
Not all web frameworks include code for all of the above functionality. Frameworks
fall on the spectrum from executing a single use case to providing every known web
framework feature to every developer. Some frameworks take the "batteries-included"
approach where everything possibly comes bundled with the framework while others
have a minimal core package that is amenable to extensions provided by other
packages.
Comparing web frameworks:
There is also a repository called compare-python-web-frameworks where the same
web application is being coded with varying Python web frameworks, tinplating
engines and object.
Web framework resources:
• When you are learning how to use one or more web frameworks it's helpful to
have an idea of what the code under the covers is doing.
• Frameworks is a really well done short video that explains how to choose
between web frameworks. The author has some particular opinions about what should
be in a framework. For the most part I agree although I've found sessions and database
ORMs to be a helpful part of a framework when done well.
• What is a web framework? Is an in-depth explanation of what web frameworks
are and their relation to web servers?
• Jingo vs. Flash vs. Pyramid: Choosing a Python web framework contains
background information and code comparisons for similar web applications built in
these three big Python frameworks.
• This fascinating blog post takes a look at the code complexity of several Python
web frameworks by providing visualizations based on their code bases.
• Python’s web frameworks benchmarks is a test of the responsiveness of a
framework with encoding an object to JSON and returning it as a response as well as
retrieving data from the database and rendering it in a template. There were no
conclusive results but the output is fun to read about nonetheless.

Dept. of CSE, S V College of Engineering 58


DRIVER DROWSINESS DETECTION SYSTEM

• What web frameworks do you use and why are they awesome? Is a language
agnostic Reedit discussion on web frameworks? It's interesting to see what
programmers in other languages like and dislike about their suite of web frameworks
compared to the main Python frameworks.
• This user-voted question & answer site asked "What are the best general
purpose Python web frameworks usable in production?” The votes aren't as important
as the list of the many frameworks that are available to Python developers.
Web frameworks learning checklist:
1. Choose a major Python web framework (Jingo or Flask are recommended) and
stick with it. When you're just starting it's best to learn one framework first instead of
bouncing around trying to understand every framework.
2. Work through a detailed tutorial found within the resources links on the
framework's page.
3. Study open source examples built with your framework of choice so you can
take parts of those projects and reuse the code in your application.
4. Build the first simple iteration of your web application then go to
the deployment section to make it accessible on the web.
System Study:
System Testing:
The purpose of testing is to discover errors. Testing is the process of trying to discover
every conceivable fault or weakness in a work product. It provides a way to check the
functionality of components, sub-assemblies, assemblies and/or a finished product It
is the process of exercising software with the intent of ensuring that the
Software system meets its requirements and user expectations and does not fail in an
unacceptable manner. There are various types of test. Each test type addresses a
specific testing requirement.
Types Of Tests:
Unit testing:
Unit testing involves the design of test cases that validate that the internal program
logic is functioning properly, and that program inputs produce valid outputs. All
decision branches and internal code flow should be validated. It is the testing of
individual software units of the application .it is done after the completion of an
individual unit before integration. This is a structural testing, that relies on knowledge

Dept. of CSE, S V College of Engineering 59


DRIVER DROWSINESS DETECTION SYSTEM

of its construction and is invasive. Unit tests perform basic tests at component level
and test a specific business process, application, and/or system configuration. Unit
tests ensure that each unique path of a business process performs accurately to the
documented specifications and contains clearly defined inputs and expected results.
Integration testing:
Integration tests are designed to test integrated software components to determine if
they actually run as one program. Testing is event driven and is more concerned with
the basic outcome of screens or fields. Integration tests demonstrate that although the
components were individually satisfaction, as shown by successfully unit testing, the
combination of components is correct and consistent. Integration testing is specifically
aimed at exposing the problems that arise from the combination of components.
Functional test:
Functional tests provide systematic demonstrations that functions tested are available
as specified by the business and technical requirements, system documentation, and
user manuals.
Functional testing is centered on the following items:
Valid Input : identified classes of valid input must be accepted.
Invalid Input : identified classes of invalid input must be rejected.
Functions : identified functions must be exercised.
Output : identified classes of application outputs must be exercised.
Systems : interfacing systems or procedures must be invoked.
Organization and preparation of functional tests is focused on requirements, key
functions, or special test cases. In addition, systematic coverage pertaining to identify
Business process flows; data fields, predefined processes, and successive processes
must be considered for testing. Before functional testing is complete, additional tests
are identified and the effective value of current tests is determined.
System Test
System testing ensures that the entire integrated software system meets requirements.
It tests a configuration to ensure known and predictable results. An example of system
testing is the configuration oriented system integration test. System testing is based
on process descriptions and flows, emphasizing pre-driven process links and
integration points.

Dept. of CSE, S V College of Engineering 60


DRIVER DROWSINESS DETECTION SYSTEM

White Box Testing


White Box Testing is a testing in which in which the software tester has knowledge
of the inner workings, structure and language of the software, or at least its purpose.
It is purpose. It is used to test areas that cannot be reached from a black box level.
Black Box Testing
Black Box Testing is testing the software without any knowledge of the inner
workings, structure or language of the module being tested. Black box tests, as most
other kinds of tests, must be written from a definitive source document, such as
specification or requirements document, such as specification or requirements
document. It is a testing in which the software under test is treated, as a black box .you
cannot “see” into it. The test provides inputs and responds to outputs without
considering how the software works. Unit testing is usually conducted as part of a
combined code and unit test phase of the software lifecycle, although it is not
uncommon for coding and unit testing to be conducted as two distinct phases.
Test strategy and approach
Field testing will be performed manually and functional tests will be written in detail.
Test objectives
• All field entries must work properly.
• Pages must be activated from the identified link.
• The entry screen, messages and responses must not be delayed.
Features to be tested
• Verify that the entries are of the correct format
• No duplicate entries should be allowed
• All links should take the user to the correct page.

6.2 Integration Testing


Software integration testing is the incremental integration testing of two or more
integrated software components on a single platform to produce failures caused by
interface defects.
The task of the integration test is to check that components or software applications,
e.g. components in a software system or – one step up – software applications at the
company level – interact without error.
Test Results: All the test cases mentioned above passed successfully. No defects
encountered.

Dept. of CSE, S V College of Engineering 61

You might also like