trajectory segmentation marc van kreveld. algorithms researchers … … want their problems to be...

52
Trajectory Segmentation Marc van Kreveld

Upload: izaiah-churchwell

Post on 01-Apr-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Trajectory Segmentation

Marc van Kreveld

Page 2: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation• Cutting a trajectory in pieces that are “similar” within the

piece• Similar in: heading, speed, curvature, sinuosity, …

Page 3: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Why segmentation?• Explaining behavior of a moving entity: one type of behavior

may be characterized by similarity of movement • Detecting outliers: short segments in a segmentation may be

caused by outlying observations

Page 4: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation in other areas• Image segmentation: partition a digital image in parts with

similar characteristics (hopefully meaningful pieces)

Page 5: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation in other areas• Time series segmentation: partition time series data into

pieces with similar characteristics

Page 6: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation in other areas• Time series segmentation: partition time series data into

pieces with similar characteristics• Assume a series of n data points is given and k segments

are desired

n = 20k = 4

Minimize sum-of-distances or sum-of-squared distances for piecewise-constant or piecewise-linear approximations

Richard Bellman: On the approximation of curves by line segments using dynamic programming. Communications of the ACM (1961)

O(n2 k)

Page 7: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation in other areas• Time series segmentation: partition time series data into

pieces with similar characteristics• Assume a series of n data points is given and k segments

are desired

n = 20k = 4

Minimize sum-of-distances or sum-of-squared distances for piecewise-constant or piecewise-linear approximations

Richard Bellman: On the approximation of curves by line segments using dynamic programming. Communications of the ACM (1961)

O(n2 k)

Page 8: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation of trajectories• Can be treated as trajectory simplification: reduce (minimize)

the number of vertices that represents a trajectory

Gill Barequet, Danny Chen, Ovidiu Daescu, Michael Goodrich, Jack Snoeyink: Efficiently approximating polygonal paths in three and higher dimensions. Algorithmica (2002)

Hu Cao, Ouri Wolfson, Goce Trajcevski: Spatio-temporal data reduction with deterministic error bounds. VLDB Journal (2006)

Joachim Gudmundsson, Jyrki Katajainen, Damian Merrick, Cahya Ong, Thomas Wolle: Compressing spatio-temporal trajectories. ISAAC (2007)

Falko Schmid, Kai-Florian Richter, Patrick Laube: Semantic trajectory compression. SSTD (2009)

Page 9: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation of trajectories• Can be treated as trajectory simplification: reduce (minimize)

the number of vertices that represents a trajectory

The segments are the subtrajectories that would be replaced by a single edge in the simplification

Page 10: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: two steps back• Cutting a trajectory in pieces that are “similar” within the

piece (similar in: heading, speed, curvature, sinuosity, … )• We want few pieces• How do we define “similar”?

Next part based on:

Maike Buchin, Anne Driemel, Marc van Kreveld, Vera Sacristan: An algorithmic framework for segmenting trajectories based on spatio-temporal criteria. SIGSPATIAL (2010)

Page 11: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: heading• On every edge of the trajectory, heading is well-defined• Similarity can mean: in the same cardinal direction

Northbound

EastWest

South

Page 12: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: heading• On every edge of the trajectory, heading is well-defined• Similarity can mean: in the same cardinal direction

Northbound

EastWest

South

Page 13: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: heading• On every edge of the trajectory, heading is well-defined• Similarity can mean: in the same cardinal direction

Northbound

EastWest

South

Page 14: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: heading• On every edge of the trajectory, heading is well-defined• Similarity can mean: in the same cardinal direction

Northbound

EastWest

South We would segment at every vertex, while we want one single segment

bad idea

over-segmentation

Page 15: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: heading• Use relative directions: We require that within any single

segment the headings are within an angle /2 everywhere

Page 16: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: heading• Use relative directions: We require that within any single

segment the headings are within an angle /2 everywhere

Page 17: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: heading• Use relative directions: We require that within any single

segment the headings are within an angle /2 everywhere

Page 18: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: heading• Use relative directions: We require that within any single

segment the headings are within an angle /2 everywhere

Page 19: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: heading• Use relative directions: We require that within any single

segment the headings are within an angle /2 everywhere

Page 20: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: speed• Linear interpolation of position between the vertices makes

speed piecewise constant (constant on every edge)• Segmentation can be based on absolute intervals like

[0-2], [2-5], [5-10], [10-15], [15-20], [20-30], [30-..] km/h

31 29 31 29 31 29 31 29

over-segmentation

Page 21: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: speed• Linear interpolation of position between the vertices makes

speed piecewise constant (constant on every edge)• Segmentation can be based on absolute intervals like

[0-2], [2-5], [5-10], [10-15], [15-20], [20-30], [30-..] km/h• Segmentation can also be based on relative speeds: within

any single segment the speed ratio is at most, say, 1.5(alternatively: the speed difference is at most 10 km/h)

Page 22: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: heading and speed• Suppose require that within any single segment:– the headings are within an angle /2 everywhere, and– the speed ratio is at most 2

speed

speed

speed heading

Page 23: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation• In all three cases (heading, speed, heading&speed), a greedy

approach works: make each next segment as long as possible• Easy from the algorithms perspective: O(n) time for a

trajectory with n vertices

Why does the greedy approach work?

Because any sub-segment of a valid segment is also a valid segment. Therefore, it can never hurt to let a segment extend as far as it can if the goal is a minimum number of segments.

Page 24: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: attributes• Heading and speed are examples of attributes that are

defined at (almost) every point on the trajectory• Location , curvature, sinuosity, and curviness are also

attributes

need a framework to handle different attributes and ways of combining them

Page 25: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: framework• Attribute: some value defined at every point on the trajectory• Criterion: restriction on allowed values of an attribute within

the same segment• Segmentation on any combination (conjunction or disjunction)

of criteria

Optimal (minimum number of segments) Guaranteed properties within each segment

Page 26: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: location• The attribute “location” is defined by a pair of values (x,y)

(for trajectories in 2D)• Possible criteria:– Any two points within one segment are no more than 5 km

apart (diameter criterion)– For any segment, there is a point in the plane that is within

3 km of every point in the segment (enclosing disk criterion)

Page 27: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: location• The attribute “location” is defined by a pair of values (x,y)

(for trajectories in 2D)• Possible criteria:– Any two points within one segment are no more than 5 km

apart (diameter criterion)– For any segment, there is a point in the plane that is within

3 km of every point in the segment (enclosing disk criterion)

Page 28: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: location• An optimal segmentation on the diameter or disk criterion for

location requires segmentation potentially anywhere on edges• We can segment optimally on these criteria in O(n log n) time• Also in combination with heading and speed criteria

Page 29: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: algorithm• Greedy algorithm for optimal segmentation

start

Page 30: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: algorithm• Greedy algorithm for optimal segmentation

start

Page 31: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: algorithm• Greedy algorithm for optimal segmentation

start

good

Page 32: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: algorithm• Greedy algorithm for optimal segmentation

start

Page 33: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: algorithm• Greedy algorithm for optimal segmentation

start

good

Page 34: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: algorithm• Greedy algorithm for optimal segmentation

start

Page 35: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: algorithm• Greedy algorithm for optimal segmentation

start

good

Page 36: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: algorithm• Greedy algorithm for optimal segmentation

start

Page 37: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: algorithm• Greedy algorithm for optimal segmentation

start

not good

Page 38: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: algorithm• Greedy algorithm for optimal segmentation

start

goodnot good

Page 39: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: algorithm• Greedy algorithm for optimal segmentation

start

goodnot good

Binary search here for the last good vertex

Page 40: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: algorithm• Greedy algorithm for optimal segmentation

start

Binary search here for the last good vertex

good

not good

Page 41: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: algorithm• Greedy algorithm for optimal segmentation

start

Decide precisely where on the edge the end is

good

not good

Page 42: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: algorithm• Greedy algorithm for optimal segmentation

We have found a maximal segment

Page 43: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: algorithm• Greedy algorithm for optimal segmentation

We have found a maximal segment; iterate

start

Page 44: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: algorithm• Suppose we have an algorithm for Test(s,vi), which tests

whether the subtrajectory from s to vi is good or not

• Suppose we have an algorithm for Furthest(s,vj), which

returns the furthest point on the edge vj-1vj

Page 45: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: algorithm1. while s ≠ vn

2. {3. a = 1;4. while ( i+a ≤ n && Test(s,vi+a) )5. { a = 2a; }

6. j = binary search in [ i+a/2, min(i+a,n) ] such that Test(s,vj-1) = true && Test(s,vj) = false

7. q = Furthest(s,vj)

8. Accept the subtrajectory from s to q as the next segment9. s = q; i = j – 110. }

Page 46: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: algorithm• Assume that Test runs in T(m) time and Furthest in F(m) time

on a subtrajectory with m vertices• Then optimal segmentation takes O( T(n) log n + F(n) ) time

• For almost all criteria we have, T(n) = F(n) = O(n)

optimal segmentation takes O( n log n ) time

Page 47: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: more attributes• Curvature

3-point estimators

• Sinuosity– Detour– Winding

• Curviness

Page 48: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: more attributes• Curvature

3-point estimators

• Sinuosity– Detour– Winding

• Curviness

Page 49: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: more attributes• Curvature

3-point estimators

• Sinuosity– Detour: arc-length divided by distance– Winding: angular range of heading

• Curviness: total angular change

in some neighborhood

Absolute or relative criteria specify bounds on the attribute values

Page 50: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation• For any logical combination (conjunction, disjunction) for all

criteria given, we can compute an optimal segmentation in O(n log n) time, for a trajectory with n vertices

we just combine the outcome of the different Test and Furthest functions of each criterion

Page 51: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: algorithmic approach• Formalize the problem at hand using well-defined concepts

before thinking about solutions

• Try to ensure that the problem statement is such that the output has guaranteed properties that can be proved– Guarantees in within-segment similarity– Guarantee on number of segments (minimum)

• Search for the most efficient (scalable) algorithm– Proof of running time

Page 52: Trajectory Segmentation Marc van Kreveld. Algorithms Researchers … … want their problems to be well-defined (fully specified) … care about efficiency

Segmentation: what’s next?• Can we make the criteria more robust, to deal with

real-World data?

• Can we extend the approach to include criteria for the environment in the segmentation?

• Can behavioral characteristics indeed be stated as combinations of criteria based on basic attributes?

Possibly, but not easily

Probably

Unknown