tensorturtle / classy-sort-yolov5

Ready-to-use realtime multi-object tracker that works for any object category. YOLOv5 + SORT implementation.
GNU General Public License v3.0
110 stars 29 forks source link

Can I get some advice on the kf factor? #15

Closed YoungjaeDev closed 2 years ago

YoungjaeDev commented 2 years ago

Hello There is a wide range of possibilities open for tracking targets to move slowly(usually), to stop(usually), or to move quickly(somtimes) And there are times when can turn suddenly with a camera I know about each parameter in detail? Q[-1,-1] is said to reduce the width of moving, but if look at other sources, there are times when set it to 0.01 not 0.5 Can I get advice from someone I know? Thank you!

https://github.com/tensorturtle/classy-sort-yolov5/blob/4778dcf91300d212fc3c72500f4a364bf931abdd/sort/sort.py#L119-L123

tensorturtle commented 2 years ago

If you want to understand Kalman Filters and what those parameters actually do, see https://filterpy.readthedocs.io/en/latest/kalman/KalmanFilter.html and https://nbviewer.org/github/rlabbe/Kalman-and-Bayesian-Filters-in-Python/blob/master/table_of_contents.ipynb .

Beyond the comments, I can't give you much practical advice- I myself just manually experimented with my use case.

For more info, I recommend asking on https://github.com/abewley/sort , where the code comes from.

YoungjaeDev commented 2 years ago

@tensorturtle

So one thing I'm curious about is if the variable below is higher than 10, does it mean that the value of variance is high, so it focuses more on the value of kf predict?

self.kf.R[2:,2:] *= 10. # R: Covariance matrix of measurement noise (set to high for noisy inputs -> more 'inertia' of boxes')
tensorturtle commented 2 years ago

@youngjae-avikus Intuitively you are correct. 10 is an arbitrarily set (empirically determined) number here. A higher value here would compensate for a noisy sensor, at the expense of not being as sensitive to quick changes in the actual object's movement.

YoungjaeDev commented 2 years ago

@tensorturtle

Aha. In other words, if more confident with the detection bbox coord, can I lower it than 10?

tensorturtle commented 2 years ago

@youngjae-avikus Yes that's the right direction.