Skip to content

Commit

Permalink
minor structure changes
Browse files Browse the repository at this point in the history
  • Loading branch information
gaussianBP committed Mar 9, 2020
1 parent 8c5bf7e commit b70e92d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
14 changes: 8 additions & 6 deletions ba.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@
parser.add_argument("--beta", type=float, default=0.01,
help="Threshold for the change in the mean of adjacent beliefs for "
"relinearisation at a factor.")
parser.add_argument("--num_undamped_iters", type=int, default=8,
parser.add_argument("--num_undamped_iters", type=int, default=6,
help="Number of undamped iterations at a factor node after relinearisation.")
parser.add_argument("--min_linear_iters", type=int, default=15,
parser.add_argument("--min_linear_iters", type=int, default=8,
help="Minimum number of iterations between consecutive relinearisations of a factor.")
parser.add_argument("--eta_damping", type=float, default=0.4,
help="Max damping of information vector of messages.")
parser.add_argument("--prior_std_weaker_factor", type=float, default=10.,
help="Ratio of information at measurement factors / information at prior factors.")

parser.add_argument("--prior_std_weaker_factor", type=float, default=50.,
help="Ratio of std of information matrix at measurement factors / "
"std of information matrix at prior factors.")

parser.add_argument("--float_implementation", action='store_true', default=False,
help="Float implementation, so start with strong priors that are weakened")
Expand Down Expand Up @@ -64,7 +66,7 @@


graph = gbp_ba.create_ba_graph(args.bal_file, configs)
print(f'Data: {args.bal_file}\n')
print(f'\nData: {args.bal_file}\n')
print(f'Number of keyframes: {len(graph.cam_nodes)}')
print(f'Number of landmarks: {len(graph.lmk_nodes)}')
print(f'Number of measurement factors: {len(graph.factors)}\n')
Expand All @@ -85,6 +87,7 @@
print('Weakening priors')
graph.weaken_priors(weakening_factor)

# At the start, allow a larger number of iterations before linearising
if i == 3 or i == 8:
for factor in graph.factors:
factor.iters_since_relin = 1
Expand All @@ -101,4 +104,3 @@

graph.synchronous_iteration(robustify=True, local_relin=True)

vis.vis_scene.view_from_graph(graph)
9 changes: 4 additions & 5 deletions gbp/gbp.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
"""
Defines classes for variable nodes, factor nodes and edges and factor graph.
"""

import numpy as np
import scipy.linalg

from utils.gaussian import NdimGaussian

"""
Defines classes for variable nodes, factor nodes and edges.
Then defines function for single iteration of GBP.
"""


class FactorGraph:
def __init__(self,
Expand Down
10 changes: 5 additions & 5 deletions gbp/gbp_ba.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"""
Defines child classes of GBP parent classes for Bundle Adjustment.
Also defines the function to create the factor graph.
"""

import numpy as np
from gbp import gbp, gbp_ba
from gbp.factors import reprojection
from utils import read_balfile

"""
Defines child classes of GBP parent classes for Bundle Adjustment.
Also defines the function to create the factor graph.
"""


class BAFactorGraph(gbp.FactorGraph):
def __init__(self, **kwargs):
Expand Down

0 comments on commit b70e92d

Please sign in to comment.