026f50810338195530d07198c9b61014d792645f
[mtp.git] / README.txt
1
2                      Multi-Tracked Paths (MTP)
3                      -------------------------
4
5 * INTRODUCTION
6
7 This is a very simple implementation of a variant of the k-shortest
8 paths algorithm (KSP) applied to multi-target tracking, as described
9 in
10
11   J. Berclaz, E. Turetken, F. Fleuret, and P. Fua. Multiple Object
12   Tracking using K-Shortest Paths Optimization. IEEE Transactions on
13   Pattern Analysis and Machine Intelligence (TPAMI), 33(9):1806-1819,
14   2011.
15
16 This implementation is not the reference implementation used for the
17 experiments presented in this article.
18
19 * INSTALLATION
20
21 This software should compile with any C++ compiler. Under a unix-like
22 environment, just execute
23
24   make
25   ./mtp_example
26
27 It will create a synthetic dummy example, save its description in
28 tracker.dat, and print the optimal detected trajectories.
29
30 If you now execute
31
32   ./mtp tracker.dat
33
34 It will load the file tracker.dat saved by the previous command, run
35 the detection, save the detected trajectories in result.trj, and the
36 underlying graph with occupied edges in graph.dot.
37
38 If you do have the graphviz set of tools installed, you can produce a
39 pdf from the latter with the dot command:
40
41   dot < graph.dot -T pdf -o graph.pdf
42
43 * IMPLEMENTATION
44
45 The two main classes are MTPGraph and MTPTracker.
46
47 The MTPGraph class contains a directed acyclic graph (DAG), with a
48 length for each edge -- which can be negative -- and has methods to
49 compute the family of paths in this graph that globally minimizes the
50 sum of edge lengths.
51
52 If there are no path of negative length, this optimal family will be
53 empty, since the minimum total length you can achieve is zero. Note
54 that the procedure is similar to that of KSP, in the sense that the
55 family it computes eventually is globally optimal, even if the
56 computation is iterative.
57
58 The MTPTracker is defined by
59
60  (1) a spatial topology composed of
61
62      - a number of locations
63
64      - the allowed motions between them (a Boolean flag for each pair
65        of locations from/to)
66
67      - the entrances (a Boolean flag for each location and time step)
68
69      - the exits (a Boolean flag for each location and time step)
70
71  (2) a number of time steps
72
73  (3) a detection score for every location and time, which stands for
74
75              log( P(Y(l,t) = 1 | X) / P(Y(l,t) = 0 | X) )
76
77      where Y is the occupancy of location l at time t and X is the
78      available observation.
79
80 From this setting, MTPTracker has methods to compute the best set of
81 disjoint trajectories consistent with the defined topology, which
82 maximizes the overall detection score (i.e. the sum of the detection
83 scores of the nodes visited by the trajectories). If no trajectory of
84 total positive detection score exists, this optimal set of
85 trajectories will be empty.
86
87 The MTPTracker is a wrapper around the MTPGraph class. From the
88 defined spatial topology and number of time steps, it builds a graph
89 with one source, one sink, and two nodes per location and time. The
90 edges from the source or to the sink, or between these pairs of nodes,
91 are of length zero, and the edges between the two nodes of such a pair
92 have negative lengths, equal to the opposite of the corresponding
93 detection scores. This structure also ensures that the trajectories
94 computed by the MTPTracker will be node-disjoint, since the
95 trajectories computed by the MTPGraph are edge-disjoint.
96
97 The file mtp_example.cc gives a very simple usage example of the
98 MTPTracker class by setting the tracker parameters dynamically, and
99 running the tracking.
100
101 The tracker data file for MTPTracker::read has the following format,
102 where L is the number of locations and T is the number of time steps:
103
104 ---------------------------- snip snip -------------------------------
105   int:L int:T
106
107   bool:allowed_motion_from_1_to_1 ... bool:allowed_motion_from_1_to_L
108   ...
109   bool:allowed_motion_from_L_to_1 ... bool:allowed_motion_from_L_to_L
110
111   bool:entrance_1_1 ... bool:entrance_1_L
112   ...
113   bool:entrance_T_1 ... bool:entrance_T_L
114
115   bool:exit_1_1 ... bool:exit_1_L
116   ...
117   bool:exit_T_1 ... bool:exit_T_L
118
119   float:detection_score_1_1 ... float:detection_score_1_L
120   ...
121   float:detection_score_T_1 ... float:detection_score_T_L
122 ---------------------------- snip snip -------------------------------
123
124 The method MTPTracker::write_trajectories writes first the number of
125 trajectories, followed by one line per trajectory with the following
126 structure
127
128 ---------------------------- snip snip -------------------------------
129   int:traj_number int:entrance_time int:duration float:score int:location_1 ... int:location_duration
130 ---------------------------- snip snip -------------------------------
131
132 --
133 François Fleuret
134 October 2012