Skip to content
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
673 commits
Select commit Hold shift + click to select a range
75834f0
fix
nushakrishnan Sep 28, 2025
210f55e
naming
nushakrishnan Sep 28, 2025
0b45d8f
rm dummy imu params
nushakrishnan Sep 28, 2025
7ecafcb
upd init
nushakrishnan Sep 28, 2025
1cff2ed
colmap links
nushakrishnan Sep 28, 2025
8fbeab2
delete files from folder
nushakrishnan Sep 28, 2025
4c74190
unused func
nushakrishnan Sep 28, 2025
e5e949f
ruff
nushakrishnan Sep 28, 2025
522bb5c
clear unused fn
nushakrishnan Sep 28, 2025
1e31dc5
ruff
nushakrishnan Sep 28, 2025
3a581ad
mv extraction
nushakrishnan Sep 28, 2025
8ba0a6a
mv
nushakrishnan Sep 28, 2025
bfa8070
vrs
nushakrishnan Sep 28, 2025
beab16b
extract fix
nushakrishnan Sep 28, 2025
1185f6a
del
nushakrishnan Sep 28, 2025
05fa8ca
sync
nushakrishnan Sep 28, 2025
1e80750
importing sync
nushakrishnan Sep 28, 2025
4e1d10b
estimate loading
nushakrishnan Sep 28, 2025
46c3abe
estimate
nushakrishnan Sep 28, 2025
f0341a1
revert
nushakrishnan Sep 28, 2025
4447fb5
estimate class upd
nushakrishnan Sep 28, 2025
a634047
init recon from calib file
nushakrishnan Sep 28, 2025
590f680
sparse eval
nushakrishnan Sep 28, 2025
9f3d8e0
est upd
nushakrishnan Sep 28, 2025
4567c4f
estimate
nushakrishnan Sep 28, 2025
010a108
undistort asl add cameras rm
nushakrishnan Sep 28, 2025
fdb763b
util fn init recon from claib
nushakrishnan Sep 28, 2025
21dbae5
sparse eval
nushakrishnan Sep 28, 2025
5817d5a
ruff
nushakrishnan Sep 28, 2025
73f14b0
est upd
nushakrishnan Sep 28, 2025
04aeab9
ruff
nushakrishnan Sep 28, 2025
d319d94
edits
nushakrishnan Sep 28, 2025
806d9de
lamaria recons
nushakrishnan Sep 28, 2025
59da348
vi recons
nushakrishnan Sep 28, 2025
2677fa1
vi recons
nushakrishnan Sep 28, 2025
3aa6150
renaming
nushakrishnan Sep 28, 2025
df103b4
virecons
nushakrishnan Sep 28, 2025
720559b
vi reconstruction
nushakrishnan Sep 28, 2025
475c500
keyframe selection
nushakrishnan Sep 28, 2025
d36f209
vi recon naming upd
nushakrishnan Sep 28, 2025
acb9932
vi recon
nushakrishnan Sep 28, 2025
6647ab0
run pipeline
nushakrishnan Sep 28, 2025
cdb9af0
mv control point
nushakrishnan Sep 28, 2025
3111204
structs cps
nushakrishnan Sep 28, 2025
9f3175b
mv
nushakrishnan Sep 28, 2025
7579168
fix circular import
nushakrishnan Sep 28, 2025
71ffb66
to vi
nushakrishnan Sep 28, 2025
a31a17b
fix
nushakrishnan Sep 28, 2025
533b10a
vi opt
nushakrishnan Sep 28, 2025
f2b4756
ruff
nushakrishnan Sep 28, 2025
aeba49d
timestamps
nushakrishnan Sep 28, 2025
61b5a6d
timestamps
nushakrishnan Sep 28, 2025
6480840
func
nushakrishnan Sep 28, 2025
67d052f
estimate upd
nushakrishnan Sep 28, 2025
71e881b
timestamp naming
nushakrishnan Sep 28, 2025
ff08e45
cps struct
nushakrishnan Sep 28, 2025
e11c88a
ruff
nushakrishnan Sep 28, 2025
1fcd1fa
sparse eval variables
nushakrishnan Sep 28, 2025
1370755
cleaner sparse eval
nushakrishnan Sep 28, 2025
67524f6
init recon with cameras
nushakrishnan Sep 29, 2025
7e05703
aria
nushakrishnan Sep 29, 2025
0633595
updating est
nushakrishnan Sep 29, 2025
161cae2
naming
nushakrishnan Sep 29, 2025
cc3de83
naming
nushakrishnan Sep 29, 2025
2a160f7
fixes
nushakrishnan Sep 29, 2025
fdb0515
renmaing
nushakrishnan Sep 29, 2025
13af9cd
fixes
nushakrishnan Sep 29, 2025
164c0ae
fixes
nushakrishnan Sep 29, 2025
4b374bb
cp
nushakrishnan Sep 29, 2025
4185886
structs for sparse eval
nushakrishnan Sep 29, 2025
35e2077
result
nushakrishnan Sep 29, 2025
8ba62a3
fix
nushakrishnan Sep 29, 2025
f036160
fixes
nushakrishnan Sep 29, 2025
a63f8ba
fixes
nushakrishnan Sep 29, 2025
b49a0d3
fix
nushakrishnan Sep 29, 2025
73b2989
eval
nushakrishnan Sep 29, 2025
a07d713
add load fn for result
nushakrishnan Sep 29, 2025
7b69dc9
load from file
nushakrishnan Sep 29, 2025
edbfbe0
fix loading
nushakrishnan Sep 29, 2025
e87ff5f
return type
nushakrishnan Sep 29, 2025
9f101e9
return
nushakrishnan Sep 29, 2025
4846d6a
todo
nushakrishnan Sep 29, 2025
9e398f5
readme init
nushakrishnan Sep 29, 2025
1d5e77d
ruff
nushakrishnan Sep 29, 2025
e3d7623
readme
nushakrishnan Sep 29, 2025
2dabcbd
read
nushakrishnan Sep 29, 2025
76b9d9b
readme init, assets
nushakrishnan Sep 29, 2025
1492095
spacing
nushakrishnan Sep 29, 2025
3d212d6
quickstart shell
nushakrishnan Sep 29, 2025
93279f6
req.txt
nushakrishnan Sep 29, 2025
b50c539
proj aria tools
nushakrishnan Sep 29, 2025
abad621
pgt nd traj association
nushakrishnan Sep 29, 2025
38f8469
ts
nushakrishnan Sep 29, 2025
e739267
ruff
nushakrishnan Sep 29, 2025
7de41da
argparser
nushakrishnan Sep 29, 2025
5ae7582
req
nushakrishnan Sep 29, 2025
77dca6a
pr
nushakrishnan Sep 29, 2025
4579c20
op path desc
nushakrishnan Sep 29, 2025
b557af6
fix requirements.txt
B1ueber2y Sep 29, 2025
a16b097
useless str in sensoroptions
nushakrishnan Sep 29, 2025
ae305f5
aria upd
nushakrishnan Sep 29, 2025
e7ba58b
rm stream id
nushakrishnan Sep 29, 2025
d96f919
streamid intro in vrs to asl
nushakrishnan Sep 29, 2025
5f26deb
streamid
nushakrishnan Sep 29, 2025
be0edee
sparse eval result naming
nushakrishnan Sep 29, 2025
d307b53
rm cp reproj std
nushakrishnan Sep 29, 2025
bd0d6a4
sparse
nushakrishnan Sep 29, 2025
084ab39
rm cp reproj std
nushakrishnan Sep 29, 2025
e9cf2dc
Merge branch 'dev' of github.com:cvg/lamaria into dev
nushakrishnan Sep 29, 2025
5706ef6
imu camera
nushakrishnan Sep 29, 2025
c24e3ac
aria imu dummy camera
nushakrishnan Sep 29, 2025
d48c76f
return reconstruction instead of path
nushakrishnan Sep 29, 2025
85ef4bd
init recons
nushakrishnan Sep 29, 2025
5f80383
types
nushakrishnan Sep 29, 2025
5e3f9e3
return
nushakrishnan Sep 29, 2025
7e86ed4
init recons
nushakrishnan Sep 29, 2025
2ede45d
aria
nushakrishnan Sep 29, 2025
3cea488
data input
nushakrishnan Sep 29, 2025
b32f97c
renaming
nushakrishnan Sep 29, 2025
d42622c
upd control point
nushakrishnan Sep 29, 2025
d020ee9
comment
nushakrishnan Sep 29, 2025
9c49ecc
comms
nushakrishnan Sep 29, 2025
6cf98e4
fix
nushakrishnan Sep 29, 2025
1d44bbc
cp
nushakrishnan Sep 29, 2025
e897285
ssparse
nushakrishnan Sep 29, 2025
2bd2787
eval
nushakrishnan Sep 29, 2025
a1039f8
sparse
nushakrishnan Sep 29, 2025
c1d95a2
ruff
nushakrishnan Sep 29, 2025
fef2a95
ruff
nushakrishnan Sep 29, 2025
6e01271
cp tri
nushakrishnan Sep 29, 2025
4893e65
cp
nushakrishnan Sep 29, 2025
5f85c29
cp trii
nushakrishnan Sep 29, 2025
a3ae3d6
fix
nushakrishnan Sep 29, 2025
a1a05d0
ruff
nushakrishnan Sep 29, 2025
a3e2e7a
ruff
nushakrishnan Sep 29, 2025
5067f03
cp summary
nushakrishnan Sep 29, 2025
046586a
abstract TimedReconstruction and refactor I/O.
B1ueber2y Sep 29, 2025
ddda41d
ev
nushakrishnan Sep 29, 2025
826d410
sparse eval
nushakrishnan Sep 29, 2025
a775626
Merge branch 'dev' into shaohui/dev
B1ueber2y Sep 29, 2025
adadd29
format and fix.
B1ueber2y Sep 29, 2025
05fcc3b
format
B1ueber2y Sep 29, 2025
a57e41b
f
nushakrishnan Sep 29, 2025
2fc7835
metrics
nushakrishnan Sep 29, 2025
3d34855
evo eval against mps
nushakrishnan Sep 29, 2025
7b02733
unused import
nushakrishnan Sep 29, 2025
5cec9ed
traj
nushakrishnan Sep 29, 2025
39a8423
traj
nushakrishnan Sep 29, 2025
54c3bb9
eval wrt mps
nushakrishnan Sep 29, 2025
9c8ca1a
evo eval
nushakrishnan Sep 29, 2025
c82690d
ate rmse
nushakrishnan Sep 29, 2025
abc13a2
ruff
nushakrishnan Sep 29, 2025
c625bf4
ruff
nushakrishnan Sep 29, 2025
abd86dd
fix
nushakrishnan Sep 29, 2025
e687790
split estimate and mps in the data init.
B1ueber2y Sep 29, 2025
811e9f7
fix and format
B1ueber2y Sep 29, 2025
80be58d
fix
B1ueber2y Sep 29, 2025
4d34a8b
format
B1ueber2y Sep 29, 2025
41f5f9b
Merge branch 'dev' into shaohui/dev
B1ueber2y Sep 29, 2025
4e74cb1
installation readme
nushakrishnan Sep 29, 2025
f371eeb
minor
B1ueber2y Sep 29, 2025
163f194
vrs installation tools
nushakrishnan Sep 29, 2025
cfaea93
Merge pull request #3 from cvg/shaohui/dev
nushakrishnan Sep 29, 2025
c8b8327
Merge branch 'dev' of github.com:cvg/lamaria into dev
nushakrishnan Sep 29, 2025
db93e99
fix broken impl
B1ueber2y Sep 29, 2025
0b12d3b
format
B1ueber2y Sep 29, 2025
a7bed5f
RGB CAMERA STREAM ID
nushakrishnan Sep 29, 2025
4a52e36
Merge branch 'dev' of github.com:cvg/lamaria into dev
nushakrishnan Sep 29, 2025
5305ca8
mv into pipeline
nushakrishnan Sep 29, 2025
5513115
pyproject toml
nushakrishnan Sep 29, 2025
c4280bf
ruff
nushakrishnan Sep 29, 2025
f6f6eae
readme
nushakrishnan Sep 29, 2025
8001bde
download lamaria
nushakrishnan Sep 29, 2025
0e8aaa7
Download section
nushakrishnan Sep 29, 2025
336961f
more readme
nushakrishnan Sep 29, 2025
995136b
download dataset
nushakrishnan Sep 29, 2025
8340dac
download
nushakrishnan Sep 29, 2025
e9df9ff
readme
nushakrishnan Sep 29, 2025
c15be65
demo data folder
nushakrishnan Sep 29, 2025
6e2d3e9
toml
nushakrishnan Sep 29, 2025
dec0aa8
quick start
nushakrishnan Sep 29, 2025
eb55944
ruff
nushakrishnan Sep 29, 2025
2de021e
read
nushakrishnan Sep 29, 2025
1ba9277
evo fix
nushakrishnan Sep 29, 2025
cdf01f7
readme
nushakrishnan Sep 30, 2025
1d1ab11
fix
nushakrishnan Sep 30, 2025
a7b7b0b
pose recall
nushakrishnan Sep 30, 2025
450f7c1
pgt
nushakrishnan Sep 30, 2025
f6308f7
no need for op path
nushakrishnan Sep 30, 2025
01529bb
space
nushakrishnan Sep 30, 2025
4a3eeb1
array
nushakrishnan Sep 30, 2025
0c0b87b
readme
nushakrishnan Sep 30, 2025
20e2862
pgt
nushakrishnan Sep 30, 2025
6755bb0
ruff
nushakrishnan Sep 30, 2025
d2b735d
Readme
nushakrishnan Sep 30, 2025
f35fd6e
readme
nushakrishnan Sep 30, 2025
c07c27e
readme
nushakrishnan Sep 30, 2025
e07ab9d
readme
nushakrishnan Sep 30, 2025
f83e525
readme
nushakrishnan Sep 30, 2025
11f7638
logo
nushakrishnan Sep 30, 2025
d41aba6
readne
nushakrishnan Sep 30, 2025
4b07bdb
tools
nushakrishnan Sep 30, 2025
f334909
naming consistency
nushakrishnan Sep 30, 2025
66fe2eb
readme
nushakrishnan Sep 30, 2025
d9bf622
fix
nushakrishnan Sep 30, 2025
3d11031
ros1bag
nushakrishnan Sep 30, 2025
2671380
read
nushakrishnan Sep 30, 2025
3333a69
readme
nushakrishnan Sep 30, 2025
42826a4
readme
nushakrishnan Sep 30, 2025
b7b637f
evo bagpy and cvbridge
nushakrishnan Sep 30, 2025
ea77454
llaalalaa
nushakrishnan Sep 30, 2025
0b10ca7
download
nushakrishnan Sep 30, 2025
916b388
readme changes
nushakrishnan Sep 30, 2025
60de167
sizes
nushakrishnan Sep 30, 2025
4de2fbf
fix
nushakrishnan Sep 30, 2025
5da1c3d
collapsed
nushakrishnan Sep 30, 2025
145987c
read
nushakrishnan Sep 30, 2025
eb52368
better
nushakrishnan Sep 30, 2025
c3065d7
train test split
nushakrishnan Sep 30, 2025
0c67fd9
readme
nushakrishnan Sep 30, 2025
871c9fa
readme comments without viz
nushakrishnan Sep 30, 2025
6dc8c33
mps estimate trajec
nushakrishnan Sep 30, 2025
3e91c34
readme
nushakrishnan Sep 30, 2025
aee915a
removing the rudeness from readme
nushakrishnan Sep 30, 2025
748ac9d
rm mps
nushakrishnan Sep 30, 2025
46bf992
mps ocal rm
nushakrishnan Sep 30, 2025
e6a118d
rm mps
nushakrishnan Sep 30, 2025
100cbe3
use mps
nushakrishnan Sep 30, 2025
48b8025
rm mps
nushakrishnan Sep 30, 2025
9460a87
rm has slam drops
nushakrishnan Sep 30, 2025
066035c
make output_dir mandatory.
B1ueber2y Sep 30, 2025
1093ed2
fix.
B1ueber2y Sep 30, 2025
4e7b35b
change example to lighter sequences.
B1ueber2y Sep 30, 2025
de29d77
adapt file structure
B1ueber2y Sep 30, 2025
59604b4
rename pseudo_dense and sparse into pGT and control_points.
B1ueber2y Sep 30, 2025
5289efe
fix readme
B1ueber2y Sep 30, 2025
414af60
update readme
B1ueber2y Sep 30, 2025
21d6227
update demo paths
B1ueber2y Sep 30, 2025
0377cd6
update vi optim
B1ueber2y Sep 30, 2025
262d4f6
update
B1ueber2y Sep 30, 2025
9a99605
update
B1ueber2y Sep 30, 2025
3405124
update
B1ueber2y Sep 30, 2025
5800ec9
add note on imu bottleneck. add ruff==0.12.7 to requirements.txt
B1ueber2y Sep 30, 2025
1e8885a
format
B1ueber2y Sep 30, 2025
b82fbd1
fix
B1ueber2y Sep 30, 2025
88b51af
SE3 type hint.
B1ueber2y Sep 30, 2025
c10748c
optimized
nushakrishnan Sep 30, 2025
aa9c1da
resukt
nushakrishnan Sep 30, 2025
ae3a5be
red
nushakrishnan Sep 30, 2025
f7746b7
fix vi demo script and remove figure.
B1ueber2y Sep 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/__pycache__/
.DS_Store
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
# lamaria
# Benchmarking Egocentric Visual-Inertial SLAM at City Scale

