This week I passed my exams and finally I'm able to spend more time on project. I think that on next week I'll make progress and write a real code (not for testing purposes).
But today I'm stuck. I solved problem with singular matrix using approximate computation (least squares method from numpy = lstsq (http://docs.scipy.org/doc/numpy/reference/generated/numpy.linalg.lstsq.html)), but my implementation of LMA method converges very poorly. I fixed some errors and tried to tune parameters, but it wasn't successful. In some cases, I get admissible results (mosaic is good and time of solving is small), in others algorithm stuck and can't overcome strange minimum. I didn't figure out why it happens.
So, previous oprimization based on Gradient descent algorithm looks better, and if I can't apply LMA, I'll try gradient. But I really hope to solve my problems with LMA.
I corrected my code and tuned parameters, all links from my weekly report #5.
https://github.com/migal-drew/OpencvTransform/blob/master/src/mosaicing_lma.py
https://github.com/migal-drew/OpencvTransform/blob/master/src/levenberg_marquardt.py
https://github.com/migal-drew/OpencvTransform/blob/master/src/utilities.py
https://github.com/migal-drew/OpencvTransform/blob/master/src/levenberg_marquardt.py
https://github.com/migal-drew/OpencvTransform/blob/master/src/utilities.py
Brief results:
1 picture - LMA, error:
before - 20516, after - 4669 and requires only one (!) iteration (its'really fast!)
I got also error about 4161 with 43 iterations (then algoritm totally converges)
2 picture - also LMA, but here, as you can see, algorithm fails (despite of number of iterations or values of thresholds, method stucks)
Interesting results with non aerial photos
LMA method (the best mosaic as I could get)
The same photos, but Gradient descent algorithm (it looks much better than previous with LMA)
It's all for this week!
No comments:
Post a Comment