lambdaloop/aniposelib

Triangulation slower with jit decorator

Opened this issue · 3 comments

I noticed that commenting out the "jit" decorator that applies to the "triangulate_simple" function (decorator on line 20, function definition on line 21 of cameras.py) substantially improves the runtime of the code.
For 12 tracked features in a 5 minute video sampled at 100Hz, the runtime was ~6 minutes with the code as is and only ~10s with the decorator commented out.

It might be worth your exploring whether my experience is generalizable, in which case maybe it's better to skip the jit decorators or at least make it clear in what cases the decorator helps vs. hurts!

Hello! I have the same question. Have you got the answer?

My fix was just to fork the repo and import the forked version rather than the main repo (i.e. I just removed the decorator!)

I've done some exploration of this in the Freemocap fork of Aniposelib: freemocap/freemocap#642

What I've found so far is that the fastest option is simply to turn off the parallel flag (set parallel=False). This option is roughly 32 times faster in a benchmark, and 134 times faster when running from Freemocap (I have no clue why the speedup is 4x faster when run in context).

There's also a new fast=True option in the triangulate function, which claims a 20x speedup at the cost of handling outlier data differently. I haven't tried that option yet, but it would be interesting to compare its speed compared to the different jit options I've tested.

@lambdaloop this may be interesting to you as well.