### Downloading the dataset


### Additional tools
53 changes: 53 additions & 0 deletions defaults.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Default configuration for run_pipeline.py

sensor:
camera_model: RAD_TAN_THIN_PRISM_FISHEYE
has_slam_drops: false

keyframing:
max_rotation: 20.0
max_distance: 1.0
max_elapsed: 1e9 # 1 second in ns

triangulation:
feature_conf: aliked-n16
matcher_conf: aliked+lightglue
retrieval_conf: netvlad
num_retrieval_matches: 5

# relaxed triangulation
# https://github.com/colmap/colmap/blob/dbdb3cd5a9a90a01b7e1096905ba2ffc34a68b82/src/colmap/sfm/incremental_triangulator.h
merge_max_reproj_error: 15.0
complete_max_reproj_error: 15.0
min_angle: 1.0

# https://github.com/colmap/colmap/blob/dbdb3cd5a9a90a01b7e1096905ba2ffc34a68b82/src/colmap/sfm/incremental_mapper.h
filter_max_reproj_error: 15.0
filter_min_tri_angle: 1.0

optimization:
general:
use_callback: true
max_num_iterations: 10
normalize_reconstruction: false
minimizer_progress_to_stdout: true
update_state_every_iteration: true

cam:
feature_std: 1.0
optimize_focal_length: false
optimize_principal_point: false
optimize_extra_params: false
optimize_cam_from_rig: false

