Drowsiness Detection System
Drowsiness Detection System
A Practical Approach
Keywords: Driver Drowsiness Detection, Fatigue Detection, Drivers Assistance System, Eye-state Recognition, Head
Pose Estimation.
Abstract: This paper describes the steps involved in designing and implementing a driver drowsiness detection system
based on visual input (driver’s face and head). It combines off-the-shelf software components for face detec-
tion, human skin color detection, and eye state (open vs. closed) classification in a novel way. Preliminary
results show that the system is reliable and tolerant to many real-world constraints.
of the associated algorithms (e.g., Viola-Jones If that comfort zone is left, performance can be
face detector, Support Vector Machine classifier). dropped significantly.
• Easily portable to different platforms. The ap- • Hardware and software limitations. Typical mo-
plication must run on a mobile device (e.g., bile devices have one or two processor cores,
Android-based smartphone) mounted on the ve- reduced working memory and tend to work on
hicle’s dashboard. Ideally, it should be easily lower clock frequencies, compared to their desk-
portable to other (e.g., iOS-based) mobile devices top counterparts. The reason for all of this is to
of comparable size and computational capabili- reduce the energy consumption but it creates a sig-
ties. nificant obstacle in designing this type of system.
• Computationally non-intensive. Since (near) real- • Driver cooperation. Last, but certainly not least,
time performance is required, algorithms must all driver drowsiness detection systems assume a
be optimized to ensure continuous monitoring of cooperative driver, who is willing to assist in the
driver’s state without excessive burdening of the setup steps, keep the monitoring system on at all
device’s main processor. As a side benefit, battery times, and take proper action when warned by the
consumption is reduced as well. system of potential risks due to detected drowsi-
• Accuracy. One of the main challenges of design- ness.
ing such a system is related to the fact that both
type I and type II errors are highly undesirable, 2.2 System Architecture
for different reasons: type I errors (false positives)
will annoy the driver and reduce their willingness Our driver drowsiness detection system consists of
to use the system (due to excessive false alarms), four main stages (Figure 1):
whereas type II errors (false negatives) can have
literally catastrophic consequences and defeat the
purpose of the entire system.
• Robustness. The system must be tolerant to mod-
est amounts of lighting variations, relative cam-
era motion (e.g. due to poor road conditions), Figure 1: Four stages of Drowsiness Detection System
changes to the driver’s visual appearance (even in
the course of a session, e.g., by wearing/removing 2.2.1 Detection Stage
a hat or sunglasses), camera resolution and frame
rates, and different computational capabilities of This is the initialization stage of the system. Every
the device’s processors. time the system is started it needs to be set up and op-
timized for current user and conditions. The key step
Some of the anticipated constraints and limitations in this stage is successful head detection (Figure 2). If
faced by the proposed system include: the driver’s head is correctly located we can proceed
• Lighting conditions. Frequent and drastic change to extract the features necessary for setting up the sys-
in darkness or brightness of a scene (or part of it), tem. Setup steps include: (i) extracting driver’s skin
which may happen even during the shortest driv- color and using that information to create custom skin
ing intervals, have been proven to be a significant color model and (ii) collecting a set of open/closed
challenge for many computer vision algorithms. eyes samples, along with driver’s normal head posi-
• Camera motion. Poor road conditions as well as tion.
a more aggressive style of driving can introduce To help achieve these goals, user interaction might
significant amount of vibrations and discomfort be required. The driver might be asked to sit comfort-
to the driving experience. Those vibrations can ably in its normal driving position so that system can
be passed onto the camera and cause distortion in determine upper and lower thresholds needed for de-
the images which can significantly skew the re- tecting potential nodding. The driver might also be
sults and decrease the overall performance of the asked to hold their eyes closed and then open for a
system. matter of few seconds each time. This is enough to
get the system started. Over time, the system will ex-
• Relative positioning of device. The camera must pand the dataset of obtained images and will become
be positioned within a certain range from the more error resistant and overall more robust.
driver and within a certain viewing angle. Every
computer vision algorithm has a “comfort zone”
in which it performs the best and most reliably.
242
DesignandImplementationofaDriverDrowsinessDetectionSystem-APracticalApproach
243
SIGMAP2014-InternationalConferenceonSignalProcessingandMultimediaApplications
(a) Eyes above the upper (b) Head tilting down - Eyes be-
threshold - nodding did not start neath the upper threshold
(a) Generalized skin color chroma range
yet
(c) Head tilting down - Eyes be- (d) Head recovering up - eyes
neath the lower threshold above lower threshold
(b) User-specific skin color chroma range
244
DesignandImplementationofaDriverDrowsinessDetectionSystem-APracticalApproach
ing position with potential opening of the eyes while same distance throughout; the camera starts pointed
moving upward. The system also monitors the ve- at driver’s left profile and ends pointing at driver’s
locity of the nod since it is essential in distinguishing right profile. The driver’s head stays stationary, only
a true sleepy nodding from other potentially similar the camera moves around it while keeping constant
head movements that are not caused by nodding. distance from it. Video used for testing contains 310
frames of driver’s head from various angles. Figure 5
shows the process and the results. We can deduct that
the detection algorithm performs consistently. If we
3 PRELIMINARY EXPERIMENTS define an angle of 0 degrees to be when the camera
is directly facing the driver, we can conclude that the
In order to fulfill all of the challenging prerequisites
range in which it was reliably detecting drivers eyes
we have to test out limitations of our chosen off-the-
falls approximately within 25 degree viewing angle
shelf components. Some of our preliminary tests were
in both direction from a driver. This result is very
devised to help us out with that. We started by setting
encouraging since this means that we can position the
our work environment in MATLAB. For the purposes
camera of the system conveniently on car’s dashboard
of testing, we simplified our dynamic solution to its
(usually has available slot for attaching devices such
core, into a horizontal, linear solution that can per-
as phones etc.) which is within driver’s reach.
form basic face/eye detection as well as simple classi-
fication task of determining eye state. The goal of the
devised set of experiments is to test the basic perfor-
mance in various ways.
From the very beginning we decided to use Viola-
Jones algorithm, Haar-like feature based face/eyes de-
tection algorithm available in MATLAB (Viola and
Jones, 2001). It is known for being stable and compu- (a) Test setup (b) Angle range results
tationally non-intensive algorithm. Haar-like feature
can be described as a set of two or more adjacent rect-
angular regions organized in a specific way in a given
detection window. This algorithm proves to be com-
pute non-intensive since it’s core operation is simple
summing up of the pixel intensities in a given regions,
followed by calculation of differences between them.
That difference is then used to categorize subsections
of an image to be face/eyes or not.
Also, for differentiating between open and closed
eyes we decided to go with a proven two-class Sup-
port Vector Machine (SVM) classifier (Cortes and
Vapnik, 1995). SVM is a non-probabilistic binary lin-
ear classifier. It takes a set of input data and predicts,
for each given input, which of two possible classes (c) Consistency results
forms the output. This is perfect since our basic prob-
lem can be defined as two class problem: open eyes Figure 5: Camera rotating: angle change limitations.
vs. closed eyes.
3.2 Head Rotation Test
3.1 Camera Rotation Test
In this test the camera stays directly facing the driver
The aim of this test is to find out how does move- while the driver rotates his head to the right, returns
ment of the camera and change in the viewing angle to the starting position and then rotates the head to the
relative to the driver influences the performance of left and back to center again. We are again looking to
used face/eye detection algorithm as well as the con- see what is the angle of breaking for our head/eye de-
sistency of its detection. The experiment was setup in tection algorithm and what is its consistency across
following manner: the driver is sitting inside the car, the frames. Figure 6 is showing the tests setup and re-
looking towards the road; the camera, approximately sults. Difference in detection angles is much smaller
50 centimeters away from the driver’s head, will make than in previous test, only around 5 degrees. It seems
a semi-circle around the driver’s head, keeping the that the algorithm is consistently and reliably detect-
245
SIGMAP2014-InternationalConferenceonSignalProcessingandMultimediaApplications
are no sudden changes except with one spike for the Figure 8: Support Vector Machine result examples: (a) &
duration of one frame. This spike actually is a true (b) correct; (c), (d) & (e) incorrect.
positive.
246
DesignandImplementationofaDriverDrowsinessDetectionSystem-APracticalApproach
REFERENCES
Akertedt, T., Fredlung, P., Gillberg, M., and Jansson, B.
(2002). A prospective study of fatal occupational ac-
cidents – relationship to sleeping difficulties and occu-
pational factors. Journal of Sleep Research, 11(1):69–
71.
Cortes, C. and Vapnik, V. (1995). Support-vector networks.
Machine Learning, 20(3):273–297.
Viola, P. and Jones, M. (2001). Robust real-time object de-
tection. In International Journal of Computer Vision.
World Health Organization (2013). Global Status Report
on Road Safety 2013: Supporting a Decade of Action
: Summary. World Health Organization.
247