Quiz: motion models and the Kalman filter
Before this unit: From detections to tracks (previous unit); Day 14: Labelling; Day 20: Point detection.
See also: The multivariate Gaussian & mixtures (day 35); Day 23: FFT registration; Day 16: Measurements; Day 38: Evaluation and statistics; Day 35: Gaussian mixtures.
Short questions to test your understanding. Try each on paper first, then open the answer.
Q1. Why does linking to the predicted position help when two fast particles cross?
Where is each particle at the next frame, compared with where it was?
Near the crossing, each particle’s next position can be closer to the other particle’s last position: linking to last positions swaps them. Each particle’s predicted position (last position + velocity × Δt) lies near its own next detection, so the right link is also the cheapest.
Q2. In the predict step, what happens to the estimate and to its uncertainty? Why does the uncertainty grow?
The model is not perfect.
The estimate moves as the model says (random walk: stays; constant velocity: moves by velocity × Δt). The uncertainty grows by the process noise Q, because the real motion deviates from the model: the longer we predict without a measurement, the less sure we are.
Q3. Prediction 20 with variance 9, measurement 26 with variance 3. Compute the gain, the new estimate and its variance.
K = P^-/(P^- + R).
K = 9/12 = 0.75. Estimate 20 + 0.75 \cdot 6 = 24.5. Variance (1 - 0.75) \cdot 9 = 2.25, smaller than both 9 and 3. The estimate is closer to the measurement, because the measurement is the more certain of the two.
Q4. In a constant-velocity filter only positions are measured. How can the filter know the velocity?
What does a wrong velocity do to the next predicted position?
A wrong velocity makes the predicted position wrong in the next frame. The prediction step makes position and velocity uncertainties correlated, so the update corrects the velocity in the direction of the position surprise. After a few frames the velocity estimate locks on to the true velocity.
Q5. A detection is missed for two frames. What does the filter do, and what happens to the gate?
No measurement, no update.
It skips the update and predicts again in each missed frame. The uncertainty grows each time (by Q, and for constant velocity also through the velocity uncertainty), so the gate around the prediction grows: a detection farther away is still accepted when the object reappears.
Q6. A filter lags behind every time the object turns. Should you increase Q or R? What is the price?
Lag means the filter trusts the model too much.
Increase Q (or decrease R; only the ratio matters for the gain). The gain rises, so the filter follows the measurements faster after a turn. The price: on straight stretches it follows the measurement noise more, and its gates are wider.
Q7. Two tracks have the same distance (5 px) to a detection. Track 1 has a predicted standard deviation of 5 px, track 2 of 1.5 px. Which is inside a 3σ gate?
Measure the distance in standard deviations.
Track 1: 5/5 = 1σ, well inside. Track 2: 5/1.5 = 3.3σ, outside a 3σ gate. The same distance is likely for an uncertain track and unlikely for a well-predicted one: that is what the Mahalanobis distance captures.
Q8. (math) Show that for a random-walk filter with Q = R the steady-state gain is (\sqrt5 - 1)/2.
At the steady state P^- = P^-R/(P^- + R) + Q.
With Q = R = 1: P^- = P^-/(P^- + 1) + 1, so P^-(P^- + 1) = P^- + P^- + 1, i.e. (P^-)^2 - P^- - 1 = 0 and P^- = (1 + \sqrt5)/2 \approx 1.618. Then K = P^-/(P^- + 1) = 1.618/2.618 = (\sqrt5 - 1)/2 \approx 0.618. For general Q = R the same follows after dividing by R.