merge with cleaned up comments
commit
f8d534e8e5
|
@ -36,14 +36,14 @@ def run(args):
|
||||||
""" Run LM optimization with BAL input data and report resulting error """
|
""" Run LM optimization with BAL input data and report resulting error """
|
||||||
input_file = gtsam.findExampleDataFile(args.input_file)
|
input_file = gtsam.findExampleDataFile(args.input_file)
|
||||||
|
|
||||||
# # Load the SfM data from file
|
# Load the SfM data from file
|
||||||
scene_data = readBal(input_file)
|
scene_data = readBal(input_file)
|
||||||
logging.info(f"read {scene_data.number_tracks()} tracks on {scene_data.number_cameras()} cameras\n")
|
logging.info(f"read {scene_data.number_tracks()} tracks on {scene_data.number_cameras()} cameras\n")
|
||||||
|
|
||||||
# # Create a factor graph
|
# Create a factor graph
|
||||||
graph = gtsam.NonlinearFactorGraph()
|
graph = gtsam.NonlinearFactorGraph()
|
||||||
|
|
||||||
# # We share *one* noiseModel between all projection factors
|
# We share *one* noiseModel between all projection factors
|
||||||
noise = gtsam.noiseModel.Isotropic.Sigma(2, 1.0) # one pixel in u and v
|
noise = gtsam.noiseModel.Isotropic.Sigma(2, 1.0) # one pixel in u and v
|
||||||
|
|
||||||
# Add measurements to the factor graph
|
# Add measurements to the factor graph
|
||||||
|
@ -71,7 +71,7 @@ def run(args):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
# # Create initial estimate
|
# Create initial estimate
|
||||||
initial = gtsam.Values()
|
initial = gtsam.Values()
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
|
@ -97,7 +97,7 @@ def run(args):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.exception("LM Optimization failed")
|
logging.exception("LM Optimization failed")
|
||||||
return
|
return
|
||||||
# Error drops from 2764.22 to 0.046
|
# Error drops from ~2764.22 to ~0.046
|
||||||
logging.info(f"final error: {graph.error(result)}")
|
logging.info(f"final error: {graph.error(result)}")
|
||||||
|
|
||||||
|
|
||||||
|
@ -116,5 +116,3 @@ if __name__ == "__main__":
|
||||||
)
|
)
|
||||||
run(parser.parse_args())
|
run(parser.parse_args())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue