Skip to content

JuliaSmoothOptimizers/BundleAdjustmentModels.jl

Repository files navigation

BundleAdjustmentModels

Documentation CI Coverage Release DOI
docs-stable docs-dev build-ci codecov release doi

Julia repository of bundle adjustment problems from the repository Bundle Adjustment in the Large.

How to Cite

If you use BundleAdjustmentModels.jl in your work, please cite using the format given in CITATION.cff.

Bug Reports and Discussions

If you think you found a bug, feel free to open an issue. Focused suggestions and requests can also be opened as issues. Before opening a pull request, please start an issue or a discussion on the topic.

If you want to ask a question not suited for a bug report, feel free to start a discussion here.

Examples

Loading and Exploring Problems

using BundleAdjustmentModels, DataFrames

# Get a DataFrame with all problems
df = problems_df()

# Show first few rows
first(df, 5)
5×5 DataFrame
 Row │ name               group      nequ     nvar    nnzj     
     │ String             String     Int64    Int64   Int64    
─────┼─────────────────────────────────────────────────────────
   1 │ problem-16-22106   dubrovnik   167436   66462   2009232
   2 │ problem-88-64298   dubrovnik   767874  193686   9214488
   3 │ problem-135-90642  dubrovnik  1106672  273141  13280064
   4 │ problem-142-93602  dubrovnik  1131216  282084  13574592
   5 │ problem-150-95821  dubrovnik  1136238  288813  13634856

The DataFrame has the following columns:

  • name: Problem name.
  • group: Group to which the problem belongs.
  • nequ: Number of equations (rows).
  • nvar: Number of variables (columns).
  • nnzj: Number of non-zero elements in the Jacobian.

Filtering problems

You can filter problems based on specific criteria. For instance:

# Select problems with more than 50000 equations and less than 34000 variables
filter_df = filter(pb -> pb.nequ >= 50_000 && pb.nvar <= 34_000, df)

Accessing problem names

Extract the name of the first problem in the filtered DataFrame:

name = filter_df[1, :name]

Fetching artifacts

Download the problem artifact for the given name:

path = fetch_ba_name(name)

Nonlinear least-squares models

Create a nonlinear least-squares model:

using NLPModels
model = BundleAdjustmentModel(name)

You can evaluate residuals and Jacobians using functions from NLPModels.

residuals = residual(model, model.meta.x0)

Compute the Jacobian structure:

rows = Vector{Int}(undef, model.nls_meta.nnzj)
cols = Vector{Int}(undef, model.nls_meta.nnzj)
jac_structure_residual!(model, rows, cols)

Evaluate Jacobian values:

vals = Vector{Float64}(undef, length(rows))
jac_coord_residual!(model, model.meta.x0, vals)

Cleaning up artifacts

Delete specific or all downloaded artifacts:

delete_ba_artifact!(name)  # Delete one artifact
delete_all_ba_artifacts!() # Delete all artifacts

Special thanks to Célestine Angla for her initial work on this project during her internship.

License

Licensed under the MPL-2.0 License.

About

Julia repository of bundle adjustment problems

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 6

Languages