imu:
optimize_scale: false
optimize_gravity: false
optimize_imu_from_rig: false
optimize_bias: true
gyro_infl: 1.0
acc_infl: 1.0
integration_noise_density: 0.05

mps:
use_online_calibration: false # relevant only when mps folder is used
13 changes: 13 additions & 0 deletions lamaria/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import logging

formatter = logging.Formatter(
fmt="[%(asctime)s %(name)s %(levelname)s] %(message)s",
datefmt="%Y/%m/%d %H:%M:%S",
)
handler = logging.StreamHandler()
handler.setFormatter(formatter)

logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
logger.addHandler(handler)
logger.propagate = False
173 changes: 173 additions & 0 deletions lamaria/config/options.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
from __future__ import annotations

from dataclasses import dataclass, field, replace

from omegaconf import OmegaConf, open_dict


def _structured_merge_to_obj(cls, section) -> object:
"""
Merge a YAML section onto a structured
config made from the dataclass `cls`,
then return a dataclass instance.
"""
base = OmegaConf.structured(cls)
merged = OmegaConf.merge(base, section or {})
return OmegaConf.to_object(merged)


# General options
@dataclass(slots=True)
class MPSOptions:
use_online_calibration: bool = (
False # set to True if using MPS online calibration result
)

@classmethod
def load(cls, cfg: OmegaConf | None = None) -> MPSOptions:
if cfg is None:
return cls()

