File size: 1,251 Bytes
205a7af
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import logging

from siclib.models.optimization.lm_optimizer import LMOptimizer

logger = logging.getLogger(__name__)

# flake8: noqa
# mypy: ignore-errors


class InferenceOptimizer(LMOptimizer):
    default_conf = {
        # Camera model parameters
        "camera_model": "pinhole",  # {"pinhole", "simple_radial", "simple_spherical"}
        "shared_intrinsics": False,  # share focal length across all images in batch
        "estimate_gravity": True,
        "estimate_focal": True,
        "estimate_k1": True,  # will be ignored if camera_model is pinhole
        # LM optimizer parameters
        "num_steps": 30,
        "lambda_": 0.1,
        "fix_lambda": False,
        "early_stop": True,
        "atol": 1e-8,
        "rtol": 1e-8,
        "use_spherical_manifold": True,  # use spherical manifold for gravity optimization
        "use_log_focal": True,  # use log focal length for optimization
        # Loss function parameters
        "loss_fn": "huber_loss",  # {"squared_loss", "huber_loss"}
        "up_loss_fn_scale": 1e-2,
        "lat_loss_fn_scale": 1e-2,
        "init_conf": {"name": "trivial"},  # pass config of other models to use as initializer
        # Misc
        "loss_weight": 1,
        "verbose": False,
    }