cars 1.0.0a1__cp313-cp313-win_amd64.whl → 1.0.0a3__cp313-cp313-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of cars might be problematic. Click here for more details.
- cars/__init__.py +4 -4
- cars/applications/application.py +14 -6
- cars/applications/application_template.py +22 -0
- cars/applications/auxiliary_filling/auxiliary_filling_from_sensors_app.py +15 -10
- cars/applications/auxiliary_filling/auxiliary_filling_wrappers.py +7 -6
- cars/applications/dem_generation/abstract_dem_generation_app.py +9 -5
- cars/applications/dem_generation/dem_generation_wrappers.py +48 -25
- cars/applications/dem_generation/dichotomic_generation_app.py +27 -9
- cars/applications/dem_generation/rasterization_app.py +85 -32
- cars/applications/dense_match_filling/abstract_dense_match_filling_app.py +4 -0
- cars/applications/dense_match_filling/cpp/dense_match_filling_cpp.cp313-win_amd64.dll.a +0 -0
- cars/applications/dense_match_filling/cpp/dense_match_filling_cpp.cp313-win_amd64.pyd +0 -0
- cars/applications/dense_match_filling/fill_disp_algo.py +41 -12
- cars/applications/dense_match_filling/plane_app.py +11 -0
- cars/applications/dense_match_filling/zero_padding_app.py +11 -1
- cars/applications/dense_matching/census_mccnn_sgm_app.py +254 -548
- cars/applications/dense_matching/cpp/dense_matching_cpp.cp313-win_amd64.dll.a +0 -0
- cars/applications/dense_matching/cpp/dense_matching_cpp.cp313-win_amd64.pyd +0 -0
- cars/applications/dense_matching/dense_matching_algo.py +59 -11
- cars/applications/dense_matching/dense_matching_wrappers.py +51 -31
- cars/applications/dense_matching/disparity_grid_algo.py +566 -0
- cars/applications/dense_matching/loaders/config_mapping.json +13 -0
- cars/applications/dense_matching/loaders/global_land_cover_map.tif +0 -0
- cars/applications/dense_matching/loaders/pandora_loader.py +78 -1
- cars/applications/dsm_filling/border_interpolation_app.py +10 -5
- cars/applications/dsm_filling/bulldozer_filling_app.py +14 -7
- cars/applications/dsm_filling/exogenous_filling_app.py +10 -5
- cars/applications/grid_generation/grid_correction_app.py +0 -53
- cars/applications/grid_generation/transform_grid.py +5 -5
- cars/applications/point_cloud_fusion/pc_fusion_algo.py +17 -11
- cars/applications/point_cloud_fusion/pc_fusion_wrappers.py +3 -4
- cars/applications/point_cloud_outlier_removal/abstract_outlier_removal_app.py +9 -5
- cars/applications/point_cloud_outlier_removal/small_components_app.py +5 -3
- cars/applications/point_cloud_outlier_removal/statistical_app.py +4 -2
- cars/applications/rasterization/abstract_pc_rasterization_app.py +1 -0
- cars/applications/rasterization/rasterization_algo.py +20 -27
- cars/applications/rasterization/rasterization_wrappers.py +6 -5
- cars/applications/rasterization/simple_gaussian_app.py +30 -17
- cars/applications/resampling/resampling_algo.py +44 -49
- cars/applications/sparse_matching/sift_app.py +2 -22
- cars/applications/sparse_matching/sparse_matching_wrappers.py +0 -49
- cars/applications/triangulation/line_of_sight_intersection_app.py +1 -1
- cars/applications/triangulation/triangulation_wrappers.py +2 -1
- cars/bundleadjustment.py +51 -11
- cars/cars.py +15 -5
- cars/core/constants.py +1 -1
- cars/core/geometry/abstract_geometry.py +166 -12
- cars/core/geometry/shareloc_geometry.py +61 -14
- cars/core/inputs.py +15 -0
- cars/core/projection.py +117 -0
- cars/data_structures/cars_dataset.py +7 -5
- cars/orchestrator/cluster/log_wrapper.py +1 -1
- cars/orchestrator/cluster/mp_cluster/multiprocessing_cluster.py +1 -1
- cars/orchestrator/orchestrator.py +1 -1
- cars/orchestrator/registry/saver_registry.py +0 -78
- cars/pipelines/default/default_pipeline.py +69 -52
- cars/pipelines/parameters/advanced_parameters.py +17 -0
- cars/pipelines/parameters/advanced_parameters_constants.py +4 -0
- cars/pipelines/parameters/depth_map_inputs.py +22 -67
- cars/pipelines/parameters/dsm_inputs.py +16 -29
- cars/pipelines/parameters/output_parameters.py +44 -8
- cars/pipelines/parameters/sensor_inputs.py +117 -24
- cars/pipelines/parameters/sensor_loaders/basic_sensor_loader.py +3 -3
- cars/pipelines/parameters/sensor_loaders/pivot_sensor_loader.py +2 -2
- cars/pipelines/parameters/sensor_loaders/sensor_loader.py +4 -6
- cars/pipelines/parameters/sensor_loaders/sensor_loader_template.py +2 -2
- cars/pipelines/pipeline.py +8 -8
- cars/pipelines/unit/unit_pipeline.py +276 -274
- cars/starter.py +20 -1
- cars-1.0.0a3.dist-info/DELVEWHEEL +2 -0
- {cars-1.0.0a1.dist-info → cars-1.0.0a3.dist-info}/METADATA +3 -2
- {cars-1.0.0a1.dist-info → cars-1.0.0a3.dist-info}/RECORD +77 -74
- cars.libs/libgcc_s_seh-1-ca70890bbc5723b6d0ea31e9c9cded2b.dll +0 -0
- cars.libs/libstdc++-6-00ee19f73d5122a1277c137b1c218401.dll +0 -0
- cars.libs/libwinpthread-1-f5042e8e3d21edce20c1bc99445f551b.dll +0 -0
- cars-1.0.0a1.dist-info/DELVEWHEEL +0 -2
- cars.libs/libgcc_s_seh-1-f2b6825d483bdf14050493af93b5997d.dll +0 -0
- cars.libs/libstdc++-6-6b0059df6bc601df5a0f18a5805eea05.dll +0 -0
- cars.libs/libwinpthread-1-e01b8e85fd67c2b861f64d4ccc7df607.dll +0 -0
- {cars-1.0.0a1.dist-info → cars-1.0.0a3.dist-info}/WHEEL +0 -0
- {cars-1.0.0a1.dist-info → cars-1.0.0a3.dist-info}/entry_points.txt +0 -0
|
@@ -24,13 +24,15 @@ Used for full_res and low_res pipelines
|
|
|
24
24
|
"""
|
|
25
25
|
|
|
26
26
|
import logging
|
|
27
|
+
import math
|
|
27
28
|
import os
|
|
28
29
|
|
|
30
|
+
import numpy as np
|
|
29
31
|
import rasterio as rio
|
|
30
32
|
from json_checker import Checker, OptionalKey, Or
|
|
31
33
|
|
|
32
34
|
# CARS imports
|
|
33
|
-
from cars.core import inputs, preprocessing, roi_tools
|
|
35
|
+
from cars.core import inputs, preprocessing, projection, roi_tools
|
|
34
36
|
from cars.core.geometry.abstract_geometry import AbstractGeometry
|
|
35
37
|
from cars.core.utils import make_relative_path_absolute
|
|
36
38
|
from cars.pipelines.parameters import (
|
|
@@ -42,14 +44,14 @@ from cars.pipelines.parameters.sensor_loaders.sensor_loader import SensorLoader
|
|
|
42
44
|
CARS_GEOID_PATH = "geoid/egm96.grd" # Path in cars package (pkg)
|
|
43
45
|
|
|
44
46
|
|
|
45
|
-
def sensors_check_inputs(conf,
|
|
47
|
+
def sensors_check_inputs(conf, config_dir=None): # noqa: C901
|
|
46
48
|
"""
|
|
47
49
|
Check the inputs given
|
|
48
50
|
|
|
49
51
|
:param conf: configuration of inputs
|
|
50
52
|
:type conf: dict
|
|
51
|
-
:param
|
|
52
|
-
:type
|
|
53
|
+
:param config_dir: path to dir containing json
|
|
54
|
+
:type config_dir: str
|
|
53
55
|
"""
|
|
54
56
|
|
|
55
57
|
overloaded_conf = conf.copy()
|
|
@@ -74,7 +76,7 @@ def sensors_check_inputs(conf, config_json_dir=None): # noqa: C901
|
|
|
74
76
|
checker_inputs = Checker(inputs_schema)
|
|
75
77
|
checker_inputs.validate(overloaded_conf)
|
|
76
78
|
|
|
77
|
-
check_sensors(conf, overloaded_conf,
|
|
79
|
+
check_sensors(conf, overloaded_conf, config_dir)
|
|
78
80
|
|
|
79
81
|
# Check srtm dir
|
|
80
82
|
check_srtm(overloaded_conf[sens_cst.INITIAL_ELEVATION][sens_cst.DEM_PATH])
|
|
@@ -82,7 +84,7 @@ def sensors_check_inputs(conf, config_json_dir=None): # noqa: C901
|
|
|
82
84
|
return overloaded_conf
|
|
83
85
|
|
|
84
86
|
|
|
85
|
-
def check_sensors(conf, overloaded_conf,
|
|
87
|
+
def check_sensors(conf, overloaded_conf, config_dir=None): # noqa: C901
|
|
86
88
|
"""
|
|
87
89
|
Check sensors
|
|
88
90
|
|
|
@@ -116,9 +118,7 @@ def check_sensors(conf, overloaded_conf, config_json_dir=None): # noqa: C901
|
|
|
116
118
|
loader_name = image.get("loader", "basic")
|
|
117
119
|
else:
|
|
118
120
|
raise TypeError(f"Image {image} is not of type str or dict")
|
|
119
|
-
image_loader = SensorLoader(
|
|
120
|
-
loader_name, image, "image", config_json_dir
|
|
121
|
-
)
|
|
121
|
+
image_loader = SensorLoader(loader_name, image, "image", config_dir)
|
|
122
122
|
image_as_pivot_format = (
|
|
123
123
|
image_loader.get_pivot_format() # pylint: disable=E1101
|
|
124
124
|
)
|
|
@@ -153,7 +153,7 @@ def check_sensors(conf, overloaded_conf, config_json_dir=None): # noqa: C901
|
|
|
153
153
|
else:
|
|
154
154
|
raise TypeError(f"Classif {classif} is not of type str or dict")
|
|
155
155
|
classif_loader = SensorLoader(
|
|
156
|
-
loader_name, classif, "classification",
|
|
156
|
+
loader_name, classif, "classification", config_dir
|
|
157
157
|
)
|
|
158
158
|
classif_as_pivot_format = (
|
|
159
159
|
classif_loader.get_pivot_format() # pylint: disable=E1101
|
|
@@ -172,8 +172,8 @@ def check_sensors(conf, overloaded_conf, config_json_dir=None): # noqa: C901
|
|
|
172
172
|
)
|
|
173
173
|
|
|
174
174
|
# Modify to absolute path
|
|
175
|
-
if
|
|
176
|
-
modify_to_absolute_path(
|
|
175
|
+
if config_dir is not None:
|
|
176
|
+
modify_to_absolute_path(config_dir, overloaded_conf)
|
|
177
177
|
|
|
178
178
|
# Check image, msk and color size compatibility
|
|
179
179
|
for sensor_image_key in overloaded_conf[sens_cst.SENSORS]:
|
|
@@ -220,8 +220,8 @@ def check_sensors(conf, overloaded_conf, config_json_dir=None): # noqa: C901
|
|
|
220
220
|
raise RuntimeError("{} not in sensors images".format(key2))
|
|
221
221
|
|
|
222
222
|
# Modify to absolute path
|
|
223
|
-
if
|
|
224
|
-
modify_to_absolute_path(
|
|
223
|
+
if config_dir is not None:
|
|
224
|
+
modify_to_absolute_path(config_dir, overloaded_conf)
|
|
225
225
|
else:
|
|
226
226
|
logging.debug(
|
|
227
227
|
"path of config file was not given,"
|
|
@@ -237,6 +237,65 @@ def check_sensors(conf, overloaded_conf, config_json_dir=None): # noqa: C901
|
|
|
237
237
|
return overloaded_conf
|
|
238
238
|
|
|
239
239
|
|
|
240
|
+
def get_sensor_resolution(
|
|
241
|
+
geom_plugin, sensor_path, geomodel, target_epsg=32631
|
|
242
|
+
):
|
|
243
|
+
"""
|
|
244
|
+
Estimate the sensor image resolution in meters per pixel
|
|
245
|
+
using geolocation of 3 corners of the image.
|
|
246
|
+
|
|
247
|
+
:param geom_plugin: geometry plugin instance
|
|
248
|
+
:param sensor_path: path to the sensor image
|
|
249
|
+
:type sensor_path: dict
|
|
250
|
+
:param geomodel: geometric model for the sensor image
|
|
251
|
+
:param target_epsg: target EPSG code for projection
|
|
252
|
+
:type target_epsg: int
|
|
253
|
+
:return: average resolution in meters/pixel along x and y
|
|
254
|
+
:rtype: float
|
|
255
|
+
"""
|
|
256
|
+
width, height = inputs.rasterio_get_size(sensor_path[sens_cst.MAIN_FILE])
|
|
257
|
+
|
|
258
|
+
upper_left = (0.5, 0.5)
|
|
259
|
+
upper_right = (width - 0.5, 0.5)
|
|
260
|
+
bottom_left = (0.5, height - 0.5)
|
|
261
|
+
|
|
262
|
+
# get geodetic coordinates
|
|
263
|
+
lat_ul, lon_ul, _ = geom_plugin.direct_loc(
|
|
264
|
+
sensor_path[sens_cst.MAIN_FILE],
|
|
265
|
+
geomodel,
|
|
266
|
+
np.array([upper_left[0]]),
|
|
267
|
+
np.array([upper_left[1]]),
|
|
268
|
+
)
|
|
269
|
+
lat_ur, lon_ur, _ = geom_plugin.direct_loc(
|
|
270
|
+
sensor_path[sens_cst.MAIN_FILE],
|
|
271
|
+
geomodel,
|
|
272
|
+
np.array([upper_right[0]]),
|
|
273
|
+
np.array([upper_right[1]]),
|
|
274
|
+
)
|
|
275
|
+
lat_bl, lon_bl, _ = geom_plugin.direct_loc(
|
|
276
|
+
sensor_path[sens_cst.MAIN_FILE],
|
|
277
|
+
geomodel,
|
|
278
|
+
np.array([bottom_left[0]]),
|
|
279
|
+
np.array([bottom_left[1]]),
|
|
280
|
+
)
|
|
281
|
+
|
|
282
|
+
coords_ll = np.array(
|
|
283
|
+
[[lon_ul, lat_ul, 0], [lon_ur, lat_ur, 0], [lon_bl, lat_bl, 0]]
|
|
284
|
+
)
|
|
285
|
+
|
|
286
|
+
# Convert to target CRS
|
|
287
|
+
coords_xy = projection.point_cloud_conversion(coords_ll, 4326, target_epsg)
|
|
288
|
+
|
|
289
|
+
diff_x = np.linalg.norm(coords_xy[1] - coords_xy[0]) # UL to UR (width)
|
|
290
|
+
diff_y = np.linalg.norm(coords_xy[2] - coords_xy[0]) # UL to BL (height)
|
|
291
|
+
|
|
292
|
+
# resolution in meters per pixel
|
|
293
|
+
res_x = diff_x / (width - 1)
|
|
294
|
+
res_y = diff_y / (height - 1)
|
|
295
|
+
|
|
296
|
+
return (res_x + res_y) / 2
|
|
297
|
+
|
|
298
|
+
|
|
240
299
|
def check_geometry_plugin(conf_inputs, conf_geom_plugin):
|
|
241
300
|
"""
|
|
242
301
|
Check the geometry plugin with inputs
|
|
@@ -255,11 +314,40 @@ def check_geometry_plugin(conf_inputs, conf_geom_plugin):
|
|
|
255
314
|
if conf_geom_plugin is None:
|
|
256
315
|
conf_geom_plugin = "SharelocGeometry"
|
|
257
316
|
|
|
317
|
+
# Initialize a temporary plugin, to get the product's resolution
|
|
318
|
+
temp_geom_plugin = (
|
|
319
|
+
AbstractGeometry( # pylint: disable=abstract-class-instantiated
|
|
320
|
+
conf_geom_plugin,
|
|
321
|
+
default_alt=sens_cst.CARS_DEFAULT_ALT,
|
|
322
|
+
)
|
|
323
|
+
)
|
|
324
|
+
average_sensor_resolution = 0
|
|
325
|
+
for _, sensor_image in conf_inputs[sens_cst.SENSORS].items():
|
|
326
|
+
sensor = sensor_image[sens_cst.INPUT_IMG]
|
|
327
|
+
geomodel = sensor_image[sens_cst.INPUT_GEO_MODEL]
|
|
328
|
+
(
|
|
329
|
+
sensor,
|
|
330
|
+
geomodel,
|
|
331
|
+
) = temp_geom_plugin.check_product_consistency(sensor, geomodel)
|
|
332
|
+
average_sensor_resolution += get_sensor_resolution(
|
|
333
|
+
temp_geom_plugin, sensor, geomodel
|
|
334
|
+
)
|
|
335
|
+
average_sensor_resolution /= len(conf_inputs[sens_cst.SENSORS])
|
|
336
|
+
# approximate resolution to the highest digit:
|
|
337
|
+
# 0.47 -> 0.5
|
|
338
|
+
# 7.52 -> 8
|
|
339
|
+
# 12.9 -> 10
|
|
340
|
+
nb_digits = int(math.floor(math.log10(abs(average_sensor_resolution))))
|
|
341
|
+
scaling_coeff = round(average_sensor_resolution, -nb_digits)
|
|
342
|
+
# make it so 0.5 (CO3D) is the baseline for parameters
|
|
343
|
+
scaling_coeff *= 2
|
|
344
|
+
|
|
258
345
|
# Initialize the desired geometry plugin without elevation information
|
|
259
346
|
geom_plugin_without_dem_and_geoid = (
|
|
260
347
|
AbstractGeometry( # pylint: disable=abstract-class-instantiated
|
|
261
348
|
conf_geom_plugin,
|
|
262
349
|
default_alt=sens_cst.CARS_DEFAULT_ALT,
|
|
350
|
+
scaling_coeff=scaling_coeff,
|
|
263
351
|
)
|
|
264
352
|
)
|
|
265
353
|
|
|
@@ -282,7 +370,7 @@ def check_geometry_plugin(conf_inputs, conf_geom_plugin):
|
|
|
282
370
|
] = geomodel
|
|
283
371
|
|
|
284
372
|
geom_plugin_with_dem_and_geoid = generate_geometry_plugin_with_dem(
|
|
285
|
-
conf_geom_plugin, conf_inputs
|
|
373
|
+
conf_geom_plugin, conf_inputs, scaling_coeff=scaling_coeff
|
|
286
374
|
)
|
|
287
375
|
|
|
288
376
|
# Check dem is big enough
|
|
@@ -346,11 +434,12 @@ def check_geometry_plugin(conf_inputs, conf_geom_plugin):
|
|
|
346
434
|
geom_plugin_without_dem_and_geoid,
|
|
347
435
|
geom_plugin_with_dem_and_geoid,
|
|
348
436
|
dem_generation_roi_poly,
|
|
437
|
+
scaling_coeff,
|
|
349
438
|
)
|
|
350
439
|
|
|
351
440
|
|
|
352
441
|
def generate_geometry_plugin_with_dem(
|
|
353
|
-
conf_geom_plugin, conf_inputs, dem=None, crop_dem=True
|
|
442
|
+
conf_geom_plugin, conf_inputs, dem=None, crop_dem=True, scaling_coeff=1
|
|
354
443
|
):
|
|
355
444
|
"""
|
|
356
445
|
Generate geometry plugin with dem and geoid
|
|
@@ -358,6 +447,8 @@ def generate_geometry_plugin_with_dem(
|
|
|
358
447
|
:param conf_geom_plugin: plugin configuration
|
|
359
448
|
:param conf_inputs: inputs configuration
|
|
360
449
|
:param dem: dem to overide the one in inputs
|
|
450
|
+
:param scaling_coeff: scaling factor for resolution
|
|
451
|
+
:type scaling_coeff: float
|
|
361
452
|
|
|
362
453
|
:return: geometry plugin object, with a dem
|
|
363
454
|
"""
|
|
@@ -383,6 +474,7 @@ def generate_geometry_plugin_with_dem(
|
|
|
383
474
|
pairs_for_roi = None
|
|
384
475
|
|
|
385
476
|
# Initialize a second geometry plugin with elevation information
|
|
477
|
+
|
|
386
478
|
geom_plugin_with_dem_and_geoid = (
|
|
387
479
|
AbstractGeometry( # pylint: disable=abstract-class-instantiated
|
|
388
480
|
conf_geom_plugin,
|
|
@@ -390,18 +482,19 @@ def generate_geometry_plugin_with_dem(
|
|
|
390
482
|
geoid=conf_inputs[sens_cst.INITIAL_ELEVATION][sens_cst.GEOID],
|
|
391
483
|
default_alt=sens_cst.CARS_DEFAULT_ALT,
|
|
392
484
|
pairs_for_roi=pairs_for_roi,
|
|
485
|
+
scaling_coeff=scaling_coeff,
|
|
393
486
|
)
|
|
394
487
|
)
|
|
395
488
|
|
|
396
489
|
return geom_plugin_with_dem_and_geoid
|
|
397
490
|
|
|
398
491
|
|
|
399
|
-
def modify_to_absolute_path(
|
|
492
|
+
def modify_to_absolute_path(config_dir, overloaded_conf):
|
|
400
493
|
"""
|
|
401
494
|
Modify input file path to absolute path
|
|
402
495
|
|
|
403
|
-
:param
|
|
404
|
-
:type
|
|
496
|
+
:param config_dir: directory of the json configuration
|
|
497
|
+
:type config_dir: str
|
|
405
498
|
:param overloaded_conf: overloaded configuration json
|
|
406
499
|
:dict overloaded_conf: dict
|
|
407
500
|
"""
|
|
@@ -414,11 +507,11 @@ def modify_to_absolute_path(config_json_dir, overloaded_conf):
|
|
|
414
507
|
]:
|
|
415
508
|
if isinstance(sensor_image[tag], dict):
|
|
416
509
|
sensor_image[tag]["path"] = make_relative_path_absolute(
|
|
417
|
-
sensor_image[tag]["path"],
|
|
510
|
+
sensor_image[tag]["path"], config_dir
|
|
418
511
|
)
|
|
419
512
|
elif sensor_image[tag] is not None:
|
|
420
513
|
sensor_image[tag] = make_relative_path_absolute(
|
|
421
|
-
sensor_image[tag],
|
|
514
|
+
sensor_image[tag], config_dir
|
|
422
515
|
)
|
|
423
516
|
for tag in [
|
|
424
517
|
sens_cst.INPUT_IMG,
|
|
@@ -429,14 +522,14 @@ def modify_to_absolute_path(config_json_dir, overloaded_conf):
|
|
|
429
522
|
sensor_image[tag]["bands"][band]["path"] = (
|
|
430
523
|
make_relative_path_absolute(
|
|
431
524
|
sensor_image[tag]["bands"][band]["path"],
|
|
432
|
-
|
|
525
|
+
config_dir,
|
|
433
526
|
)
|
|
434
527
|
)
|
|
435
528
|
|
|
436
529
|
if overloaded_conf[sens_cst.ROI] is not None:
|
|
437
530
|
if isinstance(overloaded_conf[sens_cst.ROI], str):
|
|
438
531
|
overloaded_conf[sens_cst.ROI] = make_relative_path_absolute(
|
|
439
|
-
overloaded_conf[sens_cst.ROI],
|
|
532
|
+
overloaded_conf[sens_cst.ROI], config_dir
|
|
440
533
|
)
|
|
441
534
|
|
|
442
535
|
for tag in [sens_cst.DEM_PATH, sens_cst.GEOID]:
|
|
@@ -447,7 +540,7 @@ def modify_to_absolute_path(config_json_dir, overloaded_conf):
|
|
|
447
540
|
overloaded_conf[sens_cst.INITIAL_ELEVATION][tag] = (
|
|
448
541
|
make_relative_path_absolute(
|
|
449
542
|
overloaded_conf[sens_cst.INITIAL_ELEVATION][tag],
|
|
450
|
-
|
|
543
|
+
config_dir,
|
|
451
544
|
)
|
|
452
545
|
)
|
|
453
546
|
|
|
@@ -53,7 +53,7 @@ class BasicSensorLoader(SensorLoaderTemplate):
|
|
|
53
53
|
"""
|
|
54
54
|
if isinstance(conf, str):
|
|
55
55
|
overloaded_conf = {}
|
|
56
|
-
image_path = make_relative_path_absolute(conf, self.
|
|
56
|
+
image_path = make_relative_path_absolute(conf, self.config_dir)
|
|
57
57
|
overloaded_conf["path"] = image_path
|
|
58
58
|
overloaded_conf["loader"] = "basic"
|
|
59
59
|
if self.input_type == "image":
|
|
@@ -63,7 +63,7 @@ class BasicSensorLoader(SensorLoaderTemplate):
|
|
|
63
63
|
elif isinstance(conf, dict):
|
|
64
64
|
overloaded_conf = conf.copy()
|
|
65
65
|
image_path = make_relative_path_absolute(
|
|
66
|
-
conf["path"], self.
|
|
66
|
+
conf["path"], self.config_dir
|
|
67
67
|
)
|
|
68
68
|
overloaded_conf["path"] = image_path
|
|
69
69
|
overloaded_conf["loader"] = conf.get("loader", "basic")
|
|
@@ -103,6 +103,6 @@ class BasicSensorLoader(SensorLoaderTemplate):
|
|
|
103
103
|
}
|
|
104
104
|
pivot_config["texture_bands"] = None
|
|
105
105
|
pivot_sensor_loader = PivotSensorLoader(
|
|
106
|
-
pivot_config, self.input_type, self.
|
|
106
|
+
pivot_config, self.input_type, self.config_dir
|
|
107
107
|
)
|
|
108
108
|
self.pivot_format = pivot_sensor_loader.get_pivot_format()
|
|
@@ -53,7 +53,7 @@ class PivotSensorLoader(SensorLoaderTemplate):
|
|
|
53
53
|
for band in overloaded_conf["bands"]:
|
|
54
54
|
overloaded_conf["bands"][band]["path"] = (
|
|
55
55
|
make_relative_path_absolute(
|
|
56
|
-
overloaded_conf["bands"][band]["path"], self.
|
|
56
|
+
overloaded_conf["bands"][band]["path"], self.config_dir
|
|
57
57
|
)
|
|
58
58
|
)
|
|
59
59
|
# Check consistency between files
|
|
@@ -92,7 +92,7 @@ class PivotSensorLoader(SensorLoaderTemplate):
|
|
|
92
92
|
]
|
|
93
93
|
else:
|
|
94
94
|
overloaded_conf["main_file"] = make_relative_path_absolute(
|
|
95
|
-
overloaded_conf["main_file"], self.
|
|
95
|
+
overloaded_conf["main_file"], self.config_dir
|
|
96
96
|
)
|
|
97
97
|
overloaded_conf["texture_bands"] = conf.get("texture_bands", None)
|
|
98
98
|
if overloaded_conf["texture_bands"] is not None:
|
|
@@ -39,7 +39,7 @@ class SensorLoader:
|
|
|
39
39
|
available_loaders = {}
|
|
40
40
|
|
|
41
41
|
def __new__(
|
|
42
|
-
cls, app_name: str, cfg: dict, input_type: str,
|
|
42
|
+
cls, app_name: str, cfg: dict, input_type: str, config_dir: str
|
|
43
43
|
):
|
|
44
44
|
"""
|
|
45
45
|
Return the instance of sensor loader associated with the sensor loader
|
|
@@ -51,12 +51,10 @@ class SensorLoader:
|
|
|
51
51
|
:type cfg: dictionary
|
|
52
52
|
"""
|
|
53
53
|
|
|
54
|
-
return cls.create_app(app_name, cfg, input_type,
|
|
54
|
+
return cls.create_app(app_name, cfg, input_type, config_dir)
|
|
55
55
|
|
|
56
56
|
@classmethod
|
|
57
|
-
def create_app(
|
|
58
|
-
cls, name: str, cfg: dict, input_type: str, config_json_dir: str
|
|
59
|
-
):
|
|
57
|
+
def create_app(cls, name: str, cfg: dict, input_type: str, config_dir: str):
|
|
60
58
|
"""
|
|
61
59
|
Factory command to create the sensor loader
|
|
62
60
|
Return the instance of sensor loader associated with the sensor loader
|
|
@@ -74,7 +72,7 @@ class SensorLoader:
|
|
|
74
72
|
except KeyError:
|
|
75
73
|
logging.error("No sensor loader named {0} supported".format(name))
|
|
76
74
|
return None
|
|
77
|
-
loader = loader_class(cfg, input_type,
|
|
75
|
+
loader = loader_class(cfg, input_type, config_dir)
|
|
78
76
|
return loader
|
|
79
77
|
|
|
80
78
|
@classmethod
|
|
@@ -30,7 +30,7 @@ class SensorLoaderTemplate:
|
|
|
30
30
|
Class for general specification of a sensor loader
|
|
31
31
|
"""
|
|
32
32
|
|
|
33
|
-
def __init__(self, conf, input_type,
|
|
33
|
+
def __init__(self, conf, input_type, config_dir):
|
|
34
34
|
"""
|
|
35
35
|
Init function of SensorLoaderTemplate
|
|
36
36
|
|
|
@@ -38,7 +38,7 @@ class SensorLoaderTemplate:
|
|
|
38
38
|
:param input_type: type of input : image or classification
|
|
39
39
|
"""
|
|
40
40
|
self.input_type = input_type
|
|
41
|
-
self.
|
|
41
|
+
self.config_dir = config_dir
|
|
42
42
|
self.used_config = self.check_conf(conf)
|
|
43
43
|
|
|
44
44
|
self.pivot_format = None
|
cars/pipelines/pipeline.py
CHANGED
|
@@ -43,7 +43,7 @@ class Pipeline:
|
|
|
43
43
|
cls,
|
|
44
44
|
pipeline_name: str,
|
|
45
45
|
cfg: Dict[str, Union[str, int]],
|
|
46
|
-
|
|
46
|
+
config_dir,
|
|
47
47
|
):
|
|
48
48
|
"""
|
|
49
49
|
Return the instance of pipeline associated with the pipeline
|
|
@@ -53,15 +53,15 @@ class Pipeline:
|
|
|
53
53
|
:type pipeline_name: str
|
|
54
54
|
:param cfg: configuration {'matching_cost_method': value}
|
|
55
55
|
:type cfg: dictionary
|
|
56
|
-
:param
|
|
57
|
-
:type
|
|
56
|
+
:param config_dir: path to dir containing json or yaml file
|
|
57
|
+
:type config_dir: str
|
|
58
58
|
"""
|
|
59
59
|
|
|
60
|
-
return cls.create_pipeline(pipeline_name, cfg,
|
|
60
|
+
return cls.create_pipeline(pipeline_name, cfg, config_dir)
|
|
61
61
|
|
|
62
62
|
@classmethod
|
|
63
63
|
def create_pipeline(
|
|
64
|
-
cls, name: str, cfg: Dict[str, Union[str, int]],
|
|
64
|
+
cls, name: str, cfg: Dict[str, Union[str, int]], config_dir
|
|
65
65
|
):
|
|
66
66
|
"""Factory command to create the pipeline
|
|
67
67
|
Return the instance of pipeline associated with the pipeline
|
|
@@ -71,8 +71,8 @@ class Pipeline:
|
|
|
71
71
|
:type pipeline_name: str
|
|
72
72
|
:param cfg: cars input configuration
|
|
73
73
|
:type cfg: dictionary
|
|
74
|
-
:param
|
|
75
|
-
:type
|
|
74
|
+
:param config_dir: path to dir containing json
|
|
75
|
+
:type config_dir: str
|
|
76
76
|
"""
|
|
77
77
|
|
|
78
78
|
pipeline = None
|
|
@@ -85,7 +85,7 @@ class Pipeline:
|
|
|
85
85
|
"No pipeline named {0} supported".format(name)
|
|
86
86
|
) from kerr
|
|
87
87
|
|
|
88
|
-
pipeline = pipeline_class(cfg,
|
|
88
|
+
pipeline = pipeline_class(cfg, config_dir)
|
|
89
89
|
|
|
90
90
|
return pipeline
|
|
91
91
|
|