Data Association

Every filter so far knew which measurement came from which target. A real sensor sends an unlabelled cloud with false alarms in it. In this toy, with 10 false alarms a frame, hard nearest neighbour loses a track in 16 of 100 runs; soft JPDA loses 3.

Pick a method and watch two targets cross through clutter. Raise the clutter and replay. Then we build each method piece by piece: the gate, nearest neighbour, the optimal assignment, PDA, JPDA and MHT.

You need the Kalman filter from Lesson 5, in particular the innovation and its covariance S. We build the rest from zero.

Lesson 12 of 22 in Sensor Fusion: Classical to Modern. Before: Covariance Intersection. Next: IMU and Inertial Navigation.

Keep two tracks on two targets

10

Toy simulation, illustrative: a 60 m by 40 m field, 60 frames, sensor noise 1 m, a 20% chance to miss each target each frame. The 100-run counts come from this same simulation with seeds 1 to 100.

Chapter 0

The Question Every Filter Skipped

See why a tracker must pair measurements with targets before it can fuse anything

A radar watches five aircraft. Each sweep it returns a list of blips with no names on them. Some blips are aircraft. Some are rain or birds. One aircraft gave no blip at all this sweep.

The Kalman filter in Lesson 5 took one measurement z and fused it. It never asked which target z came from. Data association is the step that answers that question: it pairs each measurement with a track, or calls it clutter. It runs before every update.

Guess which dot is which

Two tracks predict where their targets will be. The ellipse around each is its gate. Guess the owner of each dot, then press Show the truth.

Illustrative toy: the sensor detects each target with probability 0.9, and 4 to 8 false alarms fall at random.

Three problems arrive together.

ProblemWhat happensWhat it costs
ClutterA false alarm is a detection with no target behind it.It can pull a track off course or start a phantom track.
Missed detectionThe probability of detection PD is below 1, so a target can go silent for a frame.The track must coast on its prediction and not die.
AmbiguityTwo targets come close, so one dot fits both gates.A wrong pick swaps the two tracks for good.

The cost of a wrong pairing is high. The filter trusts the pairing completely. It pulls the estimate toward the wrong point, so the next gate is in the wrong place, so the next pick is likely wrong too.

The idea of the lesson. Fusion is two problems. Estimation asks how to update when you know the source. Association asks which source it was, and it comes first. A tracker is only as good as its association.

The road

  1. The gate: measure distance in standard deviations and throw out the impossible.
  2. Nearest neighbour: one track at a time, and how the order breaks it.
  3. Global nearest neighbour: the best pairing for all tracks at once.
  4. PDA: do not pick; weight every candidate, including "none of them".
  5. JPDA: weights for many tracks that respect one owner per dot.
  6. MHT: keep several stories alive and decide later.
  7. Showcase: race the methods through clutter, 100 runs at a time.
  8. Track life: when to start a track, confirm it and delete it.
  9. Debugging: one number that catches bad association.
  10. Field guide: the ladder, the numbers, the code.
Why must data association run before the Kalman update?

Chapter 1

Mahalanobis Distance and the Gate

Measure a miss in standard deviations, and reject a measurement before any pairing starts

A car drives along a lane. Its track is sure of the car's sideways position and unsure how far it went forward. The track's doubt is an ellipse: long along the road, thin across it. A detection 3 m ahead is normal. A detection 3 m to the side is not.

Lesson 5 gave the tools. The track predicts where its measurement should land: the predicted measurement ẑ ("z-hat"). The real measurement z misses it by the innovation ν ("nu"), with ν = z − ẑ. The innovation covariance S says how big a miss to expect in each direction.

Say it aloud

d squared equals nu-transpose, times S-inverse, times nu.

d²
d squared the Mahalanobis distance squared: the miss counted in standard deviations, squared. It has no unit.
νT
nu-transpose the innovation written as a row, so the product gives one number.
S−1
S-inverse the inverse of S. It divides the miss by the expected spread in each direction.
ν
nu the innovation z − ẑ, in metres.
In plain words

Subtract the prediction z-hat from the measurement z to get nu. When S is diagonal, square each part of nu and divide it by the variance S gives that direction. Add the parts. That sum is d squared.

