Configuration System
Deep dive into the Hydra-based configuration system in v2.0+.
π― Overviewβ
The v2.0 configuration system uses Hydra for powerful, composable, type-safe configuration management.
Key Conceptsβ
- Hierarchical Composition: Build complex configs from simple components
- Type Safety: Runtime validation of configuration values
- Presets: Pre-configured workflows (fast/balanced/quality/ultra)
- Overrides: Change any parameter from command line
- Config Groups: Organize related configurations
- Defaults: Sensible defaults for all parameters
π Configuration Structureβ
ign_lidar/configs/
βββ config.yaml # Root configuration
βββ preset/ # Workflow presets
β βββ fast.yaml
β βββ balanced.yaml
β βββ quality.yaml
β βββ ultra.yaml
βββ processor/ # Processing backend
β βββ cpu.yaml
β βββ gpu.yaml
βββ features/ # Feature computation
β βββ basic.yaml
β βββ standard.yaml
β βββ full.yaml
βββ preprocess/ # Preprocessing
β βββ minimal.yaml
β βββ standard.yaml
β βββ aggressive.yaml
βββ dataset/ # Dataset generation
β βββ pointnet.yaml
β βββ octree.yaml
β βββ transformer.yaml
βββ stitching/ # Tile stitching
βββ none.yaml
βββ features.yaml
βββ full.yaml
π§ Root Configurationβ
config.yaml - The main configuration file:
defaults:
- preset: balanced # Default preset
- processor: cpu # Default processor
- features: standard # Default features
- preprocess: standard # Default preprocessing
- dataset: pointnet # Default dataset format
- stitching: none # Default stitching
- _self_ # Allow overrides
# Core parameters (required)
input_dir: ??? # Must be specified
output_dir: ??? # Must be specified
# Output mode
output: patches # Options: patches, both, enriched_only
# Performance
num_workers: 4 # Number of parallel workers
batch_size: 1 # Tiles per batch
max_memory_gb: 8 # Maximum RAM usage
# Logging
verbose: false # Verbose output
log_level: INFO # Logging level
show_progress: true # Show progress bars
# Hydra configuration
hydra:
run:
dir: ${output_dir}/.hydra # Hydra output directory
job:
chdir: false # Don't change working directory
Required Parametersβ
These must be provided (marked with ???
):
input_dir: ??? # Path to RAW LAZ files
output_dir: ??? # Output directory
Usage:
# Provide required parameters
ign-lidar-hd process input_dir=data/ output_dir=output/
π¨ Preset Configurationsβ
Presets are complete workflow configurations optimized for different use cases.
1. Fast Presetβ
preset/fast.yaml:
# @package _global_
# Override defaults for fast processing
defaults:
- override /processor: cpu
- override /features: basic
- override /preprocess: minimal
# Fast-specific parameters
features:
k_neighbors: 20 # Fewer neighbors
radius: 1.5 # Smaller radius
use_rgb: false # Skip RGB
compute_ndvi: false # Skip NDVI
boundary_aware: false # No boundary processing
preprocess:
remove_outliers: true
outlier_method: statistical
outlier_nb_neighbors: 10 # Fewer neighbors
normalize_ground: false # Skip normalization
dataset:
patch_size: 50.0
points_per_patch: 2048 # Fewer points
# Performance
num_workers: 2
2. Balanced Preset (β Recommended)β
preset/balanced.yaml:
# @package _global_
defaults:
- override /processor: cpu
- override /features: standard
- override /preprocess: standard
features:
k_neighbors: 30
radius: 2.0
use_rgb: true # Use RGB if available
compute_ndvi: false
boundary_aware: false
preprocess:
remove_outliers: true
outlier_method: statistical
outlier_nb_neighbors: 20
outlier_std_ratio: 2.0
normalize_ground: true
ground_resolution: 1.0
dataset:
patch_size: 50.0
points_per_patch: 4096
num_workers: 4
3. Quality Presetβ
preset/quality.yaml:
# @package _global_
defaults:
- override /processor: gpu # GPU for better performance
- override /features: full
- override /preprocess: aggressive
features:
k_neighbors: 50 # More neighbors
radius: 3.0 # Larger radius
use_rgb: true
compute_ndvi: true # Compute NDVI
use_infrared: true # Use infrared
boundary_aware: false
preprocess:
remove_outliers: true
outlier_method: statistical
outlier_nb_neighbors: 30
outlier_std_ratio: 1.5 # More aggressive
normalize_ground: true
ground_resolution: 0.5 # Finer resolution
filter_classes: true
dataset:
patch_size: 50.0
points_per_patch: 8192 # More points per patch
num_workers: 8
output: both # Save both LAZ and patches
4. Ultra Presetβ
preset/ultra.yaml:
# @package _global_
defaults:
- override /processor: gpu
- override /features: full
- override /preprocess: aggressive
- override /stitching: full # Enable full stitching
features:
k_neighbors: 100 # Maximum neighbors
radius: 5.0 # Large radius
use_rgb: true
compute_ndvi: true
use_infrared: true
boundary_aware: true # Enable boundary-aware
boundary_buffer: 15.0 # Large buffer
preprocess:
remove_outliers: true
outlier_method: statistical
outlier_nb_neighbors: 50
outlier_std_ratio: 1.0 # Very aggressive
normalize_ground: true
ground_resolution: 0.25 # Very fine resolution
filter_classes: true
dataset:
patch_size: 50.0
points_per_patch: 16384 # Maximum points
stitching:
tile_overlap: 10.0 # Tile overlap
merge_method: weighted # Weighted merging
num_workers: 12
output: both
π» Processor Configurationsβ
CPU Processorβ
processor/cpu.yaml:
# CPU processing configuration
_target_: cpu
# CPU-specific parameters
use_gpu: false
num_threads: null # Use all available
chunk_size: 500000 # Points per chunk
parallel_backend: threading # or multiprocessing
GPU Processorβ
processor/gpu.yaml:
# GPU processing configuration
_target_: gpu
# GPU parameters
use_gpu: true
gpu_id: 0 # GPU device ID
gpu_memory_fraction: 0.9 # Fraction of GPU memory
gpu_chunk_size: 1000000 # Points per GPU chunk
# Fallback
cpu_fallback: true # Use CPU if GPU fails
π¬ Feature Configurationsβ
Basic Featuresβ
features/basic.yaml:
# Basic geometric features only
compute_geometric: true
compute_curvature: false
use_rgb: false
compute_ndvi: false
use_infrared: false
boundary_aware: false
# Quality
k_neighbors: 20
radius: 1.5
# Performance
use_gpu: false
Standard Featuresβ
features/standard.yaml:
# Standard feature set
compute_geometric: true
compute_curvature: true
use_rgb: true # If available
compute_ndvi: false
use_infrared: false
boundary_aware: false
# Quality
k_neighbors: 30
radius: 2.0
# Performance
use_gpu: false
auto_params: false
Full Featuresβ
features/full.yaml:
# Complete feature set
compute_geometric: true
compute_curvature: true
compute_intensity_stats: true
use_rgb: true
compute_ndvi: true
use_infrared: true
boundary_aware: false
# Quality
k_neighbors: 50
radius: 3.0
# Performance
use_gpu: true
auto_params: true
π§ Preprocessing Configurationsβ
Minimal Preprocessingβ
preprocess/minimal.yaml:
# Minimal preprocessing (outliers only)
remove_outliers: true
outlier_method: statistical
outlier_nb_neighbors: 10
outlier_std_ratio: 3.0
normalize_ground: false
filter_classes: false
Standard Preprocessingβ
preprocess/standard.yaml:
# Standard preprocessing
remove_outliers: true
outlier_method: statistical
outlier_nb_neighbors: 20
outlier_std_ratio: 2.0
normalize_ground: true
ground_resolution: 1.0
ground_max_distance: 5.0
filter_classes: false
Aggressive Preprocessingβ
preprocess/aggressive.yaml:
# Aggressive preprocessing
remove_outliers: true
outlier_method: statistical
outlier_nb_neighbors: 30
outlier_std_ratio: 1.5 # More aggressive
normalize_ground: true
ground_resolution: 0.5 # Finer
ground_max_distance: 3.0 # Stricter
filter_classes: true
keep_classes: [2, 3, 4, 5, 6] # Ground, vegetation, building
ποΈ Dataset Configurationsβ
PointNet++ Formatβ
dataset/pointnet.yaml:
# PointNet++ dataset format
architecture: pointnet++
patch_size: 50.0
points_per_patch: 4096
overlap: 0.0
normalize_points: true
center_points: true
augment: true
Octree Formatβ
dataset/octree.yaml:
# Octree dataset format
architecture: octree
patch_size: 50.0
points_per_patch: 8192 # More points for octree
octree_depth: 7
overlap: 0.0
normalize_points: true
Transformer Formatβ
dataset/transformer.yaml:
# Transformer dataset format
architecture: transformer
patch_size: 50.0
points_per_patch: 2048 # Fewer points (attention complexity)
overlap: 0.0
normalize_points: true
positional_encoding: learned
π§© Stitching Configurationsβ
No Stitchingβ
stitching/none.yaml:
# Independent tile processing
enabled: false
tile_overlap: 0.0
Feature Stitchingβ
stitching/features.yaml:
# Boundary-aware features only
enabled: true
mode: features
tile_overlap: 0.0
boundary_buffer: 10.0
merge_method: average
Full Stitchingβ
stitching/full.yaml:
# Complete stitching
enabled: true
mode: full
tile_overlap: 10.0
boundary_buffer: 15.0
merge_method: weighted
create_merged_dataset: true
π Using Configurationsβ
1. Command-Line Selectionβ
# Select preset
ign-lidar-hd process preset=quality
# Select multiple config groups
ign-lidar-hd process \
preset=quality \
processor=gpu \
features=full
2. Parameter Overridesβ
# Override individual parameters
ign-lidar-hd process \
preset=balanced \
features.k_neighbors=50 \
num_workers=8
3. Custom Config Filesβ
my_config.yaml:
defaults:
- preset: balanced
- processor: gpu
- _self_
input_dir: "/data/project1/"
output_dir: "/output/project1/"
features:
use_rgb: true
compute_ndvi: true
k_neighbors: 40
num_workers: 12
Usage:
ign-lidar-hd process --config-name my_config
4. Config Compositionβ
base.yaml:
# Base configuration
num_workers: 4
verbose: false
log_level: INFO
urban.yaml:
defaults:
- base
- preset: balanced
- _self_
# Urban-specific settings
preprocess:
filter_classes: true
keep_classes: [6] # Buildings only
features:
use_rgb: true
Usage:
ign-lidar-hd process --config-name urban input_dir=urban/ output_dir=out/
π Configuration Introspectionβ
View Current Configurationβ
# Show resolved configuration
ign-lidar-hd process \
preset=balanced \
processor=gpu \
--cfg job
View Configuration Groupsβ
# List available presets
ign-lidar-hd process --help | grep preset
# List available processors
ign-lidar-hd process --help | grep processor
Validate Configurationβ
# Check configuration without running
ign-lidar-hd process \
--config-name my_config \
--cfg job
π Advanced Patternsβ
1. Environment Variablesβ
# Use environment variables
input_dir: ${oc.env:DATA_DIR}
output_dir: ${oc.env:OUTPUT_DIR}
# With defaults
num_workers: ${oc.env:NUM_WORKERS,4}
Usage:
export DATA_DIR=/data/project/
export OUTPUT_DIR=/output/project/
ign-lidar-hd process
2. Conditional Configurationβ
# Conditional GPU usage
features:
use_gpu: ${oc.env:CUDA_VISIBLE_DEVICES,false}
gpu_chunk_size: ${oc.select:features.use_gpu,1000000,null}
3. Config Inheritanceβ
base_research.yaml:
# Base research configuration
defaults:
- preset: quality
- processor: gpu
num_workers: 12
output: both
experiment_1.yaml:
# Experiment 1: Different k_neighbors
defaults:
- base_research
- _self_
features:
k_neighbors: 30
experiment_2.yaml:
# Experiment 2: Boundary-aware
defaults:
- base_research
- _self_
features:
k_neighbors: 50
boundary_aware: true
4. Parameter Sweepsβ
# Run multiple experiments
ign-lidar-hd process \
--config-name base_research \
--multirun \
features.k_neighbors=20,30,40,50
Creates:
output/multirun/0/
- k_neighbors=20output/multirun/1/
- k_neighbors=30output/multirun/2/
- k_neighbors=40output/multirun/3/
- k_neighbors=50
π Configuration Best Practicesβ
1. Use Presets as Starting Pointsβ
# Start with preset, then customize
ign-lidar-hd process \
preset=balanced \
features.use_rgb=true \
num_workers=8
2. Create Project-Specific Configsβ
# project_config.yaml
defaults:
- preset: balanced
- _self_
input_dir: "/project/data/"
output_dir: "/project/output/"
# Project-specific overrides
features:
use_rgb: true
compute_ndvi: true
3. Use Config Groups for Reusabilityβ
configs/
βββ base.yaml
βββ urban/
β βββ buildings.yaml
β βββ vegetation.yaml
βββ rural/
βββ agriculture.yaml
4. Document Your Configsβ
# my_config.yaml
# Purpose: Process urban tiles for building classification
# Created: 2025-10-08
# Author: Your Name
defaults:
- preset: quality
- _self_
# Buildings only
preprocess:
filter_classes: true
keep_classes: [6]
5. Version Control Your Configsβ
# Track configs in git
git add configs/
git commit -m "Add production config"
π Troubleshootingβ
Issue: Missing Required Parameterβ
Error:
omegaconf.errors.MissingMandatoryValue: Missing mandatory value: input_dir
Solution:
# Always provide required parameters
ign-lidar-hd process input_dir=data/ output_dir=output/
Issue: Config Override Not Workingβ
Problem: Override doesn't take effect
Solution:
Ensure _self_
is in defaults list:
defaults:
- preset: balanced
- _self_ # Must be last!
Issue: Type Validation Errorβ
Error:
ValidationError: Expected int, got str for 'num_workers'
Solution:
# Use correct type
ign-lidar-hd process num_workers=8 # Correct (int)
ign-lidar-hd process num_workers="8" # Wrong (string)
Issue: Config File Not Foundβ
Error:
ConfigNotFound: Cannot find config 'my_config'
Solution:
# Ensure file is in configs/ directory
ls configs/my_config.yaml
# Or specify full path
ign-lidar-hd process \
--config-path /full/path/to/configs \
--config-name my_config
π Next Stepsβ
- Hydra CLI Guide - Learn the CLI
- Quick Start - Get started quickly
- Complete Workflow - End-to-end examples
- API Reference - Configuration API
π External Resourcesβ
- Hydra Documentation: https://hydra.cc/
- OmegaConf: https://omegaconf.readthedocs.io/
- Configuration Patterns: https://hydra.cc/docs/patterns/overview/
Master the configuration system to build reproducible, flexible workflows! π