Skip to content

Instantly share code, notes, and snippets.

@ojwoodford
Last active November 5, 2023 16:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ojwoodford/d2d75b47173489cda41b9caa958f0b01 to your computer and use it in GitHub Desktop.
Save ojwoodford/d2d75b47173489cda41b9caa958f0b01 to your computer and use it in GitHub Desktop.
Comparison of Bundle Adjustment optimization using JSO and NLLSsolver in Julia
# JSO
using BundleAdjustmentModels, CaNNOLeS
function jso_func()
# Dry run to do compilation
model = BundleAdjustmentModel("problem-16-22106")
stats = cannoles(model, method=:Newton_noFHess)
# Output these results
model = BundleAdjustmentModel("problem-16-22106")
@time stats = cannoles(model, method=:Newton_noFHess)
print(stats)
end
# NLLSsolver
using VisualGeometryOptimization, NLLSsolver
function nlls_func()
# Optimize the problem
options = NLLSsolver.NLLSOptions(iterator=NLLSsolver.levenbergmarquardt, reldcost=1.0e-6)
# Dry run to do the compilation
problem = loadBALproblem("problem-16-22106")
NLLSsolver.optimize!(problem, options)
# Repeat the optimization, and report the timings
problem = loadBALproblem("problem-16-22106")
@time result = NLLSsolver.optimize!(problem, options)
display(result)
end
# Run the tests
jso_func()
nlls_func()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment