kopia lustrzana https://github.com/OpenDroneMap/ODM
Use max_concurrency option for dem, georef, and ortho modules
rodzic
4262c64840
commit
37504a2a6c
|
@ -72,13 +72,15 @@ class ODMApp(ecto.BlackBox):
|
||||||
'georeferencing': ODMGeoreferencingCell(gcp_file=p.args.gcp,
|
'georeferencing': ODMGeoreferencingCell(gcp_file=p.args.gcp,
|
||||||
use_exif=p.args.use_exif,
|
use_exif=p.args.use_exif,
|
||||||
verbose=p.args.verbose),
|
verbose=p.args.verbose),
|
||||||
'dem': ODMDEMCell(verbose=p.args.verbose),
|
'dem': ODMDEMCell(max_concurrency=p.args.max_concurrency,
|
||||||
|
verbose=p.args.verbose),
|
||||||
'orthophoto': ODMOrthoPhotoCell(resolution=p.args.orthophoto_resolution,
|
'orthophoto': ODMOrthoPhotoCell(resolution=p.args.orthophoto_resolution,
|
||||||
t_srs=p.args.orthophoto_target_srs,
|
t_srs=p.args.orthophoto_target_srs,
|
||||||
no_tiled=p.args.orthophoto_no_tiled,
|
no_tiled=p.args.orthophoto_no_tiled,
|
||||||
compress=p.args.orthophoto_compression,
|
compress=p.args.orthophoto_compression,
|
||||||
bigtiff=p.args.orthophoto_bigtiff,
|
bigtiff=p.args.orthophoto_bigtiff,
|
||||||
build_overviews=p.args.build_overviews,
|
build_overviews=p.args.build_overviews,
|
||||||
|
max_concurrency=p.args.max_concurrency,
|
||||||
verbose=p.args.verbose)
|
verbose=p.args.verbose)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ from opendm.cropper import Cropper
|
||||||
class ODMDEMCell(ecto.Cell):
|
class ODMDEMCell(ecto.Cell):
|
||||||
def declare_params(self, params):
|
def declare_params(self, params):
|
||||||
params.declare("verbose", 'print additional messages to console', False)
|
params.declare("verbose", 'print additional messages to console', False)
|
||||||
|
params.declare("max_concurrency", "Number of threads", context.num_cores)
|
||||||
|
|
||||||
def declare_io(self, params, inputs, outputs):
|
def declare_io(self, params, inputs, outputs):
|
||||||
inputs.declare("tree", "Struct with paths", [])
|
inputs.declare("tree", "Struct with paths", [])
|
||||||
|
@ -116,7 +117,7 @@ class ODMDEMCell(ecto.Cell):
|
||||||
'COMPRESS': 'LZW',
|
'COMPRESS': 'LZW',
|
||||||
'BLOCKXSIZE': 512,
|
'BLOCKXSIZE': 512,
|
||||||
'BLOCKYSIZE': 512,
|
'BLOCKYSIZE': 512,
|
||||||
'NUM_THREADS': 'ALL_CPUS'
|
'NUM_THREADS': self.params.max_concurrency
|
||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
log.ODM_WARNING('Found existing outputs in: %s' % odm_dem_root)
|
log.ODM_WARNING('Found existing outputs in: %s' % odm_dem_root)
|
||||||
|
|
|
@ -18,6 +18,7 @@ class ODMOrthoPhotoCell(ecto.Cell):
|
||||||
params.declare("bigtiff", 'Make BigTIFF orthophoto', 'IF_SAFER')
|
params.declare("bigtiff", 'Make BigTIFF orthophoto', 'IF_SAFER')
|
||||||
params.declare("build_overviews", 'Build overviews', False)
|
params.declare("build_overviews", 'Build overviews', False)
|
||||||
params.declare("verbose", 'print additional messages to console', False)
|
params.declare("verbose", 'print additional messages to console', False)
|
||||||
|
params.declare("max_concurrency", "number of threads", context.num_cores)
|
||||||
|
|
||||||
def declare_io(self, params, inputs, outputs):
|
def declare_io(self, params, inputs, outputs):
|
||||||
inputs.declare("tree", "Struct with paths", [])
|
inputs.declare("tree", "Struct with paths", [])
|
||||||
|
@ -125,7 +126,8 @@ class ODMOrthoPhotoCell(ecto.Cell):
|
||||||
'png': tree.odm_orthophoto_file,
|
'png': tree.odm_orthophoto_file,
|
||||||
'tiff': tree.odm_orthophoto_tif,
|
'tiff': tree.odm_orthophoto_tif,
|
||||||
'log': tree.odm_orthophoto_tif_log,
|
'log': tree.odm_orthophoto_tif_log,
|
||||||
'max_memory': max(5, (100 - virtual_memory().percent) / 2)
|
'max_memory': max(5, (100 - virtual_memory().percent) / 2),
|
||||||
|
'threads': self.params.max_concurrency
|
||||||
}
|
}
|
||||||
|
|
||||||
system.run('gdal_translate -a_ullr {ulx} {uly} {lrx} {lry} '
|
system.run('gdal_translate -a_ullr {ulx} {uly} {lrx} {lry} '
|
||||||
|
@ -135,7 +137,7 @@ class ODMOrthoPhotoCell(ecto.Cell):
|
||||||
'{predictor} '
|
'{predictor} '
|
||||||
'-co BLOCKXSIZE=512 '
|
'-co BLOCKXSIZE=512 '
|
||||||
'-co BLOCKYSIZE=512 '
|
'-co BLOCKYSIZE=512 '
|
||||||
'-co NUM_THREADS=ALL_CPUS '
|
'-co NUM_THREADS={threads} '
|
||||||
'-a_srs \"{proj}\" '
|
'-a_srs \"{proj}\" '
|
||||||
'--config GDAL_CACHEMAX {max_memory}% '
|
'--config GDAL_CACHEMAX {max_memory}% '
|
||||||
'{png} {tiff} > {log}'.format(**kwargs))
|
'{png} {tiff} > {log}'.format(**kwargs))
|
||||||
|
@ -149,7 +151,7 @@ class ODMOrthoPhotoCell(ecto.Cell):
|
||||||
'BIGTIFF': self.params.bigtiff,
|
'BIGTIFF': self.params.bigtiff,
|
||||||
'BLOCKXSIZE': 512,
|
'BLOCKXSIZE': 512,
|
||||||
'BLOCKYSIZE': 512,
|
'BLOCKYSIZE': 512,
|
||||||
'NUM_THREADS': 'ALL_CPUS'
|
'NUM_THREADS': self.params.max_concurrency
|
||||||
})
|
})
|
||||||
|
|
||||||
if self.params.build_overviews:
|
if self.params.build_overviews:
|
||||||
|
|
Ładowanie…
Reference in New Issue