With numbers

With made-up numbers: z-hat = (10, 5) m and S = diag(4, 1) m². The spread is 2 m in x and 1 m in y. For z1 = (13, 5), nu = (3, 0) and d² = 9/4 + 0 = 2.25. For z2 = (10, 7.5), nu = (0, 2.5) and d² = 0 + 6.25/1 = 6.25. z1 is farther in metres but nearer in standard deviations.

If the measurement truly came from this track, d² follows a known curve. It is the chi-square distribution, with one degree of freedom per number in the measurement. So we can choose the share of true measurements to keep, the gate probability PG, and read the threshold off a table.

Say it aloud

d squared is less than gamma.

d²
d squared the Mahalanobis distance squared of one measurement to one track.
<
is less than the test. If it holds, the measurement is inside the gate and becomes a candidate for this track.
γ
gamma the gate threshold, read from the chi-square table for the measurement's dimension and PG.
In plain words

Look up gamma for your measurement's dimension and the share P-G of true measurements you want to keep. Keep a measurement as a candidate only if its d squared is below gamma.

With numbers

A 2-D position with P-G = 0.95 gives gamma = 5.99. z1 at d² = 2.25 is inside. z2 at d² = 6.25 is outside. A circle gate would keep z2 (2.5 m) before z1 (3 m).

Measurement numbersγ at PG = 0.95γ at 0.99γ at 0.999
1 (range only)3.846.6310.83
2 (x, y)5.999.2113.82
3 (x, y, z)7.8111.3416.27

Drag a measurement through the gate

The teal ellipse is the gate. Warm dots are inside; grey rings are outside. Drag the large dot, stretch S and change PG.

4.0 m²

Exact arithmetic for z-hat = (10, 5) m, variance 1 m² in y. The grid lines are 1 m apart.

The gate fails in two ways. Too tight: a target turns, its measurement lands outside, and the track dies (measure how often a true measurement has d² just above γ). Too loose: clutter enters every gate and the pairing work grows. Chapter 9 shows how to tune it.

S = diag(4, 1) and γ = 5.99. Why is (13, 5), 3 m off in x, kept, while (10, 7.5), 2.5 m off in y, is rejected?

Chapter 2

Nearest Neighbour, One Track at a Time

Give each track its closest candidate, and watch the order of the tracks change the answer

The gate leaves each track a short list of candidates. Now each track needs one measurement. The simplest rule is nearest neighbour (NN): give each track the candidate with the smallest d².

Two tracks cannot share one measurement, because one blip has one source. So greedy NN walks the tracks in some order. Each track takes its nearest free candidate and removes it from the pool.

Here is the trap, on a line, with a spread of 1 m for both tracks, so d² is the distance squared. Track A predicts 0 m and track B predicts 2 m. Two measurements arrive: z1 at 1.1 m and z2 at −1.5 m. The 1-D gate at PG = 0.99 is γ = 6.63.

OrderA takesB takesResult
A firstz1, d² = 1.21z2 has d² = 12.25, outside the gate: nothingB coasts; z2 looks like a new target
B firstz2, d² = 2.25z1, d² = 0.81total 3.06, both tracks updated

Change who picks first

Track A is teal, track B purple; each bar is a gate. Drag z1 and z2 along the line, then switch the order.

Illustrative toy: spread 1 m for both tracks, so d² is the distance squared; gate 6.63.

Track A grabbed z1 because it was A's nearest. But B needed z1 more: z1 was B's only candidate. Greedy NN is order-dependent and local: each track ignores the others.

The failure compounds. A wrong pick feeds the wrong point into the Kalman update, so the next gate centres in the wrong place. Symptom: a track jumps onto a clutter dot near another track and stays there. Measure it by counting tracks that end far from any target. Fix: decide all tracks at once (Chapter 3) or stop making hard picks (Chapter 4).

What is the basic weakness of greedy nearest neighbour?

Chapter 3

Global Nearest Neighbour: All Tracks at Once

Fill a cost matrix, then pick the one-to-one pairing with the smallest total

Greedy NN decided track by track. Global nearest neighbour (GNN) decides all tracks together. It writes every track-measurement cost into a table and picks the pairing with the smallest sum. This is the assignment problem.

