nwojke / deep_sort

Simple Online Realtime Tracking with a Deep Association Metric
GNU General Public License v3.0
5.16k stars 1.45k forks source link

Clarification regarding the calculation of covariance in Kalman project step #294

Open kgksl opened 1 year ago

kgksl commented 1 year ago

Kalman project method projects the state distribution to measurement space. In my understanding, with this step, the mean and covariance of estimated measurement space is calculated. Now that we have expected distribution for any measurement that should belong to the considered track, we can use this distribution to calculate Mahalanobis distance between the distribution and a point (new detection) to find if the detection belongs to the track.

Screen Shot 2022-07-22 at 11 45 50 am Where m is the Mahalanobis distance between detection/measurement d and estimated mesurement distribution represented by mean mu and covariance S

That is my understanding of how the Mahalanobis distance is calculated in DeepSORT. However I am bit confused about the covariance (S) used in this calculation.

After kalman.project step:

estimated measurement cov = HPH^T + R where P is predicated state covariance, H is measurement/ observation matrix and R is measurement noise covariance.

if we think of observation equation z = Hx + e_m, where x is the true hidden state and e_m is the measurement noise, the above definition of estimated measurement covariance can be justified. However in literature only the term HPH^T is given as the estimated measurement covariance and the HPH^T + R is given as the covariance of the residual z-z^.

Could anyone please shed light on this and also please correct me if my above understanding is not correct. It is possible that authors used the covariance of residual as covariance of measurement as we like to have both estimated and observed measurements on the same space. However it's not very clear to me.