prepare: add index module, update pipeline, tests, Dockerfile, and run.sh
This commit is contained in:
@ -66,7 +66,7 @@ from .visualizations import (
|
||||
generate_flow_accumulation,
|
||||
generate_anomaly_mask,
|
||||
)
|
||||
from .gpu import gpu_cleanup, num_gpus, restrict_gpus, safe_gpu_call
|
||||
from .gpu import gpu_cleanup, num_gpus, available_gpu_ids, restrict_gpus, safe_gpu_call
|
||||
from .ign import generate_ign_overlay
|
||||
from .rendering import tif_to_png
|
||||
|
||||
@ -109,7 +109,7 @@ VIZ_STEPS = [
|
||||
class LidarArchaeoPipeline:
|
||||
"""Orchestrates the LiDAR archaeological analysis pipeline."""
|
||||
|
||||
def __init__(self, input_dir, output_dir, resolution=0.5, workers=1, force=False, ground_method='auto', force_classify=False, keep_tif=False, quality=98, only_viz=None, skip_viz=None, output_format='avif', gpu_ids=None):
|
||||
def __init__(self, input_dir, output_dir, resolution=0.5, workers=1, force=False, ground_method='auto', force_classify=False, keep_tif=False, quality=98, only_viz=None, skip_viz=None, output_format='avif', gpu_ids=None, no_index=False):
|
||||
self.input_dir = Path(input_dir)
|
||||
self.output_dir = Path(output_dir)
|
||||
# Accept single float or comma-separated string for multi-resolution
|
||||
@ -130,6 +130,7 @@ class LidarArchaeoPipeline:
|
||||
self.skip_viz = skip_viz
|
||||
self.output_format = output_format
|
||||
self.gpu_ids = gpu_ids
|
||||
self.no_index = no_index
|
||||
self.temp_dir = self.output_dir / "temp"
|
||||
|
||||
if not self.input_dir.exists():
|
||||
@ -467,7 +468,7 @@ class LidarArchaeoPipeline:
|
||||
|
||||
with ProcessPoolExecutor(max_workers=self.workers) as executor:
|
||||
# Round-robin assign each file to a real GPU host index
|
||||
active_ids = self.gpu_ids if self.gpu_ids else _gpu_mod.available_gpu_ids()
|
||||
active_ids = self.gpu_ids if self.gpu_ids else available_gpu_ids()
|
||||
resolutions_str = ','.join(str(r) for r in self.resolutions)
|
||||
future_to_file = {
|
||||
executor.submit(_process_file_standalone, str(laz_file), str(self.input_dir), str(self.output_dir), resolutions_str, self.force, self.ground_method, self.force_classify, self.keep_tif, self.quality, self.only_viz, self.skip_viz, self.output_format, active_ids[file_idx % len(active_ids)] if active_ids else None): laz_file
|
||||
@ -529,6 +530,16 @@ class LidarArchaeoPipeline:
|
||||
logger.info(f" • DTM : {self.dtm_dir}")
|
||||
logger.info(f" • Visualisations: {self.vis_dir}")
|
||||
|
||||
# Génère la carte globale interactive des tuiles traitées
|
||||
if not self.no_index:
|
||||
try:
|
||||
from .index import build_index
|
||||
index_path = build_index(self.output_dir, self.output_format)
|
||||
if index_path:
|
||||
logger.info(f" • Carte globale : {index_path}")
|
||||
except Exception as e:
|
||||
logger.warning(f"Index global non généré: {e}")
|
||||
|
||||
# Clean up temporary files
|
||||
logger.info("Nettoyage des fichiers temporaires...")
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user