What should one cell cost? We want the most likely pairing. Call the cost of giving measurement j to track i Cij. A good cost is the negative log of the Gaussian likelihood, because adding logs is the same as multiplying probabilities.

Say it aloud

C-i-j equals one half d-i-j squared, plus one half the log of the determinant of two pi S-i.

Cij
C-i-j the cost of giving measurement j to track i. Lower is more likely.
½
one half from the Gaussian: its exponent is minus one half of d squared.
dij²
d-i-j squared the Mahalanobis distance squared from track i's prediction to measurement j (Chapter 1).
½ ln |2πSi|
one half log det two pi S-i a charge for a wide gate. The bars | | mean the determinant, which grows with the area of the ellipse.
In plain words

Halve the distance d-i-j squared. Add half the log of the size of track i's gate. A wide gate can swallow a big miss cheaply, so the second term charges it for being wide.

With numbers

The Chapter 1 track has S = diag(4, 1), so |2πS| = (2π)² × 4 = 157.9 and half its log is 2.53. For z1, d² = 2.25, so C = 1.125 + 2.53 = 3.66. A track with S = diag(1, 1) and the same d² pays 1.125 + 1.84 = 2.96.

Now choose one measurement per track, never the same one twice. Call that choice the assignment a, so a(i) is the measurement it gives track i.

Say it aloud

J of a equals the sum over i of C-i, a-of-i.

J(a)
J of a the total cost of assignment a. GNN picks the a with the smallest J.
Σi
the sum over i add one term for each track.
Ci, a(i)
C-i, a-of-i the cell in row i, in the column that a chose for track i. No two rows may share a column.
In plain words

Pick one cell in each row, each in a different column. Add the picked cells to get J. Try every legal pick and keep the one with the smallest J.

With numbers

Take the "greedy trap" matrix below. Smallest cell first gives A→z1 (1), C→z3 (3), B→z2 (7): J = 11. The pairing A→z2 (2), B→z1 (2), C→z3 (3) gives J = 7.

Beat the greedy pick

Rows are tracks, columns are measurements. The dashed yellow cells are the greedy pick (smallest cell first); the green cells are the best total. Click a cell to raise its cost.

The best total comes from checking all 6 pairings, which is what the Hungarian algorithm returns. Every cost is a made-up d² value.

Trying every pairing grows as n!: 6 for 3 tracks, 3.6 million for 10. The Hungarian algorithm (Kuhn and Munkres) finds the same best pairing in about n³ steps. In Python it is scipy.optimize.linear_sum_assignment.

Real frames are not square. Add one dummy column per track with the cost of a miss, and one dummy row per measurement with the cost of clutter. A track that lands in its dummy column coasts. A measurement in a dummy row may start a new track. A pair outside the gate gets a huge cost.

For the matrix rows A, B, C = [1, 9, 4], [4, 2, 8], [7, 3, 2], what does GNN return?

Chapter 4

PDA: Weight, Do Not Pick

Give every candidate a probability, keep one for "none of them", and update with the blend

A track has two dots in its gate, and either could be the target. NN and GNN must throw one away. Probabilistic data association (PDA), from Bar-Shalom and Tse (1975), keeps both and weights each by how likely it is to be the target.

For each candidate i, PDA needs its likelihood Li: the Gaussian density at its innovation, exp(−di²/2) divided by √|2πS|. It also needs the clutter density λ ("lambda"), the false alarms per square metre per frame.

Say it aloud

beta-i equals P-D times L-i, over: lambda times one minus P-D P-G, plus P-D times the sum over j of L-j.

βi
beta-i the association probability: the chance that candidate i is the target's measurement.
PD
P-D the probability of detection, here 0.9.
Li
L-i the likelihood of candidate i: large near the prediction, small at the gate edge. Unit: per square metre.
λ
lambda the clutter density, false alarms per square metre per frame.
PG
P-G the gate probability. 1 minus P-D P-G is the chance the target put nothing in the gate.
Σj Lj
the sum over j of L-j the likelihoods of all candidates in the gate, added.
In plain words

Score each candidate: P-D times its likelihood L-i. Score the clutter story: lambda times the chance that the target gave nothing in the gate. Divide candidate i's score by the sum of all the scores.

With numbers

With made-up numbers: d² = 1 and 4, and √|2πS| = 10, so L1 = 0.0607 and L2 = 0.0135. With P-D = 0.9, P-G = 0.99 and lambda = 0.02, the clutter score is 0.02 × 0.109 = 0.00218. The candidate scores are 0.0546 and 0.0122. All three sum to 0.0689. beta-1 = 0.0546/0.0689 = 0.792 and beta-2 = 0.177.

The clutter story gets its own weight, β0 ("beta-zero"): the chance that none of the candidates is the target.

Say it aloud

beta-zero equals lambda times one minus P-D P-G, over the same sum as before.

β0
beta-zero the chance that every candidate is clutter and the target went undetected or fell outside the gate.
λ(1 − PDPG)
lambda times one minus P-D P-G the clutter story's score.
denominator
the same sum all scores added, so beta-zero plus every beta-i equals 1.
In plain words

Divide the clutter story's score by the total. Far candidates or dense clutter make beta-zero grow.

With numbers

Same numbers: beta-zero = 0.00218/0.0689 = 0.032. Check: 0.792 + 0.177 + 0.032 = 1, after rounding. Move both candidates to d² = 8 and beta-zero rises to 0.40.

Call the innovation of candidate i νi. PDA blends them into one combined innovation ν̄ ("nu-bar").

Say it aloud

nu-bar equals the sum over i of beta-i times nu-i.

ν̄
nu-bar the combined innovation the Kalman update uses: x-hat = x-hat-minus + K nu-bar.
Σi
the sum over i one term for each candidate in the gate.
βi
beta-i candidate i's association probability.
νi
nu-i candidate i's innovation, z-i minus z-hat, in metres.
In plain words

Multiply each innovation nu-i by its beta-i and add. Beta-zero multiplies nothing, so a large beta-zero shrinks the step and the track coasts.

With numbers

Say S is round with a spread of 1.26 m each way, which makes √|2πS| = 10. Then nu1 = (1.26, 0) m and nu2 = (0, 2.52) m. nu-bar = 0.792 × (1.26, 0) + 0.177 × (0, 2.52) = (1.00, 0.45) m.

Drag the candidates, watch the weights

Drag z1 and z2 inside the teal gate. The bars show beta-1, beta-2 and beta-zero; the pink arrow is nu-bar. Raise the clutter density.

0.020

Exact PDA weights with PD = 0.9, PG = 0.99 and the round S above; positions are illustrative.

PDA also widens the track's covariance by the spread of the candidates, so an ambiguous frame leaves the track less sure. Its failure: it sees one track alone, so two close tracks can both weight one dot heavily and drift together.

What does beta-zero stand for, and why does it make PDA robust?

Chapter 5

JPDA: One Measurement, One Owner

Score whole joint stories for all tracks, so two tracks cannot both claim one dot

Two tracks close in on each other. A dot z1 sits between them, inside both gates. Single-track PDA lets track A weight z1 heavily and lets track B weight it heavily too. Both tracks move toward z1 and can merge into one. This is track coalescence.

Joint PDA (JPDA), from Fortmann, Bar-Shalom and Scheffe (1983), reasons about all close tracks together. It lists every joint event: a complete hand-out of the measurements that obeys two rules.

  1. Each measurement has at most one source.
  2. Each track makes at most one measurement per frame.

Score each pairing by how much better the target explains it than clutter: PD L / λ. Score each track left empty 1 − PDPG. An event's probability P(E) is the product of its scores, divided by the total over all legal events.

Say it aloud

beta-t-j equals the sum, over every joint event E that gives measurement j to track t, of P of E.

βt,j
beta-t-j the chance that track t owns measurement j, after JPDA weighs all tracks together.
ΣE : t→j
the sum over events E that give j to t add only the legal events with that pairing.
P(E)
P of E the probability of joint event E: the product of its pairing scores and empty-track scores, divided by the total.
In plain words

List every legal way to hand out the dots. Score each one. To get beta-t-j, add the scores of the events where track t owns dot j, and divide by the total of all scores.

