13 Batch Mini Project[1]]
13 Batch Mini Project[1]]
13 Batch Mini Project[1]]
BACHELOR OF TECHNOLOGY
In
COMPUTER SCIENCE AND ENGINEERING
Submitted by
P. NEHA 21S11A0533
K. HARIKA 21S11A0515
CH. MEGHANA 21S11A0525
P. TEJARAKSHITH 21S11A0556
CERTIFICATE
This is to certify that the mini project entitled “DRIVER DROWSINESS
DETECTION” has been submitted by P. NEHA (21S11A0533), K.
HARIKA (21S11A0515), CH. MEGHANA (21S11A0525) and P.
TEJARAKSHITH (21S11A0556) in partial fulfillment of the requirements
for the award of BACHELOR OF TECHNOLOGY in COMPUTER SCIENCE
& ENGINEERING. This record of bonafide work carried out by them under
my guidance and supervision. The result embodied in this mini
project report has not been submitted to any other University or
Institute for the award of any degree.
ii
External Examiner
ACKNOWLEDGEMENT
The Mini Project work carried out by our team in the
Department of Computer Science and Engineering, Malla
Reddy Instituter of Technology and Science, Hyderabad.
This work is original and has not been submitted in
part or full for any degree or diploma of any other
university.
P. NEHA 21S11A0533__________________
iii
K. HARIKA 21S11A0515__________________
P. TEJARAKSHITH 21S11A0556__________________
INDEX
CHAPTER Page
no.
ABSTRACT VI
LIST OF FIGURES VII
LIST OF TABLES VIII
1. SYSTEM ANALYSIS 1
3. SYSTEM DESIGN 7
3.2 Modules 8
3.2.1 Data Acquisition 8
3.2.2 Face Detection 8
3.2.3 Facial Landmark marking 8
3.2.4 Feature Extraction 8
3.2.5 Classification 8
3.3 UML Diagrams 9
3.3.1 Class Diagram 9
3.3.2 Usecase Diagram 10
3.3.3 Sequence Diagram 11
iv
3.4 System Requirements 12
3.4.1 Hardware Requirements 12
3.4.2 Software Requirements 12
4. INPUT&OUTPUT DESIGN
12
v
7.1.4 System Testing 38
7.1.5 Acceptance Testing 39
7.2 Test cases 39
8. RESULTS
40
vi
ABSTRACT
Nowadays, accidents occur during drowsy road trips and increase day by day;
It is a known fact that many accidents occur due to driver fatigue and
sometimes inattention, this research is primarily devoted to maximizing efforts
to identify drowsiness. State of the driver under real driving conditions. The
aim of driver drowsiness detection systems is to try to reduce these traffic
accidents. The secondary data collected focuses on previous research on
systems for detecting drowsiness and several methods have been used to detect
drowsiness or inattentive driving. The goal is to provide an interface where the
program can automatically detect the driver's drowsiness and detect it in the
event of an accident by using the image of a person captured by the webcam
and examining how this information can be used to improve driving safety can
be used. A vehicle safety project that helps prevent accidents caused by the
driver's sleep. Basically, you're collecting a human image from the webcam
and exploring how that information could be used to improve driving safety.
Collect images from the live webcam stream and apply machine learning
algorithm to the image and recognize the drowsy driver or not. When the
driver is sleepy, it plays the buzzer alarm and increases the buzzer sound. If
the driver doesn't wake up, they'll send a text message and email to their
family members about their situation. Hence, this utility goes beyond the
problem of detecting drowsiness while driving. Eye extraction, face extraction
with dlib.
LIST OF FIGURES
Figure No. Figure-name Page No.
1.1.1 Disadvantages:-
1.1.2 Advantages:-
1.3 Introduction
Drowsy driving is one of the major causes of deaths occurring in road accidents. The truck
drivers who drive for continuous long hours (especially at night), bus drivers of long-distance
route or overnight buses are more susceptible to this problem. Driver drowsiness is an
overcast nightmare to passengers in every country. Every year, a large number of injuries and
deaths occur due to fatigue related road accidents. Hence, detection of driver’s fatigue and its
indication is an active area of research due to its immense practical applicability. The basic
drowsiness detection system has three blocks/modules; acquisition system, processing system
and warning system. Here, the video of the driver’s frontal face is captured in acquisition
Driver Drowsiness Detection System
system and transferred to the processing block where it is processed online to detect
drowsiness. If drowsiness is detected, a warning or alarm is sent to the driver from the
warning system.
Generally, the methods to detect drowsy drivers are classified in three types; vehicle based,
behavioral based and physiological based. In vehicle-based method, a number of metrics like
steering wheel movement, accelerator or brake pattern, vehicle speed, lateral acceleration,
deviations from lane position etc. are monitored continuously. Detection of any abnormal change
in these values is considered as driver drowsiness. This is a nonintrusive measurement as the
sensors are not attached on the driver. In behavioral based method [1- 7], the visual behavior of
the driver i.e., eye blinking, eye closing, yawn, head bending etc. are analyzed to detect
drowsiness. This is also nonintrusive measurement as simple camera is used to detect these
features. In physiological based method [8,9], the physiological signals like Electrocardiogram
(ECG), Electrooculogram (EOG), Electroencephalogram (EEG), heartbeat, pulse rate etc. are
monitored and from these metrics, drowsiness or fatigue level is detected. This is intrusive
measurement as the sensors are attached on the driver which will distract the driver. Depending
on the sensors used in the system, system cost as well as size will increase. However, inclusion
of more parameters/features will increase the accuracy of the system to a certain extent. These
factors motivate us to develop a low-cost, real time driver’s drowsiness detection system with
acceptable accuracy. Hence, proposed a webcam-based system to detect driver’s fatigue from the
face image only using image processing and machine learning techniques to make the system
low-cost as well as portable.
PYTHON
DJANGO
Django is a high-level Python Web framework that encourages rapid development and clean,
pragmatic design. Built by experienced developers, it takes care of much of the hassle of Web
development, so you can focus on writing your app without needing to reinvent the wheel.
It’s free and open source.
Django's primary goal is to ease the creation of complex, database-driven websites. Django
emphasizes reusability and "pluggability" of components, rapid development, and the
principle of don't repeat yourself. Python is used throughout, even for settings files and data
models.
Django also provides an optional administrative create, read, update and delete interface that
is generated dynamically through introspection and configured via admin models
Driver Drowsiness Detection System
1.4 Algorithms
1.4.1 CNN working procedure
To demonstrate how to build a convolutional neural network-based image classifier, we shall
build a 6-layer neural network that will identify and separate one image from other. This
network that we shall build is a very small network that we can run on a CPU as well.
Traditional neural networks that are very good at doing image classification have many more
parameters and take a lot of time if trained on normal CPU. However, our objective is to
show how to build a real-world convolutional neural network using TENSORFLOW
Neural Networks are essentially mathematical models to solve an optimization problem. They
are made of neurons, the basic computation unit of neural networks. A neuron takes an input
(say x), do some computation on it (say: multiply it with a variable w and adds another
variable b) to produce a value (say; z= w x + b). This value is passed to a non-linear function
called activation function (f) to produce the final output (activation) of a neuron. There are
many kinds of activation functions. One of the popular activation functions is Sigmoid. The
neuron which uses sigmoid function as an activation function will be called sigmoid neuron.
Depending on the activation functions, neurons are named and there are many kinds of them
like RELU, TanH.
Driver Drowsiness Detection System
2.“Driver Fatigue Detection based on Eye Tracking and Dynamic Template Matching”
Abstract: A vision-based real-time driver fatigue detection system is proposed for driving
safely. The driver's face is located, from color images captured in a car, by using the
characteristic of skin colors. Then, edge detection is used to locate the regions of eyes. In
addition to being used as the dynamic templates for eye tracking in the next frame, the
obtained eyes' images are also used for fatigue detection in order to generate some warning
alarms for driving safety. The system is tested on a Pentium III 550 CPU with 128 MB RAM.
The experiment results seem quite encouraging and promising. The system can reach 20
frames per second for eye tracking, and the average correct rate for eye location and tracking
can achieve 99.1% on four test videos. The correct rate for fatigue detection is l00%, but the
average precision rate is 88.9% on the test videos.
Abstract: It describes a non-intrusive vision-based system for the detection of driver fatigue.
The system uses a color video camera that points directly rewards the driver's face and
monitors the driver's eyes in order to detect micro-sleeps (short periods of sleep). The system
deals with skin-color information in order to search for the face in the input space. After
segmenting the pixels with skin like color, perform blob processing in order to determine the
exact position of the face
Abstract: Drowsiness detection has many implications including reducing roads traffic
accidents importance. Using image processing techniques is amongst the new and reliable
methods in sleepy face. The present pilot study was done to investigate sleepiness and
providing images of drivers' face, employing virtual-reality driving simulator. In order to
detecting level of sleepiness according to the signal, information related to 25 drivers was
recorded with imaging rate of 10 fps. Moreover, on average 3000 frames was analyzed for
each driver. The frames were investigated by transforming in grey scale space and based on
the Cascade and Viola & Jones techniques and the images characteristics were extracted
using Binary and Histogram methods. The MPL neural network was applied for analyzing
data.70% of information related to each driver were inserted to the network of which 15% for
test and 15% for validation. In the last stage the accuracy of 93% of the outputs were
evaluated. The intelligent detection and usage of various criteria in long-term time frame are
of the advantages of the present study, comparing to other researches. This is helpful in early
detection of sleepiness and prevents the irrecoverable losses by alarming
5. "A Multimodal System for Assessing Alertness Levels Due to Cognitive Loading"
Abstract: The study presents a multimodal system for assessing alertness levels in response
to cognitive loading. By integrating physiological metrics, such as heart rate variability and
EEG, with behavioral performance data, we evaluated how cognitive demands affect
alertness. Our findings indicate a significant correlation between increased cognitive load and
decreased alertness, highlighting the system's potential applications in various fields.
Driver Drowsiness Detection System
3.2 Modules
3.2.1 Data Acquisition
The video is recorded using webcam (Sony CMU-BR300) and the frames are extracted and
processed in a laptop. After extracting the frames, image processing techniques are applied on
these 2D images. Presently, synthetic driver data has been generated. The volunteers are
asked to look at the webcam with intermittent eye blinking, eye closing, yawning and head
bending. The video is captured for 30 minutes duration.
3.2.2 Face Detection
After extracting the frames, first the human faces are detected. Numerous online face
detection algorithms are there. In this study, histogram of oriented gradients (HOG) and linear
SVM method [10] is used. In this method, positive samples of descriptors are computed on
them. Subsequently, negative samples (samples that do not contain the required object to be
detected i.e., human face here) of same size are taken and HOG descriptors are calculated.
Usually the number of negative samples is very greater than number of positive samples.
After obtaining the features for both the classes, a linear SVM is trained for the classification
task. To improve the accuracy of VM, hard negative mining is used.
3.2.3 Facial Landmark marking
After detecting the face, the next task is to find the locations of different facial features like
the corners of the eyes and mouth, the tip of the nose and so on. Prior to that, the face images
should be normalized in order to reduce the effect of distance from the camera, non-uniform
illumination and varying image resolution. Therefore, the face image is resized to a width of
500 pixels and converted to grayscale image. After image normalization, ensemble of
regression trees [11] is used to estimate the landmark positions on face from a sparse subset
of pixel intensities. In this method, the sum of square error loss is optimized using gradient
boosting learning. Using this method, the boundary points of eyes, mouth and the central line
of the nose are marked and the number of points for eye, mouth and nose are given in Table I.
3.2.4 Feature Extraction
After detecting the facial landmarks, the features are computed as described below. Eye
aspect ratio (EAR): From the eye corner points, the eye aspect ratio is calculated as the ratio
of height and width of the eye as given by.
3.2.5 Classification
After computing all the three features, the next task is to detect drowsiness in the extracted
frames. In the beginning, adaptive thresholding is considered for classification. Later,
Driver Drowsiness Detection System
machine learning algorithms are used to classify the data. For computing the threshold values
for each feature, it is assumed that initially the driver is in complete awake state. This is
called setup phase. In the setup phase, the EAR values for first three hundred (for 10s at 30
fps) frames are recorded. Out 4of these three hundred initial frames containing face, average
of 150 maximum values is considered as the hard threshold for EAR. The higher values are
considered so that no eye closing instances will be present. If the test value is less than this
threshold, then eye closing (i.e., drowsiness) is detected. As the size of eye can vary from
person to person, this initial setup for each person will reduce this effect. Similarly, for
calculating threshold of MOR, since the mouth may not be open to its maximum in initial
frames (setup phase) so the threshold is taken experimentally from the observations. If the test
value is greater than this threshold then yawn (i.e., drowsiness) is detected. Head bending
feature is used to find the angle made by head with respect to vertical axis in terms of ratio of
projected nose lengths. Normally, NLR has values room 0.9 to 1.1 for normal upright position
of head and it increases or decreases when head bends down or up in the state of drowsiness.
The average nose length is computed as the average of the nose lengths in the setup phase
assuming that no head bending is there.
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 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
Driver Drowsiness Detection System
classes, their attributes, operations (or methods), and the relationships among the classes. It
explains which class contains information.
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. The 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. 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.
Driver Drowsiness Detection System
1. Designing computer output should proceed in an organized, well thought out manner; the
right output must be developed while ensuring that each output element is designed so that
people will find the system can use easily and effectively.
3.Create document, report, or other formats that contain information produced by the system.
The output form of an information system should accomplish one or more of the following
objectives.
Convey information about past activities, current status or projections of the Future.
Signal important events, opportunities, problems, or warnings.
Trigger an action.
Confirm an action.
Driver Drowsiness Detection System
It is used for:
Why Python
Python works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc.).
Python has a simple syntax similar to the English language.
Python has syntax that allows developers to write programs with fewer lines than
some other programming languages.
Driver Drowsiness Detection System
Good to know
The most recent major version of Python is Python 3, which we shall be using in this
tutorial. However, Python 2, although not being updated with anything other than
security updates, is still quite popular.
In tutorial Python will be written in a text editor. It is possible to write Python in an
Integrated Development Environment, such as Thonny, PyCharm, Net beans or
Eclipse which are particularly useful when managing larger collections of Python
files.
Python was designed for readability, and has some similarities to the English
language with influence from mathematics.
Python uses new lines to complete a command, as opposed to other programming
languages which often use semicolons or parentheses.
Python relies on indentation, using whitespace, to define scope; such as the scope
of loops, functions and classes. Other programming languages often use curly-
brackets for this purpose.
To check if you have python installed on a Windows PC, search in the start bar for Python or
run the following on the Command Line (cmd.exe):
To check if you have python installed on a Linux or Mac, then on Linux open the command
line or on Mac open the Terminal and type:
python --version
If you find that you do not have python installed on your computer, then you can download it
for free from the following website: https://www.python.org/
Python is an interpreted programming language; this means that as a developer you write
Python (.py) files in a text editor and then put those files into the python interpreter to be
executed.
The way to run a python file is like this on the command line:
Let's write our first Python file, called helloworld.py, which can be done in any text editor.
helloworld.py
print("Hello, World!")
Simple as that. Save your file. Open your command line, navigate to the directory where you
saved your file, and run:
Hello, World!
Congratulations, you have written and executed your first Python program.
To test a short amount of code in python sometimes it is quickest and easiest not to write the
code in a file. This is made possible because Python can be run as a command line itself.
C:\Users\Your Name>python
Or, if the "python" command did not work, you can try "py":
C:\Users\Your Name>py
Driver Drowsiness Detection System
From there you can write any python, including our hello world example from earlier in the
tutorial:
C:\Users\Your Name>python
Python 3.6.4 (v3.6.4: d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on win32
>>>print("Hello, World!")
C:\Users\Your Name>python
Python 3.6.4 (v3.6.4: d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on win32
>>>print("Hello, World!")
Hello, World!
Whenever you are done in the python command line, you can simply type the following to
quit the python command line interface:
exit()
Introduction
Python applications will often use packages and modules that don’t come as part of the
standard library. Applications will sometimes need a specific version of a library, because the
application may require that a particular bug has been fixed or the application may be written
using an obsolete version of the library’s interface.
This means it may not be possible for one Python installation to meet the requirements of
every application. If application A needs version 1.0 of a particular module but application B
Driver Drowsiness Detection System
needs version 2.0, then the requirements are in conflict and installing either version 1.0 or 2.0
will leave one application unable to run.
Different applications can then use different virtual environments. To resolve the earlier
example of conflicting requirements, application A can have its own virtual environment with
version 1.0 installed while application B has another virtual environment with version 2.0. If
application B requires a library be upgraded to version 3.0, this will not affect application A’s
environment.
The module used to create and manage virtual environments is called venv. venv will usually
install the most recent version of Python that you have available. If you have multiple
versions of Python on your system, you can select a specific Python version by running
python3 or whichever version you want.
To create a virtual environment, decide upon a directory where you want to place it, and run
the venv module as a script with the directory path:
A common directory location for a virtual environment is. venv. This name keeps the
directory typically hidden in your shell and thus out of the way while giving it a name that
explains why the directory exists. It also prevents clashing with.env environment variable
definition files that some tooling supports.
On Windows, run:
tutorial-env\Scripts\activate.bat
source tutorial-env/bin/activate
(This script is written for the bash shell. If you use the csh or fish shells, there are alternate
activate.csh and activate. Fish scripts you should use instead.)
Driver Drowsiness Detection System
Activating the virtual environment will change your shell’s prompt to show what virtual
environment you’re using, and modify the environment so that running python will get you
that particular version and installation of Python. For example:
$ source ~/env/tutorial-env/bin/activate
(tutorial-env) $ python
>>>sys.path
'~/env/tutorial-env/lib/python3.5/site-packages']
You can install, upgrade, and remove packages using a program called pip. By default pip
will install packages from the Python Package Index, <https://pypi.org>. You can browse the
Python Package Index by going to it in your web browser, or you can use pip’s limited search
feature:
pip has a number of subcommands: “search”, “install”, “uninstall”, “freeze”, etc. (Consult the
Installing Python Modules guide for complete documentation for pip.)
Driver Drowsiness Detection System
You can install the latest version of a package by specifying a package’s name:
Collecting novas
You can also install a specific version of a package by giving the package name followed by
== and the version number:
Collecting requests==2.6.0
If you re-run this command, pip will notice that the requested version is already installed and
do nothing. You can supply a different version number to get that version, or you can run pip
install --upgrade to upgrade the package to the latest version:
Collecting requests
Uninstalling requests-2.6.0:
Driver Drowsiness Detection System
pip uninstall followed by one or more package names will remove the packages from the
virtual environment.
---Metadata-Version: 2.0
Name: requests
Version: 2.7.0
Home-page: http://python-requests.org
Author-email: [email protected]
Location: /Users/akuchling/envs/tutorial-env/lib/python3.4/site-packages
Requires:
pip list will display all of the packages installed in the virtual environment:
novas (3.1.1.3)
numpy (1.9.2)
pip (7.0.3)
Driver Drowsiness Detection System
requests (2.7.0)
pip freeze will produce a similar list of the installed packages, but the output uses the format
that pip install expects. A common convention is to put this list in a requirements.txt file:
novas==3.1.1.3
numpy==1.9.2
requests==2.7.0
The requirements.txt can then be committed to version control and shipped as part of an
application. Users can then install all the necessary packages with install -r:
Cross Platform
Values that cannot be determined are returned as given by the parameter presets. If bits is
given as '', the sizeof(pointer) (or sizeof(long) on Python version < 1.5.2) is used as indicator
for the supported pointer size.
Note On Mac OS X (and perhaps other platforms), executable files may be universal files
containing multiple architectures.
To get at the “64-bitness” of the current interpreter, it is more reliable to query the
sys.maxsize attribute:
platform.machine ()
Returns the machine type, e.g. 'i386'. An empty string is returned if the value cannot be
determined.
platform.node ()
Returns the computer’s network name. An empty string is returned if the value cannot be
determined.
Returns a single string identifying the underlying platform with as much useful information as
possible.
The output is intended to be human readable rather than machine parseable. It may look
different on different platforms and this is intended.If aliased is true, the function will use
aliases for various platforms that report system names which differ from their common
names, for example SunOS will be reported as Solaris. The system_alias() function is used to
implement this.
Setting terse to true causes the function to return only the absolute minimum information
needed to identify the platform.
platform.processor()
Driver Drowsiness Detection System
An empty string is returned if the value cannot be determined. Note that many platforms do
not provide this information or simply return the same value as for machine(). NetBSD does
this.
platform.python_build()
Returns a tuple (build no, build date) stating the Python build number and date as strings.
platform.python_compiler()
platform.python_branch()
platform.python_implementation()
Returns a string identifying the Python implementation. Possible return values are: ‘C
Python’, ‘Iron Python’, ‘Jython’, ‘PyPy’.
platform.python_revision()
Returns a string identifying the Python implementation SCM revision. New in version 2.6.
platform.python_version()
Note that unlike the Python sys.version, the returned value will always include the patch level
(it defaults to 0).
platform.python_version_tuple()
Driver Drowsiness Detection System
Returns the Python version as tuple (major, minor, patch level) of strings.
Note that unlike the Python sys.version, the returned value will always include the patch level
(it defaults to '0').
platform.release()
Returns the system’s release, e.g. '2.2.0' or 'NT' An empty string is returned if the value
cannot be determined.
platform.system()
Returns the system/OS name, e.g. 'Linux', 'Windows', or 'Java'. An empty string is returned if
the value cannot be determined.
Returns (system, release, version) aliased to common marketing names used for some
systems. It also does some reordering of the information in some cases where it would
otherwise cause confusion.
platform.version()
Returns the system’s release version, e.g. '#3 on degas'. An empty string is returned if the
value cannot be determined.
platform.uname()
Fairly portable uname interface. Returns a tuple of strings (system, node, release, version,
machine, processor) identifying the underlying platform.
Note that unlike the os.uname() function this also returns possible processor information as
additional tuple entry.Entries which cannot be determined are set to ''.
Java Platform
Returns a tuple (release, vendor, vminfo, osinfo) with vminfo being a tuple (vm_name,
vm_release, vm_vendor) and osinfo being a tuple (os_name, os_version, os_arch). Values
which cannot be determined are set to the defaults given as parameters (which all default to
'').
Windows Platform
Get additional version information from the Windows Registry and return a tuple (release,
version, csd, ptype) referring to OS release, version number, CSD level (service pack) and OS
type (multi/single processor).
Win95/98 specific
Mac OS Platform
Unix Platforms
This is an old version of the functionality now provided by linux_distribution(). For new
code, please use the linux_distribution().
The only difference between the two is that dist() always returns the short name of the
distribution taken from the supported_dists parameter.
supported_dists may be given to define the set of Linux distributions to look for. It defaults to
a list of currently supported Linux distributions identified by their release file name.
If full_distribution_name is true (default), the full distribution read from the OS is returned.
Otherwise the short name taken from supported_dists is used.
Returns a tuple (distname,version,id) which defaults to the args given as parameters. id is the
item in parentheses after the version number. It is usually the version codename.
Note This function is deprecated since Python 3.5 and removed in Python 3.8. See alternative
like the distro package.
Tries to determine the lib c version against which the file executable (defaults to the Python
interpreter) is linked. Returns a tuple of strings (lib, version) which default to the given
parameters in case the lookup fails.
Driver Drowsiness Detection System
python3.8
On Windows machines where you have installed Python from the Microsoft Store, the
python3.8 command will be available. If you have the py.exe launcher installed, you can use
the py command. See Excursus: Setting environment variables for other ways to launch
Python.
The interpreter’s line-editing features include interactive editing, history substitution and code
completion on systems that support the GNU Readline library. Perhaps the quickest check to
see whether command line editing is supported is typing Control-P to the first Python prompt
you get. If it beeps, you have command line editing; see Appendix Interactive Input Editing
and History Substitution for an introduction to the keys. If nothing appears to happen, or if ^P
is echoed, command line editing isn’t available; you’ll only be able to use backspace to
remove characters from the current line.
When known to the interpreter, the script name and additional arguments thereafter are turned
into a list of strings and assigned to the argv variable in the sys module. The length of the list
is at least one; when no script and no arguments are given, sys.argv[0] is an empty string.
When the script name is given as '-' (meaning standard input), sys.argv[0] is set to '-'. When -c
command is used, sys.argv[0] is set to '-c'. When -m module is used, sys.argv[0] is set to the
full name of the located module. Options found after -c command or -m module are not
consumed by the Python interpreter’s option processing but left in sys.argv for the command
or module to handle.
Interactive Mode
Driver Drowsiness Detection System
When commands are read from a tty, the interpreter is said to be in interactive mode. In this
mode it prompts for the next command with the primary prompt, usually three greater-than
signs (>>>); for continuation lines it prompts with the secondary prompt, by default three
dots (...). The interpreter prints a welcome message stating its version number and a copyright
notice before printing the first prompt:
$ python3.8
>>>
Continuation lines are needed when entering a multi-line construct. As an example, take a
look at this if statement:
>>>
...Be careful not to fall off! For more on interactive mode, see Interactive Mode.
By default, Python source files are treated as encoded in UTF-8. In that encoding, characters
of most languages in the world can be used simultaneously in string literals, identifiers and
comments — although the standard library only uses ASCII characters for identifiers, a
convention that any portable code should follow.
Driver Drowsiness Detection System
For example, to declare that Windows-1252 encoding is to be used, the first line of your
source code file should be:
One exception to the first line rule is when the source code starts with a UNIX “shebang”
line. In this case, the encoding declaration should be added as the second line of the file. For
example:
#!/usr/bin/env python3
Reasoning
Learning
Problem Solving
Perception
Driver Drowsiness Detection System
Major Goals
Knowledge reasoning
Planning
Machine Learning
Computer Vision
Robotics
IBM Watson
“Watson” is an IBM supercomputer that combines Artificial Intelligence (AI) and complex
inquisitive programming for ideal execution as a “question answering” machine. The
supercomputer is named for IBM’s founder, Thomas J. Watson.
IBM Watson is at the forefront of the new era of computing. At the point when IBM Watson
made, IBM communicated that “more than 100 particular techniques are used to inspect
Driver Drowsiness Detection System
perceive sources, find and make theories, find and score affirm, and combination and rank
speculations.”
Although machine learning is a field within computer science, it differs from traditional
computational approaches. In traditional computing, algorithms are sets of explicitly
programmed instructions used by computers to calculate or problem solve. Machine learning
algorithms instead allow for computers to train on data inputs and use statistical analysis in
order to output values that fall within a specific range. Because of this, machine learning
facilitates computers in building models from sample data in order to automate decision-
making processes based on data inputs.
In machine learning, tasks are generally classified into broad categories. These categories are
based on how learning is received or how feedback on the learning is given to the system
developed.
Two of the most widely adopted machine learning methods are supervised learning which
trains algorithms based on example input and output data that is labeled by humans,
and unsupervised learning which provides the algorithm with no labeled data in order to
allow it to find structure within its input data. Let’s explore these methods in more detail.
Supervised Learning
In supervised learning, the computer is provided with example inputs that are labeled with
their desired outputs. The purpose of this method is for the algorithm to be able to “learn” by
comparing its actual output with the “taught” outputs to find errors, and modify the model
accordingly. Supervised learning therefore uses patterns to predict label values on additional
unlabeled data. For example, with supervised learning, an algorithm may be fed data with
images of sharks labeled as fish and images of oceans labeled as water.
Driver Drowsiness Detection System
Unsupervised Learning
5.8 Approaches
For those who may not have studied statistics, it can be helpful to first define correlation and
regression, as they are commonly used techniques for investigating the relationship among
quantitative variables. Correlation is a measure of association between two variables that are
not designated as either dependent or independent. Regression at a basic level is used to
examine the relationship between one dependent and one independent variable. Because
regression statistics can be used to anticipate the dependent variable when the independent
variable is known, regression enables prediction capabilities.
The k-nearest neighbor algorithm is a pattern recognition model that can be used for
classification as well as regression. Often abbreviated as k-NN, the k in k-nearest neighbor is
a positive integer, which is typically small. In either classification or regression, the input will
consist of the k closest training examples within a space.
Driver Drowsiness Detection System
We will focus on k-NN classification. In this method, the output is class membership. This
will assign a new object to the class most common among its k nearest neighbors. In the case
of k = 1, the object is assigned to the class of the single nearest neighbor.
When we choose k = 3, the algorithm will find the three nearest neighbors of the green heart in
order to classify it to either the diamond class or the star class.
In our diagram, the three nearest neighbors of the green heart are one diamond and two stars.
Therefore, the algorithm will classify the heart with the star class.
APPLICATIONS OF AI
Natural Language Interact with the computer that understands natural language
processing spoken by humans.
Expert Systems Machine or software provide explanation and advice to
others.
Vision Systems Systems understand, describe visual input on the computer.
5.8.2 Decision Tree Learning
For general use, decision trees are employed to visually represent decisions and show or
inform decision making. When working with machine learning and data mining, decision
trees are used as a predictive model. These models map observations about data to
conclusions about the data’s target value.
ECONOMICAL FEASIBILITY
TECHNICAL FEASIBILITY
SOCIAL FEASIBILITY
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.
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.
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.
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.
Unit Testing
Driver Drowsiness Detection System
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 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
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.
Test Case 1
Test Case 2
Test Case 3
CHAPTER – 8: RESULTS
User Screen:
To run this project double click on ‘run.bat’ file to get below screen
In above screen click on ‘Start Behavior Monitoring Using Webcam’ connect application
with webcam, will get below screen with webcam streaming
In above screen we can see web cam stream then application monitor all frames to see person
eyes are open or not, if closed then will get alarm sound was going to start
Driver
Drowsiness
Driver Drowsiness Detection System
A system in which density of traffic is measured by comparing captured image with real time
traffic information against the image of the empty road as reference image is proposed. Each
lane will have a minimum amount of green signal duration allocated. According to the
percentage of matching allocated traffic light duration can be controlled
9.1 Conclusion
A low-cost, real-time driver drowsiness monitoring system has been proposed based on
visual behavior and machine learning. Here, visual behavior features like eye aspect ratio,
mouth opening ratio and nose length 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. Bayesian classifier, FLDA and SVM have been explored here. It has
been observed that FLDA and SVM outperform Bayesian classifier. The sensitivity of FLDA
and SVM is 0.896 and 0.956 respectively whereas the specificity is 1 for both. As FLDA and
SVM give better accuracy, work will be carried out to implement them in the developed
system to do the classification (i.e., drowsiness detection) online.
[2] K. T. Chui, K. F. Tsang, H. R. Chi, B. W. K. Ling, and C. K. Wu, “An accurate ECG
based transportation safety drowsiness detection scheme,” 118732 IEEE Transactions on
Industrial Informatics, vol. 12, no. 4, pp. 14381452, Aug. 2016.
[5] R. Ahmad, and J. N. Borole, “Drowsy Driver Identification Using Eye Blink Detection,”
IJISET - International Journal of Computer Science and Information Technologies, vol. 6, no.
1, pp. 270-274, Jan. 2015.
[7] V. Kazemi and J. Sullivan; "One millisecond face alignment with an ensemble of
regression trees", IEEE Conf. on Computer Vision and Pattern Recognition, 23-28 June,
2014, Columbus, OH, USA.
[9] N. Dalal and B. Triggs, “Histograms of Oriented Gradients for Human Detection”, IEEE
conf. on CVPR, 2005.
Driver Drowsiness Detection System
[10] 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, Taipei, Taiwan, March 21-23, 2004.
[11] S. Singh, N.P. Papanikolopoulos, “Monitoring Driver Fatigue using Facial Analysis
Techniques”, IEEE Conference on Intelligent Transportation System, pp 314-318.
[12] Richard O. Duda, Peter E. Hart, David G. Stork, “Pattern Classification”, Wiley student
edition.