return _structured_merge_to_obj(cls, cfg)


@dataclass(slots=True)
class SensorOptions:
left_cam_stream_id: str = "1201-1"
right_cam_stream_id: str = "1201-2"
right_imu_stream_id: str = "1202-1"
camera_model: str = "RAD_TAN_THIN_PRISM_FISHEYE"
has_slam_drops: bool = (
False # check vrs json metadata file for each sequence
)

@classmethod
def load(cls, cfg: OmegaConf | None = None) -> SensorOptions:
if cfg is None:
return cls()

obj: SensorOptions = _structured_merge_to_obj(cls, cfg)
return obj


# Estimate to COLMAP options
@dataclass(slots=True)
class EstimateToLamariaOptions:
mps: MPSOptions = field(default_factory=MPSOptions)
sensor: SensorOptions = field(default_factory=SensorOptions)

@classmethod
def load(
cls,
cfg_mps: OmegaConf | None = None,
cfg_sensor: OmegaConf | None = None,
) -> EstimateToLamariaOptions:
if cfg_mps is None or cfg_sensor is None:
return cls()

base = cls()
return replace(
base,
mps=MPSOptions.load(cfg_mps),
sensor=SensorOptions.load(cfg_sensor),
)


# Keyframing options
@dataclass(slots=True)
class KeyframeSelectorOptions:
max_rotation: float = 20.0 # degrees
max_distance: float = 1.0 # meters
max_elapsed: int = int(1e9) # 1 second in ns