With numbers

With made-up scores: A→z1 is 4, A→z2 is 2, B→z1 is 8, an empty track is 0.109. The total over the five events below is 17.54. beta for A→z1 = 0.436/17.54 = 0.025. Single-track PDA gave A→z1 4/(0.109 + 4 + 2) = 0.65.

EventA getsB getsScore
E1z1nothing4 × 0.109 = 0.436
E2z2z12 × 8 = 16
E3z2nothing2 × 0.109 = 0.218
E4nothingz10.109 × 8 = 0.872
E5nothingnothing0.109 × 0.109 = 0.012

"A gets z1 and B gets z1" is missing: it breaks rule 1. That missing row is the whole fix. Because B explains z1 much better, A moves its weight to z2.

Share one dot between two tracks

Track A is teal, track B purple. Drag the contested dot z1 between them and switch between PDA and JPDA. Arrow thickness is the weight.

Illustrative toy on a line: spread 1 m, PD = 0.9, PG = 0.99, λ = 0.05 per metre.

The cost is the event count. It grows faster than exponentially with the tracks and dots in one cluster. Real JPDA only reasons jointly over tracks whose gates overlap, and approximates large clusters.

What does JPDA add to PDA, and what problem does it solve?

Chapter 6

MHT: Decide Later

Keep competing stories in a tree, let later frames vote, and prune the tree to fit the budget

A dot appears between a track and empty space. It could extend the track or start a new target. Two frames later the answer is often obvious. Every method so far must decide now.

Multiple hypothesis tracking (MHT), from Reid (1979), does not. A hypothesis is one full story of who made which dot, over all frames so far. At each ambiguous frame, every hypothesis splits into its options. Each branch carries a score built from the same likelihoods and clutter scores as JPDA.

Grow the tree, then prune it

Each ambiguous frame doubles the leaves. The teal path is the true story. Add frames, then lower K, the number of hypotheses kept.

32

Illustrative scores: each frame the true branch is more likely on average, but not every frame.

Unpruned, the tree doubles with each ambiguous frame: 210 = 1,024 leaves after 10 frames. MHT works only because of pruning.

RuleWhat it does
K bestKeep the K highest-scoring hypotheses each frame.
RatioDelete a hypothesis far less likely than the best one.
N-scanCommit to the best story for frames older than N. N = 1 is close to a per-frame method.
MergeJoin hypotheses whose recent pairings are the same.

Prune too hard and the true story dies early. Symptom: a track swap that a later frame should have fixed. Measure it by checking how often pruning cuts the true hypothesis in replayed data. Fix: raise K or N until the swaps stop or the time budget runs out.

Reid's original form lists global hypotheses. Most modern trackers use track-oriented MHT: they keep a tree per track and rebuild the best global story each frame with an assignment solve.

What is the core idea of MHT, and what keeps it affordable?

Chapter 7

Showcase: Two Targets Cross in Clutter

Run nearest neighbour, global NN and JPDA on the same scene, then on 100 scenes

Two targets fly right while their paths cross in the middle of the field. Each frame the sensor reports each target with probability PD, plus random false alarms. Two Kalman tracks follow them with a constant-velocity model, a 99% gate and the method you choose.

A track fails in one of two ways. It is lost if it ends more than 4 m from its target. The pair has swapped if the two tracks end on each other's targets.

Run one scene

Choose a method, set the clutter and the miss rate, and press Run. The lower plot is each track's error in metres.

14
0.20

Toy simulation, illustrative; the same engine as the hero.

One run can be lucky. Run 100 scenes with the same settings and count failures.

Count failures over 100 scenes

Each bar counts failed runs out of 100 at the clutter and miss rate set above. Press Run 100 scenes after you change them.

Seeds 1 to 100, fixed, so the counts repeat.

False alarms per frame (miss rate 0.2)NN failedGNN failedJPDA failed
6530
1016123
1421216

With no clutter all three methods nearly tie. That is the trap: a clean test hides the failure. Hard methods fail when a false alarm lands in a gate while the true dot is missing; they must take it. JPDA gives that dot a small weight and keeps most of the weight on "none of them".

