Speeding up optical flow (createOptFlow_DualTVL1)

后端 未结 1 1295
伪装坚强ぢ
伪装坚强ぢ 2020-12-09 13:12

I am using createOptFlow_DualTVL1() to calculate optical flow which is giving me exactly what I want but it is very slow. Is there any way I can speed it up a l

相关标签:
1条回答
  • 2020-12-09 13:58

    In order to speed up the computation, you need to reduce the total count of computations performed each time. This seems obvious, but the huge number of strategies to achieve that goal can be confusing. So, here are some proposals:

    1. Reduce the size of your images (input data). In particular, you should try to divide their size by 2 along each dimension, compute the flow, then compute a full size flow with linear interpolation. Unless your application requires a very high accuracy, this solution should be acceptable and will give you a huge speedup.

    2. Reduce the number of warps (parameter: warps) per scale. This will harm a little the accuracy, but unless you have very difficult motion patterns (e.g., when all the image pixels are moving in different directions, or when you have a very fast motion inside the image) the result should still be acceptable. The algorithms runs the minimization procedure warps times per level in the image pyramid, so even a small change in warps will give you a noticeable speedup.

    3. Reduce the number of levels in the image pyramid (parameter: scales). This can have an important impact on the accuracy though, so be careful and experiment a lot with it. It has been found in the literature that a good (for accuracy) scale factor between levels is 0.8, so you should compute your number of levels accordingly. Before 0.8, the standard in experimenting with optical flow was a scale factor of 0.5, so you can try to go down until this value.

    4. Convergence speed: the inner procedure for L1 minimization is stable for time steps (parameter: tau) up to 1/8 (0.125) in theory, but in practice values of 1/4 (0.25) are known to still work.

    0 讨论(0)
提交回复
热议问题