Progress updates

Former-commit-id: e7680a79e7
pull/1161/head
Piero Toffanin 2019-05-15 18:01:46 -04:00
rodzic 4ff88af0df
commit aef3da493b
7 zmienionych plików z 36 dodań i 19 usunięć

Wyświetl plik

@ -392,6 +392,7 @@ class ODM_Stage:
self.update_progress(100.0)
def update_progress(self, progress):
progress = max(0.0, min(100.0, progress))
progressbc.send_update(self.previous_stages_progress() +
(self.delta_progress() / 100.0) * float(progress), progress, self.name)

Wyświetl plik

@ -44,6 +44,8 @@ class ODMMveStage(types.ODM_Stage):
if not io.dir_exists(tree.mve_views):
system.run('%s %s %s' % (context.makescene_path, tree.mve_path, tree.mve), env_vars={'OMP_NUM_THREADS': args.max_concurrency})
self.update_progress(10)
# Compute mve output scale based on depthmap_resolution
max_width = 0
max_height = 0
@ -108,25 +110,9 @@ class ODMMveStage(types.ODM_Stage):
log.ODM_INFO("Running dense reconstruction. This might take a while. Please be patient, the process is not dead or hung.")
log.ODM_INFO(" Process is running")
# TODO: find out why MVE is crashing at random
# https://gist.github.com/pierotofy/c49447e86a187e8ede50fb302cf5a47b
# MVE *seems* to have a race condition, triggered randomly, regardless of dataset
# size. Core dump stack trace points to patch_sampler.cc:109.
# Hard to reproduce. Removing -03 optimizations from dmrecon
# seems to reduce the chances of hitting the bug.
# Temporary workaround is to retry the reconstruction until we get it right
# (up to a certain number of retries).
retry_count = 1
while retry_count < 10:
try:
system.run('%s %s %s' % (context.dmrecon_path, ' '.join(dmrecon_config), tree.mve), env_vars={'OMP_NUM_THREADS': args.max_concurrency})
break
except Exception as e:
if str(e) == "Child returned 134" or str(e) == "Child returned 1":
retry_count += 1
log.ODM_WARNING("Caught error code, retrying attempt #%s" % retry_count)
else:
raise e
system.run('%s %s %s' % (context.dmrecon_path, ' '.join(dmrecon_config), tree.mve), env_vars={'OMP_NUM_THREADS': args.max_concurrency})
self.update_progress(90)
scene2pset_config = [
"-F%s" % mve_output_scale

Wyświetl plik

@ -94,6 +94,8 @@ class ODMMvsTexStage(types.ODM_Stage):
'{keepUnseenFaces} '
'{nadirMode} '
'-n {nadirWeight}'.format(**kwargs))
self.update_progress(50)
else:
log.ODM_WARNING('Found a valid ODM Texture file in: %s'
% odm_textured_model_obj)

Wyświetl plik

@ -44,6 +44,9 @@ class ODMDEMStage(types.ODM_Stage):
f.write('Slope: {}\n'.format(args.smrf_slope))
f.write('Threshold: {}\n'.format(args.smrf_threshold))
f.write('Window: {}\n'.format(args.smrf_window))
progress = 20
self.update_progress(progress)
# Do we need to process anything here?
if (args.dsm or args.dtm) and las_model_found:
@ -95,6 +98,9 @@ class ODMDEMStage(types.ODM_Stage):
commands.compute_euclidean_map(unfilled_dem_path,
io.related_file_path(dem_geotiff_path, postfix=".euclideand"),
overwrite=True)
progress += 30
self.update_progress(progress)
else:
log.ODM_WARNING('Found existing outputs in: %s' % odm_dem_root)
else:

Wyświetl plik

@ -33,6 +33,8 @@ class ODMeshingStage(types.ODM_Stage):
else:
log.ODM_WARNING('Found a valid ODM Mesh file in: %s' %
tree.odm_mesh)
self.update_progress(50)
# Always generate a 2.5D mesh
# unless --use-3dmesh is set.

Wyświetl plik

@ -23,8 +23,11 @@ class ODMOpenSfMStage(types.ODM_Stage):
octx = OSFMContext(tree.opensfm)
octx.setup(args, tree.dataset_raw, photos, gcp_path=tree.odm_georeferencing_gcp, rerun=self.rerun())
octx.extract_metadata(self.rerun())
self.update_progress(20)
octx.feature_matching(self.rerun())
self.update_progress(30)
octx.reconstruct(self.rerun())
self.update_progress(70)
# If we find a special flag file for split/merge we stop right here
if os.path.exists(octx.path("split_merge_stop_at_reconstruction.txt")):
@ -60,6 +63,8 @@ class ODMOpenSfMStage(types.ODM_Stage):
else:
log.ODM_WARNING("Found an undistorted directory in %s" % undistorted_images_path)
self.update_progress(80)
# Skip dense reconstruction if necessary and export
# sparse reconstruction instead
if args.fast_orthophoto:
@ -81,6 +86,8 @@ class ODMOpenSfMStage(types.ODM_Stage):
# check if reconstruction was exported to bundler before
octx.export_bundler(tree.opensfm_bundle_list, self.rerun())
self.update_progress(90)
if reconstruction.georef and (not io.file_exists(tree.opensfm_transformation) or self.rerun()):
octx.run('export_geocoords --transformation --proj \'%s\'' % reconstruction.georef.projection.srs)
else:

Wyświetl plik

@ -48,9 +48,13 @@ class ODMSplitStage(types.ODM_Stage):
octx.setup(args, tree.dataset_raw, photos, gcp_path=tree.odm_georeferencing_gcp, append_config=config, rerun=self.rerun())
octx.extract_metadata(self.rerun())
self.update_progress(5)
if local_workflow:
octx.feature_matching(self.rerun())
self.update_progress(20)
# Create submodels
if not io.dir_exists(tree.submodels_path) or self.rerun():
if io.dir_exists(tree.submodels_path):
@ -84,6 +88,7 @@ class ODMSplitStage(types.ODM_Stage):
# Reconstruct each submodel
log.ODM_INFO("Dataset has been split into %s submodels. Reconstructing each submodel..." % len(submodel_paths))
self.update_progress(25)
if local_workflow:
for sp in submodel_paths:
@ -94,9 +99,13 @@ class ODMSplitStage(types.ODM_Stage):
lre.set_projects([os.path.abspath(os.path.join(p, "..")) for p in submodel_paths])
lre.run_reconstruction()
self.update_progress(50)
# Align
octx.align_reconstructions(self.rerun())
self.update_progress(55)
# Aligned reconstruction is in reconstruction.aligned.json
# We need to rename it to reconstruction.json
remove_paths = []
@ -176,6 +185,8 @@ class ODMMergeStage(types.ODM_Stage):
else:
log.ODM_WARNING("Found merged point cloud in %s" % tree.odm_georeferencing_model_laz)
self.update_progress(25)
# Merge crop bounds
merged_bounds_file = os.path.join(tree.odm_georeferencing, 'odm_georeferenced_model.bounds.gpkg')
if not io.file_exists(merged_bounds_file) or self.rerun():
@ -278,6 +289,8 @@ class ODMMergeStage(types.ODM_Stage):
else:
log.ODM_WARNING("Found merged orthophoto in %s" % tree.odm_orthophoto_tif)
self.update_progress(75)
# Merge DEMs
def merge_dems(dem_filename, human_name):
if not io.dir_exists(tree.path('odm_dem')):