@classmethod
def load(cls, cfg: OmegaConf | None = None) -> KeyframeSelectorOptions:
if cfg is None:
return cls()

cfg = OmegaConf.create(cfg)
with open_dict(cfg):
if "max_elapsed" in cfg and isinstance(cfg.max_elapsed, float):
cfg.max_elapsed = int(cfg.max_elapsed)

obj: KeyframeSelectorOptions = _structured_merge_to_obj(cls, cfg)
return obj


# Triangulation options
@dataclass(slots=True)
class TriangulatorOptions:
feature_conf: str = "aliked-n16"
matcher_conf: str = "aliked+lightglue"
retrieval_conf: str = "netvlad"
num_retrieval_matches: int = 5

# colmap defaults
merge_max_reproj_error: float = 4.0
complete_max_reproj_error: float = 4.0
min_angle: float = 1.5

filter_max_reproj_error: float = 4.0
filter_min_tri_angle: float = 1.5

@classmethod
def load(cls, cfg: OmegaConf | None = None) -> TriangulatorOptions:
if cfg is None:
return cls()

return _structured_merge_to_obj(cls, cfg)


# Optimization options
@dataclass(slots=True)
class OptCamOptions:
feature_std: float = 1.0 # in pixels
optimize_focal_length: bool = False
optimize_principal_point: bool = False
optimize_extra_params: bool = False
optimize_cam_from_rig: bool = False


