neuroinformatics-unit / movement

Python tools for analysing body movements across space and time
http://movement.neuroinformatics.dev
BSD 3-Clause "New" or "Revised" License
91 stars 7 forks source link

Smooth trajectories using Kalman filters #10

Open niksirbi opened 1 year ago

niksirbi commented 1 year ago

@joacorapela showed me some really neat ways of filtering and smoothing trajectories (position, velocity, and acceleration). It is based on linear dynamical systems and Kalman filters, deals nicely with missing data, and also works in real-time (for closed-loop experiments). Joaquin's implementation currently lives in this repo. I plan to port some of the classes and functions to movement, and implement them as an option for preprocessing tracks.

niksirbi commented 1 year ago

A great resource on Kalman filters: https://www.kalmanfilter.net/ I could base the implementation (and the variable names) on that.

niksirbi commented 1 year ago

Some preliminary work in the kalman-filter branch

niksirbi commented 11 months ago

Check out:

niksirbi commented 5 months ago

@BenDichter made me aware of this pull request to add Kalman filter to scikit-learn (10 years ago!). Scikit-learn devs opted to not add it, for various reasons given in that PR. That's how the pykalman package got born actually. The discussion there is absolutely worth a read!

niksirbi commented 4 months ago

Also check out the implementation in sort (for tracking bounding boxes).

niksirbi commented 3 weeks ago

In discussion today, @edeno mentioned that a linear Newtonial Kalman Filter may be insufficient, because it will have some lags, and suggested using an Extended Kalman Filter.

He also mentioned dynamax as a good repository of implementations for probabilistic state-space models.

niksirbi commented 17 hours ago

Also check https://nfoursid.readthedocs.io/en/latest/source/kalman.html which is wrapped in darts