https://github.com/juliasmoothoptimizers/bundleadjustmentmodels.jl
Julia repository of bundle adjustment problems
https://github.com/juliasmoothoptimizers/bundleadjustmentmodels.jl
bundle-adjustment julia least-squares nlpmodels nlsmodels
Last synced: 11 months ago
JSON representation
Julia repository of bundle adjustment problems
- Host: GitHub
- URL: https://github.com/juliasmoothoptimizers/bundleadjustmentmodels.jl
- Owner: JuliaSmoothOptimizers
- License: mpl-2.0
- Created: 2021-07-06T20:12:06.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2025-03-21T00:08:35.000Z (about 1 year ago)
- Last Synced: 2025-06-06T18:12:25.710Z (12 months ago)
- Topics: bundle-adjustment, julia, least-squares, nlpmodels, nlsmodels
- Language: Julia
- Homepage:
- Size: 1.16 MB
- Stars: 9
- Watchers: 4
- Forks: 5
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
- Citation: CITATION.cff
Awesome Lists containing this project
README
# BundleAdjustmentModels
| **Documentation** | **CI** | **Coverage** | **Release** | **DOI** |
|:-----------------:|:------:|:------------:|:-----------:|:-------:|
| [![docs-stable][docs-stable-img]][docs-stable-url] [![docs-dev][docs-dev-img]][docs-dev-url] | [![build-ci][build-ci-img]][build-ci-url] | [![codecov][codecov-img]][codecov-url] | [![release][release-img]][release-url] | [![doi][doi-img]][doi-url] |
[docs-stable-img]: https://img.shields.io/badge/docs-stable-blue.svg
[docs-stable-url]: https://juliasmoothoptimizers.github.io/BundleAdjustmentModels.jl/stable/
[docs-dev-img]: https://img.shields.io/badge/docs-dev-purple.svg
[docs-dev-url]: https://juliasmoothoptimizers.github.io/BundleAdjustmentModels.jl/dev/
[build-ci-img]: https://github.com/JuliaSmoothOptimizers/BundleAdjustmentModels.jl/workflows/CI/badge.svg?branch=main
[build-ci-url]: https://github.com/JuliaSmoothOptimizers/BundleAdjustmentModels.jl/actions
[codecov-img]: https://codecov.io/gh/JuliaSmoothOptimizers/BundleAdjustmentModels.jl/branch/main/graph/badge.svg
[codecov-url]: https://app.codecov.io/gh/JuliaSmoothOptimizers/BundleAdjustmentModels.jl
[release-img]: https://img.shields.io/github/v/release/JuliaSmoothOptimizers/BundleAdjustmentModels.jl.svg?style=flat-square
[release-url]: https://github.com/JuliaSmoothOptimizers/BundleAdjustmentModels.jl/releases
[doi-img]: https://zenodo.org/badge/383587358.svg
[doi-url]: https://zenodo.org/badge/latestdoi/383587358
Julia repository of [bundle adjustment](https://en.wikipedia.org/wiki/Bundle_adjustment) problems from the repository [Bundle Adjustment in the Large](http://grail.cs.washington.edu/projects/bal/).
## How to Cite
If you use `BundleAdjustmentModels.jl` in your work, please cite using the format given in [`CITATION.cff`](https://github.com/JuliaSmoothOptimizers/BundleAdjustmentModels.jl/blob/main/CITATION.cff).
## Bug Reports and Discussions
If you think you found a bug, feel free to open an [issue](https://github.com/JuliaSmoothOptimizers/BundleAdjustmentModels.jl/issues).
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](https://github.com/JuliaSmoothOptimizers/Organization/discussions).
## Examples
### Loading and Exploring Problems
```julia
using BundleAdjustmentModels, DataFrames
# Get a DataFrame with all problems
df = problems_df()
# Show first few rows
first(df, 5)
```
```julia
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:
```julia
# 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:
```julia
name = filter_df[1, :name]
```
### Fetching artifacts
Download the problem artifact for the given name:
```julia
path = fetch_ba_name(name)
```
### Nonlinear least-squares models
Create a nonlinear least-squares model:
```julia
using NLPModels
model = BundleAdjustmentModel(name)
```
You can evaluate residuals and Jacobians using functions from `NLPModels`.
```julia
residuals = residual(model, model.meta.x0)
```
Compute the Jacobian structure:
```julia
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:
```julia
vals = Vector{Float64}(undef, length(rows))
jac_coord_residual!(model, model.meta.x0, vals)
```
### Cleaning up artifacts
Delete specific or all downloaded artifacts:
```julia
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](LICENSE.md).