Journal of Robotics, Networking and Artificial Life, Vol. 1, No. 1 (June 2014), 2-6

Anomaly Stop Detection by Smartphone
Viet Chau Dang*, Masao Kubo, Hiroshi Sato, Tomohiro Shirakawa, Akira Namatame

Computer Science, National Defense Academy, Hashirimizu 1
Yokosuka, Kanagawa, 239-8686, Japan*Corresponding author. Email: dangvietchau@gmail.com
Tel:+81-46-841-3810,Fax:+81-46-844-5911

Abstract
This paper proposes a method for detecting anomaly stop events from GPS logs of a vehicle recorded bysmartphone. Despite of many researches of strong braking event detection are proposed, they cannot discriminate
between a normal and an abnormal braking event. Our proposal includes an IMAC model for GPS based map
generation and an algorithm for anomaly stops detection based on the acquired map. The real world experimentshows our map generation method and its anomaly stop detection rule works well.
Keywords: Smartphone, Geographic Information System, Safety Map, Social Network Service, Anomaly Detection

1. Introduction
This paper studies a method for detecting anomaly stopevents from GPS log of a vehicle which is recorded by asmartphone. Recently, there have been numerous
researches of analysis transport data to extract and shareuseful information for improving safety of transport
environment[1,2,3]. For example, Honda Company
collects hard braking event data of a vehicle equippedwith sensors, and shares the map over Internet for publicuse[1]. We expect to collect data from community thenwe use smartphone as a terminal log data. For
automatically generating safety map from driving log
data, incidents which are important to drive safely haveto be extracted from the log data. We choose stopmotion events of vehicle as source of detection ofincident. When driver encounters obstacles during

driving for example, jump out of street, it usually stops
the vehicle for accident avoidance.
Currently, there have been numerous studies on roadenvironment estimation based on strong braking
detection using probe car. However, they cannot
discriminate between a normal and an abnormal braking
event. In this paper, to detect anomaly stop events: 1)
the system learns normal driving states from history; 2)anomalous stop events are detected by comparing thenormal driving states and current driving states. In
comparing to stop events caused by traffic signs andpermanent road condition, anomalous stop caused byjump out of street doesn’t frequently occur. The successof detecting anomalous stop at which there is no traffic
sign is expected to contribute to the improvement ofsafety of traffic road system.
This paper proposes an extended version of IMAC[5]model for GPS based grid map generation. The IMAC
model supposes that each grid is a two-state Markov

Published by Atlantis Press
Copyright: the authors
2Dang et.al.

graph which can be used to represent traffic elements
such as traffic signal or semi-static objects. We use
IMAC as a map generation method of a trafficenvironment.
The paper is organized as follows. Section 2 introduces
our approach for GPS based grid map generation and analgorithm for anomalous stop detection. Section 3
shows the real world experiment with discussion on theresults.
2. Approach for Map Generation and Anomaly
Detection
This section denotes the method of occupancy grid map
generation and its application for detecting anomalousstop. We first explain about the IMAC model[5]. The
proposed algorithm is given in the next sub-sections: thegrid update algorithm and the propose method foranomalous stop detection.

(4)
where #events:occupied to free is the number of times a
grid is observed turning from occupied to free,#observations when occupied is the number ofobservations done in occupied state and #events:free tooccupied. #observations when free are the respective
quantities for observing a grid turning from free tooccupied and observing the grid in free state. Theinterpretation of
as a Poisson rate parameter isthe expected number of state change events per
observation, given that we are in occupied state.
The experiment in a warehouse Saarinen et al.[5] showsthat we can archive a good grid map of dynamic
environment by using the IMAC model.

Fig. 2. Example of stop by incident.
Fig. 1. State transition of a grid of IMAC. Each grid is a twostate Markov chain being in Free or Occupied. The gridchanges its state from Free to Occupied with probability ofPentry; from Occupied to Free with probability of Pexit

2.1. Independent Markov Chain Occupancy Grid
Map (IMAC)
The IMAC [5] is an occupancy grid map based on theproposed model of Luber[4]. Each grid has two states,
which being in occupied or free. Assuming that the statetransition of each grid is independent and thus it can bemodeled as a Poisson process. Fig.1 shows the Poissonprocess state transition graph of each grid and theprobabilities. These state transition probability areestimated as follows. The estimated state transition
probability of grid m is,(1).

(2)After we got the observations for grid m, calculate(3)

2.2. Grid Update Algorithm and Driving Behavior
This sub-section describes algorithm to estimate gridstates from GPS log data, and method to detect andcreate map of incident stops. Fig. 2 shows two examples
of incident spots on traffic road. At the zebra crossing
line, vehicle has to stop for a while (v(t + 2) = 0). After
that, it starts to increase its speed (v(t + 10) > v(t + 2)).
The lower part of Fig. 2 shows an example of stop byobstacle.
We assume that if a vehicle decreases its speed, there
must be an incident event around its location. Otherwise,
if a vehicle drives smoothly, there are no incident events
interfering with driving process. The algorithm 1 shows
the proposed algorithm.
Algorithm 1. Grid property update algorithm
1
if vehicleIsStopi(t) == true then2
for all grid q in map do
3
for all grid m :| m in neighbor(xi,spanmin) do
4Increase number of observations in occupancyby w(xi(t); q)5
if vehicleIsStopi(t -1)= = false then6
Increase number of entry event by w(xi(t);m)

