nwojke / deep_sort

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

Is it a mistake in your kalman_filter.py 's code ? #44

Closed Warden7 closed 6 years ago

Warden7 commented 6 years ago

Hi ,

Thanks for your code. I tried to make a better understand your code with some source of kalman filter. On the line of 184 of kalman_filter.py:

184 new_covariance = covariance - np.linalg.multi_dot(( kalman_gain, projected_cov, kalman_gain.T))

I can't understand it well.Because it seems conflict with my resource of kalman filter.

image

Can you make some explanation ? thx

nwojke commented 6 years ago

Sorry for the late respone. There are different versions of the Kalman filter which are equivalent but have different numerical properties (compare, e.g., the German and English version of Wikipedia here and here; the unscented Kalman filter in Wikipedia also uses the former one used in the deep_sort code).

nwojke commented 6 years ago

I close this for now; re-open if you have open questions.

mazatov commented 5 years ago

I just came across the same issue and just wanted to clarify your answer @nwojke . It looks like you use the German definitions to calculate Kalman gain and the new estimates for new_mean and new_covariance. I couldn' find anything on the source of the difference.

nwojke commented 5 years ago

I'd say don't worry to much about the different Kalman filter implementations. With the implemented models, I don't think you will run into numerical issues with either version. Cholesky is faster than taking the inverse and numerically stable.

mazatov commented 5 years ago

After doing some math with matrices yesterday, I think the two implementations are actually the same. Some equations simplified once you consider covariance matrix being symmetric. That's cool about Cholesky being faster, very useful tip!

ZouJiu1 commented 1 year ago

it's helpful