Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use MST initialization with huber loss #802

Open
wants to merge 5 commits into
base: feature/shonan_mst_init
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 9 additions & 5 deletions gtsfm/averaging/rotation/shonan.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,18 @@

_DEFAULT_TWO_VIEW_ROTATION_SIGMA = 1.0

# The threshold for the smallest eigenvalue check in GTSAM. Defaults to -1e-4 in GTSAM.
_OPTIMALITY_THRESHOLD = -1e-5


class ShonanRotationAveraging(RotationAveragingBase):
"""Performs Shonan rotation averaging."""

def __init__(
self,
two_view_rotation_sigma: float = _DEFAULT_TWO_VIEW_ROTATION_SIGMA,
weight_by_inliers: bool = True,
use_mst_init: bool = False,
weight_by_inliers: bool = False,
use_mst_init: bool = True,
) -> None:
"""Initializes module.

Expand All @@ -56,16 +59,17 @@ def __init__(
"""
super().__init__()
self._p_min = 3
self._p_max = 64
self._p_max = 3
self._two_view_rotation_sigma = two_view_rotation_sigma
self._weight_by_inliers = weight_by_inliers
self._use_mst_init = use_mst_init

def __get_shonan_params(self) -> ShonanAveragingParameters3:
lm_params = LevenbergMarquardtParams.CeresDefaults()
shonan_params = ShonanAveragingParameters3(lm_params)
shonan_params.setUseHuber(False)
shonan_params.setCertifyOptimality(True)
shonan_params.setUseHuber(True)
shonan_params.setCertifyOptimality(False)
shonan_params.setOptimalityThreshold(_OPTIMALITY_THRESHOLD)
return shonan_params

def __measurements_from_2view_relative_rotations(
Expand Down
2 changes: 1 addition & 1 deletion gtsfm/configs/unified.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ SceneOptimizer:

rot_avg_module:
_target_: gtsfm.averaging.rotation.shonan.ShonanRotationAveraging
weight_by_inliers: True
weight_by_inliers: False

trans_avg_module:
_target_: gtsfm.averaging.translation.averaging_1dsfm.TranslationAveraging1DSFM
Expand Down
Loading