Published by Atlantis Press
Copyright: the authors3

Anomaly Stop Detection

78
9
10
11
12
13

end ifend forend forelse
for all grid q in map dofor all grid m :| m in neighbor(xi; ksvi(t)) do
Increase number of observations in free byw(xi(t), q)
14
end for15
if vehicleIsStopi(t -1) == true then16
for all grid m : | m in neighbor(xi,spanmin) do
17Increase number of exit event by w(xi(t), q)
18
end for19
end if20 end for21 end if
where neighbor(x, d) means the set of grids of d far fromx, vi(t) in line 12 is speed of vehicle i at t, and k is aconstant. This algorithm updates the grid by using
vehicle states as follows. We suppose that a vehicle€
drives slowly according to its distance to obstacle. GPSlog data contains lot of noise, thus the proposed
algorithm tries to update states of neighboring grids€
around the vehicle location. As shown in Fig.3, if avehicle stops the occupied observations and transition
events of grids around the vehicle location are updated
by using weight w. Otherwise, the free observations andtransition events of grids are updated.

Algorithm 2. Probability calculation algorithm
1if mode(t) == stop then
2Pa,t = Pa,t-1(1 )3if Pa,t ≤ (1− λ exit )(1+ks ) λ exit then4
This is anomaly stop5
end if€6else
7Pa,t = 1
8
end ifwhereis the average value ofof all grids
inside its circle with radius r. We adopt r=3.4m in thispaper. Pa,t are used for determining anomaly stop events.
We assume that the stop time follows a normal
distribution and use the 3 rule for determining thethreshold as follows:(5)
Pa,t ≤ (1− λ exit )(1+ks ) λ exit
If a stop events that satisfy the Eq. (5) then it is said tobe an anomaly stop event. ks is an constant parameter.
steps far(1+ k s ) λ exit is the stop time which hasfrom the average. In the experiment, we set ks = 3.
3. Experiment
In this section, we evaluate the proposed model by areal world experiments. The first experiment is for map
generation; the second experiment is for anomaly stop
detection. We use an Apple iPhone 4s for recording
GPS log data. The log data includes GPS location,
heading, and time series which are recorded at
frequency of 100Hz. The vehicle is a Mazda6 20c, thesmartphone was put on vehicle door pocket.
AVFig. 3. GPS noise solution (circle update)

2.3. Proposed Method for Anomaly Stop Detection
In this sub-section, we proposed a simple algorithm todetect anomalous stop by using the acquired grid mapdescribed in 2.2. For detecting anomaly stop time, weevaluate the stop time.
Algorithm 2 shows the proposed algorithm. The
probability of occurrence of a given stop time Pa,t can becalculate by the two-Markov chain in Fig.1.

BCFig.4 Dataset1 for map generation. The solid rectangle is aclockwise test track for the vehicle. The GPS data is shown by
the set of thick yellow lines. In Dataset1, there are three stoplines A, B, C which the vehicle stops at 10 seconds, 6 seconds,and 4 seconds respectively. The red box is the virtual stop
location V for anomaly detection test.

Published by Atlantis Press
Copyright: the authors
4Dang et.al.

3.2. Anomaly Stop Detection

3.1. Map Generation
The objective of this experiment is to evaluate if theproposed method can be used to create map by using
real world data. Fig.4 shows the test track which
represent as the white line. The vehicle drives around arectangle building follow clockwise. The white lines
with black bound are temporarily stop lines A, B, and C.
Stop line V is an anomaly stop line used for the next
experiment.

Fig. 6. Grid map ofof half of Dataset1 and anomaly
stop detection by the rest half of Dataset1. The blue triangles
show the anomaly stop detection of the same dataset for map
generation and anomaly stop detection. There is no anomaly
stop at the location V. However, there are many wrong
anomalous stop are detected at the stop line A, B, C becauseof GPS noise.

Fig. 5. Grid map ofof half of Dataset1 (red-white dots).
There is no transition events (occupied to free or free tooccupied) happened at white grids. In others hand, there aremany transition events happened at red grids, especially at thestop line A, B, C.

We use two datasets for evaluating our method which
has the same test track. In Dataset1, there are three stoplines A, B, C at which vehicle stops for 10 seconds, 6seconds, and 4 seconds. Dataset2 has three stop lines asin Dataset1 plus stop line V at which the vehicle stops
for 10 seconds. These two datasets include 70 roundswith 5km. Fig. 4 shows Dataset1. Despite of passing thesame path on the all laps, the both datasets include a lotof noise which make the GPS paths is out of the test
track when installed in vehicle door pocket.
The grid map ofbased on half of Dataset1 isshown in Fig. 5. Theof each grid is presented as aRED-WHITE gradient color (RED~0, WHITE~1). At
each center of the stop lines A, B, C, the values ofare smaller than neighbor grid. Also, the colors aroundthe stop line A are redder than those of the stop lines B,C. In other words, the vehicle stops at the stop line A
longer than at the stop line B, C. It means that the grid
map reflects Dataset1 correctly.
This experiment result shows that the acquired grid map
is suitable with those of the experiment setup.