@dataclass(slots=True)
class OptIMUOptions:
gyro_infl: float = 1.0
acc_infl: float = 1.0
integration_noise_density: float = 0.05

optimize_scale: bool = False
optimize_gravity: bool = False
optimize_imu_from_rig: bool = False
optimize_bias: bool = False


@dataclass(slots=True)
class OptOptions:
use_callback: bool = True
max_num_iterations: int = 10
normalize_reconstruction: bool = False
minimizer_progress_to_stdout: bool = True
update_state_every_iteration: bool = True


@dataclass(slots=True)
class VIOptimizerOptions:
cam: OptCamOptions = field(default_factory=OptCamOptions)
imu: OptIMUOptions = field(default_factory=OptIMUOptions)
optim: OptOptions = field(default_factory=OptOptions)

@classmethod
def load(cls, cfg: OmegaConf | None = None) -> VIOptimizerOptions:
if cfg is None:
return cls()

base = cls()
cam = _structured_merge_to_obj(OptCamOptions, cfg.cam)
imu = _structured_merge_to_obj(OptIMUOptions, cfg.imu)
optim = _structured_merge_to_obj(OptOptions, cfg.general)

return replace(
base,
cam=cam,
imu=imu,
optim=optim,
)
114 changes: 114 additions & 0 deletions lamaria/config/pipeline.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
from collections.abc import Sequence
from pathlib import Path

