vehicle infotainment system. If the dangerous state
appears few times, the system decides to use a
recommendation service in the cloud that makes
context-based recommendations. E.g., service can
propose to stop and drink a cup of coffee at a gas
station in 5 km or stay in a hotel in 10 km.
3.2 Dangerous Events Identification
We focus at five most commonly occurring
dangerous driving events: drowsiness, distraction
(e.g., when the driver is distracted and takes his/her
eyes off the road), tailgating (i.e., getting too close to
the followed car in front), lane weaving or drifting
and careless lane change. Figure 3 presents dangerous
events identification diagram.
Drowsiness. As a starting point, the smartphone’s
front camera should be able to monitor the head
position, facial expressions and the prolonged and
frequent blinks indicating micro sleep. We adopt a
standard metric for measuring alertness, PERcentage
of CLOSure of the eyelid – called PERCLOS, which
more formally represents the proportion of time
within one minute that eyes are at least 80% closed.
This driver state information such as PERCLOS and
eye-blink speed is provided by the front-facing
camera. We continuously compute PERCLOS and
declare the driver as “drowsy” if PERCLOS exceeds
a threshold (e.g., 28%). Another parameter is the
speed of blinking giving the permissible range of 0.5-
0.8 seconds per blink. One more indicator of
drowsiness is yawning. If the driver makes more than
3 yawns in 30 minutes we consider the driver is in this
dangerous state. Finally, the fourth indicator of this
dangerous event is the head nodding. If the number of
head nods exceeds a threshold (e.g., 4 in 2 minutes),
the drowsiness is inferred.
Distraction. Two types of inattentive driving are
monitored. In the first case, the output of the face
direction classifier based on head movements and
head position is tracked. If the driver’s face is not
facing forward for longer than 3 seconds while the car
is moving forward (i.e., while aт acceleration is
reported by the accelerometer) and not turning as
reported by the turn detector (which is based on the
gyroscope readings) then a dangerous driving event is
inferred. In the second case, we monitor the turn
detector. We recognize four face related categories
that include: (1) no face is present; or the driver’s face
is either (2) facing forwards, towards the road; (3)
facing to the left events (i.e., a 15
○
or more rotation
relative to facing directly forwards); and, (4) facing to
the right events (another 15
○
or more rotation, but this
time to the right). Each time a turn is detected, the
historical output of the face direction classifier is
checked. If there is no a head turn corresponding to
the car turning event then the driver did not check that
the road is clear before turning – as a result, a
dangerous event is inferred.
Tailgating. We adopt the calculation for a
minimum following distance, which relies on the
speed estimation and the recognition of the followed
vehicles. A “safe following distance” is a distance,
when the driver stays at least 2 seconds behind any
vehicle that is directly in front of the driver's vehicle.
If we determine the safe following distance is not
respected for a period longer than 3 seconds a
dangerous driving event is inferred.
Lane Weaving and Drifting. Detecting lane
weaving or drifting relies on the trajectory classifier
based on the lane markers and lane position of the
driver’s car. If the classifier infers either lane weaving
or lane drifting continuously for longer than 2
seconds, which would be significantly longer than the
typical duration of a lane change manoeuvre, we
report a dangerous driving event.
Careless Lane Change. Each time the trajectory
classifier determines a lane change event the recent
inferences made by face direction classification are
examined. If there is no a head turn corresponding to
the lane change event and the duration of mirror
checks is less than 3 seconds, occurring prior to the
lane change event detection, than a dangerous driving
event is inferred.
3.3 Implementation
3.3.1 Driver Face Recognition
The proposed ADAS system has been implemented
for Android-based mobile devices. The driver and
vehicle classification pipelines, which represent the
most computationally demanding modules, are
written in C and C++ based on the open source
computer vision library (OpenCV library) (see,
Figure 4) and interfaced with Java using JNI
wrappers. Currently, using the front-facing camera,
our mobile application is able to recognize two
dangerous events, drowsiness and distraction. Other
architectural components (dangerous driving event
engine, context-driven camera switching, and multi-
core computation planner) are implemented using
pure Java. For the image recognition based on
OpenCV library the Haar cascade classifier is called
to find faces or eyes at each frame received in video
sequence. It returns a vector of rectangles where each
rectangle contains the detected object. Each rectangle
is presented by OpenCV Rect structure (see Table 1).