The habit to keep. Test association under clutter, misses and crossings, over many seeds. A single clean run says nothing.
In this toy, why does JPDA fail far less often than NN when clutter is high?

Chapter 8

Birth, Confirmation and Death

Start a track on a hunch, confirm it on evidence, and delete it after silence

A dot pairs with no track. It may be a new target. It may be a false alarm. If every such dot starts a permanent track, the screen fills with phantoms. If none does, new targets are never tracked.

The standard answer is a small state machine with an M-of-N rule.

  1. An unpaired dot starts a tentative track.
  2. If the tentative track gets a dot in at least M of its first N frames, it becomes confirmed and gets a public ID.
  3. If not, delete it.
  4. Delete a confirmed track that coasts with no dot for too many frames in a row.

Set M and test a candidate

The boxes are a candidate's first 5 frames; filled means a dot paired. Choose the source, set M, and press New candidate. The bars give the exact chance of confirmation.

3

Illustrative rates: a real target pairs each frame with probability 0.9; a false alarm lands in the same gate again with probability 0.1. Frame 1 always counts as a hit.

Worked number for 3 of 5. Frame 1 is a hit, so the candidate needs 2 more hits in 4 frames. A real target with PD = 0.9 manages that 99.6% of the time. A clutter spot that recurs 10% of the time manages it 5.2% of the time. At 5 of 5, real targets also fail 34% of the time.

The knobs, in the order you set them

KnobStart atIf too smallIf too large
Gate PG0.99 (γ = 9.21 in 2-D)true dots fall outside; tracks breakclutter enters; more pairing work
Clutter λcount false alarms per area over many framesPDA trusts clutterbeta-zero wins; the track lags
Methodgated GNNswaps and clutter capturecompute you do not need
M of N3 of 5phantom tracksnew targets confirm late or never
Coast limita few frames, longer for low PDtracks die in short occlusionsdead targets linger

Pick the method by the scene. Far-apart targets and sparse clutter: gated GNN. Gates that overlap often: JPDA. Dense targets, low PD and swaps you cannot afford: MHT. To save compute, group tracks whose gates overlap and run the expensive method only on those groups.

A tracker keeps creating permanent tracks on clutter. Which mechanism stops this?

Chapter 9

Debugging With the Innovation

Plot the d squared the gate already computes, and read the failure from its shape

Association bugs do not crash. The filter fuses the wrong dot, and the error shows up later in the estimate. The best detector costs nothing: the gate already computes d² for the dot each track used.

Logged over time, that number is the normalized innovation squared (NIS). For a healthy 2-D track it follows a chi-square curve with mean 2. About 1 frame in 100 lands above 9.21.

Break a track, read its NIS

Pink dots are the NIS each frame. The dashed line is the mean of 2; the solid line is the gate at 9.21. Turn on a fault and compare.

Illustrative toy: a constant-velocity track, 2-D position measurements with 1 m noise, seed fixed.

FailureSymptomHow to measure itFix
Track swapIDs right before a crossing, wrong aftercount ID switches against ground truthJPDA or MHT; add an appearance cost
Broken trackone target gets many short trackstrue dots with d² just above γraise PG; make sure S grows after a miss
Phantom trackmore tracks than targetsconfirmed tracks against true countlower PG; raise λ; stricter M of N
Poisoned trackdrifts off and stays off, with a small covarianceNIS high for many framessoft association; check Q and R

Broken and phantom tracks pull in opposite directions. Tighten the gate to kill phantoms and you start breaking real tracks. That is why PG is the first knob to tune, with the NIS plot open.

A track drifts off and never recovers, yet its covariance stays small. How do you detect it?

Chapter 10

Field Guide

Keep the ladder, the numbers, the checklist and the code in one place

Gate first, always. Then pick the rung of the ladder that matches the scene. The rungs run from hard and local to deferred.

MethodDecisionScopeClutterCostBest for
NNhardone track at a timepoortinysparse, far-apart targets
GNNhardall tracks, best per framegate onlyabout n³real-time multi-object tracking
PDAsoft (β)one trackgood (β0)lowone target in clutter
JPDAsoft (β)all close tracksgoodgrows fast with cluster sizeclose targets plus clutter
MHTdeferreda tree over framesbesthighestdense targets, low PD, no swaps allowed

