Closed Kalkasas closed 6 years ago
Opt has two solvers, Gauss-Newton and Levenberg-Marquadt. GN has no theoretical guarantees, so our implementation focused on speed over robustness. In general, I would recommend starting with the LM solver, switching to GN if you need a bit more speed for your application and can tune the iteration counts to avoid robustness issues.
However, it is trivial and essentially computationally free for us to make this particular issue more robust, so I have added a fix in the latest commit. The issue in this case is that GN is numerically unstable when the cost is ~= 0. If you pull and run Opt will refuse to divide by zero which could otherwise occur (only) when the cost is ~= 0, and your issue is fixed.
Minimal modifications of the laplacian.t file in tests/minimal lead to NAN cost during optimization:
Energy(X(0,0))
for a 1x1 image.The last change should result in the cost function f(x) = 0.5*x^2 so I have no idea what could lead to a NAN.
Evaluation of these Energies works but the moment I start the optimizers it computes nonsense. Either my understanding of "Opt" is wrong or my setup is faulty.