This section carries out anomaly stop detection
experiment. We use half of Dataset1 to create grid map.
Then half of Dataset2 (which the vehicle stops 10
seconds at stop line V additionally) is tested as dataset
may have anomaly stops. We execute the following two
combinations of anomaly detection trials for evaluatingaccuracy of the proposed method.
We set up the following scenarios:
S1: Map generation dataset is 50% of Dataset1. The test
dataset for anomaly is the remaining 50% of Dataset1.
S2: Map generation dataset is 50% of Dataset1. The test
dataset for anomaly stop detection is 50% of Dataset2.
The purpose of scenario S1 is to check the validity ofthe proposed model. Because the map generation dataset
and the anomalous stop detection dataset uses the same
source, it is expected not to show any anomaly stop. The
purpose of scenario S2 is to detect anomalous stop.
The results of the anomaly stop detection are shown inFig.6 and Fig.7. The result of S1 is shown in Fig.6. The
result of S2 is shown in Fig.7. The triangles are theanomaly stop locations detected by the proposed
method. No anomaly stop is detected around thelocation V in S1. There are many anomaly stops
detected around the location V in S2.
Table 1 shows the anomaly detection ratio for twoscenarios S1 and S2 at the location V. Ideally, themaximum of the number of anomaly stops is thenumber of data during stop at location V, namely, thenumber of laps 10sec. 100Hz. TP(True Positive)
column in this table indicates the ratio of successfully

Published by Atlantis Press
Copyright: the authors5

Anomaly Stop Detection

detected anomaly stops. rv is distance far from stop line
V. We adopt rs=4.7m and 9.4m. 4.7m is equal to thecar length. The false detected anomaly stops are others
anomaly stop more far from stop line V.

daily hard braking and anomaly breaking in relation
with its geographic information. We proposed twoalgorithms. The first algorithm uses for estimating gridstates by using GPS log data. The second algorithm uses
for anomaly stop detection by using estimated grid map.
In the anomaly detection method, we use the estimatedgrid map as ground truth map for comparing with test
dataset. The anomaly stop detection method based on
longer stop time is proposed. We also evaluated theproposed methods in a real world experiment. The
results show that the estimated grid map and anomalous
stop detection can be worked well in real world
environment.

Fig. 7. Grid map ofof half of Dataset1 and anomaly
stop detection by half of Dataset2. The blue triangles show theanomaly stop detection. The proposed algorithm detects many
anomaly stop at the virtual stop line V

The TP of detection rate of S1 is 0/0 because there is no
anomaly stop at the location V in the dataset. Otherwise,
the TP of detection rate of S2 is TP=0.399 for rv=4.7m
and TP=0.642 for rv=9.4m. It means that the large
portion of the anomaly stops is located around stop lineV. On the other hand, because of GPS noise, the vehicle
speed is not always zero. As seen in Fig.7 there areother miss detections near the stop line A, B, C. It
suggests the more efficient method to filter the GPS
noise is required which we consider as future work.
From the result, the proposed method can be used in thereal world to detect anomaly stop with a reasonableaccuracy.

Table 1. Anomalous stop detection rate (TP: True Positive,
FP: False Positive, FN: False Negative, TN: True Negative)

Scenario
S1
S2(rv=4.7m)
S2(rv=9.4m)

TP0/00.399
0.642

FP00.380.137

FN
00.601
0.358

TN
10.62
0.863

4. Conclusion
This paper proposed a method for anomaly stopdetection of a vehicle using smartphone log data.
Despite of many researches of strong braking events areproposed, no works discussed on the discrimination ofFig. 8. Anomalous stop detection accuracy of scenario S2(zoom details around the virtual stop line V). The blue andyellow triangles show all of anomalous stop detection aroundthe virtual stop line V. The yellow triangles are anomaly stops
within 4.7m radius circle from virtual stop line VReferences
1. J. C. Herrera, A. M. Bayen, Incorporation of Lagrangianmeasurements in freeway traffic state estimation,
Transportation Research Part B 44 (2010) 460-481
2. B. N. Hilton, T. A. Horan, R. Burkhard and B. Schooley,
SafeRoadMaps: Communication of Location and Densityof Traffic Fatalities through Spatial Visualization andHeat Map Analysis Information Visualization(http://saferoadmaps.org/,2013)
3. The Honda safety project(http://safetymap.jp/,2013)
4. M. Luber, G. Diego Tipaldi, and K.O. Arras. Placedependent people tracking. The International Journal ofRobotics Research, 30(3)(2011) 280-293.
5. J. Saarinen, H. Andreasson, and A. J. Lilienthal,Independent Markov chain occupancy grid maps forrepresentation of dynamic environment, in Proc. 2012
IEEE/RSJ International Conference on Intelligent Robotsand Systems (IROS, 2012), pp.3489 – 3495.

Published by Atlantis Press
Copyright: the authors
6