Skip to content

Commit

Permalink
use str Enum inheritance for config readability
Browse files Browse the repository at this point in the history
  • Loading branch information
johnwlambert committed Jan 25, 2022
1 parent b3e3e78 commit ba1af74
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion gtsfm/configs/deep_front_end.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ SceneOptimizer:
reproj_error_threshold: 10
mode:
_target_: gtsfm.data_association.point3d_initializer.TriangulationSamplingMode
value: 1 # 1 corresponds to RANSAC_SAMPLE_UNIFORM
value: RANSAC_SAMPLE_UNIFORM
max_num_hypotheses: 100
save_track_patches_viz: False

Expand Down
2 changes: 1 addition & 1 deletion gtsfm/configs/deep_front_end_astronet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ SceneOptimizer:
reproj_error_threshold: 100
mode:
_target_: gtsfm.data_association.point3d_initializer.TriangulationSamplingMode
value: 1 # 1 corresponds to RANSAC_SAMPLE_UNIFORM
value: RANSAC_SAMPLE_UNIFORM
max_num_hypotheses: 100
save_track_patches_viz: False

Expand Down
2 changes: 1 addition & 1 deletion gtsfm/configs/scene_optimizer_unit_test_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ SceneOptimizer:
reproj_error_threshold: 10
mode:
_target_: gtsfm.data_association.point3d_initializer.TriangulationSamplingMode
value: 0 # 0 corresponds to NO_RANSAC
value: NO_RANSAC
max_num_hypotheses: 20
save_track_patches_viz: False

Expand Down
2 changes: 1 addition & 1 deletion gtsfm/configs/sift_front_end.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ SceneOptimizer:
reproj_error_threshold: 100
mode:
_target_: gtsfm.data_association.point3d_initializer.TriangulationSamplingMode
value: 1 # 1 corresponds to RANSAC_SAMPLE_UNIFORM
value: RANSAC_SAMPLE_UNIFORM
max_num_hypotheses: 100
save_track_patches_viz: False

Expand Down
18 changes: 12 additions & 6 deletions gtsfm/data_association/point3d_initializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,19 @@ class TriangulationExitCode(Enum):
EXCEEDS_REPROJ_THRESH = 4 # estimated 3d point exceeds reprojection threshold


class TriangulationSamplingMode(Enum):
"""Triangulation modes."""
class TriangulationSamplingMode(str, Enum):
"""Triangulation modes.
NO_RANSAC = 0 # do not use filtering
RANSAC_SAMPLE_UNIFORM = 1 # sample a pair of cameras uniformly at random
RANSAC_SAMPLE_BIASED_BASELINE = 2 # sample pair of cameras based on largest estimated baseline
RANSAC_TOPK_BASELINES = 3 # deterministically choose hypotheses with largest estimate baseline
NO_RANSAC: do not use filtering.
RANSAC_SAMPLE_UNIFORM: sample a pair of cameras uniformly at random.
RANSAC_SAMPLE_BIASED_BASELINE: sample pair of cameras based by largest estimated baseline.
RANSAC_TOPK_BASELINES: deterministically choose hypotheses with largest estimate baseline.
"""

NO_RANSAC = "NO_RANSAC"
RANSAC_SAMPLE_UNIFORM = "RANSAC_SAMPLE_UNIFORM"
RANSAC_SAMPLE_BIASED_BASELINE = "RANSAC_SAMPLE_BIASED_BASELINE"
RANSAC_TOPK_BASELINES = "RANSAC_TOPK_BASELINES"


class TriangulationOptions(NamedTuple):
Expand Down

0 comments on commit ba1af74

Please sign in to comment.