visionlabels / motrack

Tools for Multiple Object Tracking experiments
https://visionlabels.github.io/motrack/
GNU General Public License v3.0
8 stars 2 forks source link

Allow speed to be dynamically set for each object and timeframe #17

Closed fidadoma closed 3 years ago

fidadoma commented 3 years ago

In current version of motrack package, the speed is constant for all objects. This disallows changes in velocity during tracking. I was thinking about it and there could be two additional settings parameters:

Both seettings could be combined, e.g.:

in function make_random_trajectory, we would set the correct speed settings. This would extend the possibility of the package and keep the existing code working (as the default would be constant speed)

What do you think? I could do it over the weekend

jirilukavsky commented 3 years ago

Thanks for suggestions. The current version already allows for different (yet constant) speeds per object. The function make_random_trajectory checks the starting position tibble parameter (start) for speed column (where you can specify them). If there is none, it takes the values from settings$speed, which is usually a single constant, but a vector with the same number of objects would work fine (another way how to specify them).

It might be fine to have variable speeds, however, I think this should be more nuanced. Usually you would like to limit the acceleration/deceleration to some reasonable ranges. Sampling consecutive speeds independently from normal distribution could lead to pronounced jumps/stops.

However, this could be likely solved with a custom step function - you can pass extra columns in the moment/moment_next tibbles and thus retain information between frames (like ttt in step_zigzag function).

fidadoma commented 3 years ago

yes, adding it as parametr to moment could work, but you would need to add some "queue" parameter to slice speeds for individual frames and it would be limited to only new functions. The usage of speed needs to be finetuned, the rnorm example was just a quick dirty way how to show the specification. For example I played with the cosine function (rescaled to 0-5), which should work fine.

jirilukavsky commented 3 years ago

I am open to general solution, however I don't think hard-wiring a cosine (or any single function) is sustainable.

jirilukavsky commented 3 years ago

Solved in https://github.com/jirilukavsky/motrack/commit/a37821687d3a8e744cb29138b5b2bf325d6f90ff Example also in README.md