kopia lustrzana https://github.com/OpenDroneMap/ODM
rodzic
4ff88af0df
commit
aef3da493b
|
@ -392,6 +392,7 @@ class ODM_Stage:
|
||||||
self.update_progress(100.0)
|
self.update_progress(100.0)
|
||||||
|
|
||||||
def update_progress(self, progress):
|
def update_progress(self, progress):
|
||||||
|
progress = max(0.0, min(100.0, progress))
|
||||||
progressbc.send_update(self.previous_stages_progress() +
|
progressbc.send_update(self.previous_stages_progress() +
|
||||||
(self.delta_progress() / 100.0) * float(progress), progress, self.name)
|
(self.delta_progress() / 100.0) * float(progress), progress, self.name)
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,8 @@ class ODMMveStage(types.ODM_Stage):
|
||||||
if not io.dir_exists(tree.mve_views):
|
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})
|
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
|
# Compute mve output scale based on depthmap_resolution
|
||||||
max_width = 0
|
max_width = 0
|
||||||
max_height = 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("Running dense reconstruction. This might take a while. Please be patient, the process is not dead or hung.")
|
||||||
log.ODM_INFO(" Process is running")
|
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})
|
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:
|
self.update_progress(90)
|
||||||
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
|
|
||||||
|
|
||||||
scene2pset_config = [
|
scene2pset_config = [
|
||||||
"-F%s" % mve_output_scale
|
"-F%s" % mve_output_scale
|
||||||
|
|
|
@ -94,6 +94,8 @@ class ODMMvsTexStage(types.ODM_Stage):
|
||||||
'{keepUnseenFaces} '
|
'{keepUnseenFaces} '
|
||||||
'{nadirMode} '
|
'{nadirMode} '
|
||||||
'-n {nadirWeight}'.format(**kwargs))
|
'-n {nadirWeight}'.format(**kwargs))
|
||||||
|
|
||||||
|
self.update_progress(50)
|
||||||
else:
|
else:
|
||||||
log.ODM_WARNING('Found a valid ODM Texture file in: %s'
|
log.ODM_WARNING('Found a valid ODM Texture file in: %s'
|
||||||
% odm_textured_model_obj)
|
% odm_textured_model_obj)
|
||||||
|
|
|
@ -45,6 +45,9 @@ class ODMDEMStage(types.ODM_Stage):
|
||||||
f.write('Threshold: {}\n'.format(args.smrf_threshold))
|
f.write('Threshold: {}\n'.format(args.smrf_threshold))
|
||||||
f.write('Window: {}\n'.format(args.smrf_window))
|
f.write('Window: {}\n'.format(args.smrf_window))
|
||||||
|
|
||||||
|
progress = 20
|
||||||
|
self.update_progress(progress)
|
||||||
|
|
||||||
# Do we need to process anything here?
|
# Do we need to process anything here?
|
||||||
if (args.dsm or args.dtm) and las_model_found:
|
if (args.dsm or args.dtm) and las_model_found:
|
||||||
dsm_output_filename = os.path.join(odm_dem_root, 'dsm.tif')
|
dsm_output_filename = os.path.join(odm_dem_root, 'dsm.tif')
|
||||||
|
@ -95,6 +98,9 @@ class ODMDEMStage(types.ODM_Stage):
|
||||||
commands.compute_euclidean_map(unfilled_dem_path,
|
commands.compute_euclidean_map(unfilled_dem_path,
|
||||||
io.related_file_path(dem_geotiff_path, postfix=".euclideand"),
|
io.related_file_path(dem_geotiff_path, postfix=".euclideand"),
|
||||||
overwrite=True)
|
overwrite=True)
|
||||||
|
|
||||||
|
progress += 30
|
||||||
|
self.update_progress(progress)
|
||||||
else:
|
else:
|
||||||
log.ODM_WARNING('Found existing outputs in: %s' % odm_dem_root)
|
log.ODM_WARNING('Found existing outputs in: %s' % odm_dem_root)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -34,6 +34,8 @@ class ODMeshingStage(types.ODM_Stage):
|
||||||
log.ODM_WARNING('Found a valid ODM Mesh file in: %s' %
|
log.ODM_WARNING('Found a valid ODM Mesh file in: %s' %
|
||||||
tree.odm_mesh)
|
tree.odm_mesh)
|
||||||
|
|
||||||
|
self.update_progress(50)
|
||||||
|
|
||||||
# Always generate a 2.5D mesh
|
# Always generate a 2.5D mesh
|
||||||
# unless --use-3dmesh is set.
|
# unless --use-3dmesh is set.
|
||||||
if not args.use_3dmesh:
|
if not args.use_3dmesh:
|
||||||
|
|
|
@ -23,8 +23,11 @@ class ODMOpenSfMStage(types.ODM_Stage):
|
||||||
octx = OSFMContext(tree.opensfm)
|
octx = OSFMContext(tree.opensfm)
|
||||||
octx.setup(args, tree.dataset_raw, photos, gcp_path=tree.odm_georeferencing_gcp, rerun=self.rerun())
|
octx.setup(args, tree.dataset_raw, photos, gcp_path=tree.odm_georeferencing_gcp, rerun=self.rerun())
|
||||||
octx.extract_metadata(self.rerun())
|
octx.extract_metadata(self.rerun())
|
||||||
|
self.update_progress(20)
|
||||||
octx.feature_matching(self.rerun())
|
octx.feature_matching(self.rerun())
|
||||||
|
self.update_progress(30)
|
||||||
octx.reconstruct(self.rerun())
|
octx.reconstruct(self.rerun())
|
||||||
|
self.update_progress(70)
|
||||||
|
|
||||||
# If we find a special flag file for split/merge we stop right here
|
# 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")):
|
if os.path.exists(octx.path("split_merge_stop_at_reconstruction.txt")):
|
||||||
|
@ -60,6 +63,8 @@ class ODMOpenSfMStage(types.ODM_Stage):
|
||||||
else:
|
else:
|
||||||
log.ODM_WARNING("Found an undistorted directory in %s" % undistorted_images_path)
|
log.ODM_WARNING("Found an undistorted directory in %s" % undistorted_images_path)
|
||||||
|
|
||||||
|
self.update_progress(80)
|
||||||
|
|
||||||
# Skip dense reconstruction if necessary and export
|
# Skip dense reconstruction if necessary and export
|
||||||
# sparse reconstruction instead
|
# sparse reconstruction instead
|
||||||
if args.fast_orthophoto:
|
if args.fast_orthophoto:
|
||||||
|
@ -81,6 +86,8 @@ class ODMOpenSfMStage(types.ODM_Stage):
|
||||||
# check if reconstruction was exported to bundler before
|
# check if reconstruction was exported to bundler before
|
||||||
octx.export_bundler(tree.opensfm_bundle_list, self.rerun())
|
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()):
|
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)
|
octx.run('export_geocoords --transformation --proj \'%s\'' % reconstruction.georef.projection.srs)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -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.setup(args, tree.dataset_raw, photos, gcp_path=tree.odm_georeferencing_gcp, append_config=config, rerun=self.rerun())
|
||||||
octx.extract_metadata(self.rerun())
|
octx.extract_metadata(self.rerun())
|
||||||
|
|
||||||
|
self.update_progress(5)
|
||||||
|
|
||||||
if local_workflow:
|
if local_workflow:
|
||||||
octx.feature_matching(self.rerun())
|
octx.feature_matching(self.rerun())
|
||||||
|
|
||||||
|
self.update_progress(20)
|
||||||
|
|
||||||
# Create submodels
|
# Create submodels
|
||||||
if not io.dir_exists(tree.submodels_path) or self.rerun():
|
if not io.dir_exists(tree.submodels_path) or self.rerun():
|
||||||
if io.dir_exists(tree.submodels_path):
|
if io.dir_exists(tree.submodels_path):
|
||||||
|
@ -84,6 +88,7 @@ class ODMSplitStage(types.ODM_Stage):
|
||||||
|
|
||||||
# Reconstruct each submodel
|
# Reconstruct each submodel
|
||||||
log.ODM_INFO("Dataset has been split into %s submodels. Reconstructing each submodel..." % len(submodel_paths))
|
log.ODM_INFO("Dataset has been split into %s submodels. Reconstructing each submodel..." % len(submodel_paths))
|
||||||
|
self.update_progress(25)
|
||||||
|
|
||||||
if local_workflow:
|
if local_workflow:
|
||||||
for sp in submodel_paths:
|
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.set_projects([os.path.abspath(os.path.join(p, "..")) for p in submodel_paths])
|
||||||
lre.run_reconstruction()
|
lre.run_reconstruction()
|
||||||
|
|
||||||
|
self.update_progress(50)
|
||||||
|
|
||||||
# Align
|
# Align
|
||||||
octx.align_reconstructions(self.rerun())
|
octx.align_reconstructions(self.rerun())
|
||||||
|
|
||||||
|
self.update_progress(55)
|
||||||
|
|
||||||
# Aligned reconstruction is in reconstruction.aligned.json
|
# Aligned reconstruction is in reconstruction.aligned.json
|
||||||
# We need to rename it to reconstruction.json
|
# We need to rename it to reconstruction.json
|
||||||
remove_paths = []
|
remove_paths = []
|
||||||
|
@ -176,6 +185,8 @@ class ODMMergeStage(types.ODM_Stage):
|
||||||
else:
|
else:
|
||||||
log.ODM_WARNING("Found merged point cloud in %s" % tree.odm_georeferencing_model_laz)
|
log.ODM_WARNING("Found merged point cloud in %s" % tree.odm_georeferencing_model_laz)
|
||||||
|
|
||||||
|
self.update_progress(25)
|
||||||
|
|
||||||
# Merge crop bounds
|
# Merge crop bounds
|
||||||
merged_bounds_file = os.path.join(tree.odm_georeferencing, 'odm_georeferenced_model.bounds.gpkg')
|
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():
|
if not io.file_exists(merged_bounds_file) or self.rerun():
|
||||||
|
@ -278,6 +289,8 @@ class ODMMergeStage(types.ODM_Stage):
|
||||||
else:
|
else:
|
||||||
log.ODM_WARNING("Found merged orthophoto in %s" % tree.odm_orthophoto_tif)
|
log.ODM_WARNING("Found merged orthophoto in %s" % tree.odm_orthophoto_tif)
|
||||||
|
|
||||||
|
self.update_progress(75)
|
||||||
|
|
||||||
# Merge DEMs
|
# Merge DEMs
|
||||||
def merge_dems(dem_filename, human_name):
|
def merge_dems(dem_filename, human_name):
|
||||||
if not io.dir_exists(tree.path('odm_dem')):
|
if not io.dir_exists(tree.path('odm_dem')):
|
||||||
|
|
Ładowanie…
Reference in New Issue