from omegaconf import DictConfig, OmegaConf

from .options import (
EstimateToLamariaOptions,
KeyframeSelectorOptions,
TriangulatorOptions,
VIOptimizerOptions,
)


class PipelineOptions:
def __init__(self) -> None:
self._output_path: Path = Path("output/")
self._estimate_to_colmap_options: EstimateToLamariaOptions = (
EstimateToLamariaOptions()
)
self._keyframing_options: KeyframeSelectorOptions = (
KeyframeSelectorOptions()
)
self._triangulator_options: TriangulatorOptions = TriangulatorOptions()
self._vi_optimizer_options: VIOptimizerOptions = VIOptimizerOptions()

def load(
self,
yaml: Path | str,
cli_overrides: Sequence[str] | None = None,
) -> None:
"""Load configuration from a YAML file and apply any overrides."""
cfg = OmegaConf.load(str(yaml))
if cli_overrides:
cfg = OmegaConf.merge(
cfg, OmegaConf.from_dotlist(list(cli_overrides))
)
OmegaConf.resolve(cfg)

self._update_from_cfg(cfg)

def _update_from_cfg(self, cfg: DictConfig) -> None:
"""Update object attributes from a config."""
self._estimate_to_colmap_options = EstimateToLamariaOptions.load(
cfg.mps,
cfg.sensor,
)
self._keyframing_options = KeyframeSelectorOptions.load(cfg.keyframing)
self._triangulator_options = TriangulatorOptions.load(cfg.triangulation)
self._vi_optimizer_options = VIOptimizerOptions.load(cfg.optimization)

out = cfg.get("output_path", None)
self._output_path = Path(out) if out is not None else Path("/output/")

@property
def output_path(self) -> Path:
"""Get the parent output path."""
return self._output_path

@output_path.setter
def output_path(self, path: Path) -> None:
"""Set the parent output path."""
self._output_path = path

# Properties for estimate to COLMAP
@property
def estimate_to_colmap_options(self) -> EstimateToLamariaOptions:
return self._estimate_to_colmap_options

@property
def images_path(self) -> Path:
return self._output_path / "images"

@property
def colmap_model_path(self) -> Path:
return self._output_path / "initial_recon"

# Properties for keyframing
@property
def keyframing_options(self) -> KeyframeSelectorOptions:
return self._keyframing_options

@property
def keyframes_path(self) -> Path:
return self._output_path / "keyframes"

@property
def kf_model_path(self) -> Path:
return self._output_path / "keyframed_recon"

# Properties for triangulation
@property
def triangulator_options(self) -> TriangulatorOptions:
return self._triangulator_options

@property
def hloc_path(self) -> Path:
return self._output_path / "hloc"

@property
def pairs_file(self) -> Path:
return self._output_path / "hloc" / "pairs.txt"

@property
def tri_model_path(self) -> Path:
return self._output_path / "triangulated_recon"

# Properties for visual-inertial optimization
@property
def vi_optimizer_options(self) -> VIOptimizerOptions:
return self._vi_optimizer_options

@property
def optim_model_path(self) -> Path:
return self._output_path / "optim_recon"
Loading
Loading