Terms and numbers

TermMeaningNumber to remember
Innovation νz minus the predicted measurementmetres
Mahalanobis d²νT S−1 ν, the miss in standard deviations, squared(3, 0) with S = diag(4, 1) gives 2.25
Gate γkeep a dot if d² < γ2-D: 5.99 (95%), 9.21 (99%)
Cost Cij½ d² + ½ ln|2πS|greedy trap: 11 against 7
βi, β0chance dot i is the target; chance none is0.792, 0.177, 0.032
Joint eventa legal hand-out of dots to tracksA→z1 falls from 0.65 to 0.025
M of Nconfirm after M hits in N frames3 of 5: 99.6% targets, 5.2% clutter
NISd² of the dot used, over timemean = measurement dimension

Checklist

  1. Gate with d² and a chi-square γ, never with metres.
  2. Make sure S grows during prediction and after a miss.
  3. Build costs from ½ d² + ½ ln|2πS|; pad with miss and clutter costs.
  4. Solve with the Hungarian algorithm, not greedy picks.
  5. Move to JPDA when gates overlap; to MHT when swaps are not allowed.
  6. Confirm with M of N; delete after a coast limit.
  7. Log NIS per track and test under clutter, misses and crossings over many seeds.
pythonimport numpy as np
from scipy.optimize import linear_sum_assignment

def gnn_assign(tracks, meas, gamma=9.21, big=1e6):
    # tracks: list of (z_hat, S); meas: list of z. Returns (track, meas) pairs.
    C = np.full((len(tracks), len(meas)), big)        # default: outside the gate
    for i, (z_hat, S) in enumerate(tracks):
        Si = np.linalg.inv(S)
        for j, z in enumerate(meas):
            nu = z - z_hat
            d2 = nu @ Si @ nu                          # Mahalanobis distance squared
            if d2 < gamma:
                C[i, j] = 0.5 * d2 + 0.5 * np.log(np.linalg.det(2 * np.pi * S))
    rows, cols = linear_sum_assignment(C)                 # Hungarian: smallest total
    return [(r, c) for r, c in zip(rows, cols) if C[r, c] < big]

def pda_betas(d2, S, P_D=0.9, P_G=0.99, lam=0.02):
    L = np.exp(-0.5 * d2) / np.sqrt(np.linalg.det(2 * np.pi * S))  # likelihoods
    clutter = lam * (1 - P_D * P_G)                     # the "none of them" score
    denom = clutter + P_D * L.sum()
    return clutter / denom, P_D * L / denom           # beta0, beta_i: they sum to 1

# nu_bar = sum_i beta[i] * nu[i];  x = x_pred + K @ nu_bar;  then widen P by the spread

Where it runs

DomainTrackedUsual method
Air-traffic and defence radaraircraft, contactsJPDA, MHT
Self-driving perceptioncars, people, cyclistsgated GNN with motion, box overlap and appearance costs
Video multi-object trackingpeople, playersSORT and DeepSORT: Kalman plus the Hungarian algorithm
Microscopycells, particlesgated assignment; branching for cell division

SORT (Bewley and others, 2016) is this lesson's GNN: a Kalman filter per track, a cost from box overlap, and the Hungarian algorithm each frame. DeepSORT adds a learned appearance distance and a Mahalanobis gate, so a track can find its target again after an occlusion.

Keep going

References

The takeaway. Gate in standard deviations. Pair globally, or weight softly with a share for "none of them". Confirm before you believe. Watch the NIS, and test in clutter.
A colleague picks MHT to track one isolated target in almost no clutter. What is the critique?

Now press Present or Teach and rebuild the ladder from memory. Start with the gate and end with the tree. Then go back to the hero and say why nearest neighbour lost its track.

Credit

Lesson 12 of 22 in Sensor Fusion: Classical to Modern on Engineermaxxing. The methods follow Bar-Shalom and Fortmann (1988) and the original papers above. Every toy number on this page carries the word illustrative.

Sensor Fusion: Classical to Modern · Lesson 12: Data Association
Previous: Covariance Intersection · Next: IMU and Inertial Navigation · Back to Gleams