hankyang94 / DAMP

DAMP: Dynamical Pose Estimation
17 stars 0 forks source link

Hyperparameters tuning and effects? #1

Closed xiahaa closed 2 years ago

xiahaa commented 2 years ago

Hi, thanks for sharing this work. I just have one question regarding the hyperparameters setting, e.g. time step, damping values. E.g., if the time step is set to 1 for the absolute pose estimation case, the program will occasionally return Nan results, does this indicate that the settings of those hyperparameters have some influences on the convergence? How should we tune those hyperparameters? Could you give me some insights?

Thanks!

hankyang94 commented 2 years ago

Hi, thank you very much for your question.

Theoretically speaking, the dynamical system is a continuous time system, thus the size of the time step should not affect the convergence (say if you literally build a mechanical system with springs and dampers and just let the system evolve according to physics).

However, because we are simulating the dynamical system (which is an ordinary different equation, ODE) in discrete time, there will be approximation errors between the discrete time system and the true continuous time system. If you set the time step to be very small, e.g., 0.001, then the approximation errors will be very small (but it will take more iterations for the code to finish). If you set the time step to be very large, e.g., 1.0, then the approximation errors get larger (but it will take fewer iterations for the code to finish) and possibly trigger the NaNs, especially if you set the damping value to be high too, which makes the forces very large. So you see there is a trade-off between simulation accuracy and simulation speed.

That said, I typically start with a small time step, such as 0.01, and gradually enlarge it until I am satisfied with the number of iterations until convergence, but not too large so as to avoid triggering the NaNs. I typically find it OK to use a time step of 0.1 or 0.2 seconds.

On a side note, there are possibly better ways to simulate dynamical systems (ODE solvers in Matlab) with variable time step sizes that could lead to better performance. However, in the current implementation I am just using a fixed time step simulation for simplicity. You are free to explore other ODE solvers on your own.

Hope this helps!

xiahaa commented 2 years ago

Thanks a lot for sharing your insights.