python.workflows.clfSPTSetup Namespace Reference

Analyses a set of labelled point cloud tiles and sets up a new SPT project directory. Running clfSPTSetup is the mandatory first step in the training workflow before proceeding with clfSPTPreprocess and clfSPTTrain. More...

Classes

class  clfSPTSetup
 

Functions

tuple scan_dataset (list files, logger)
 Scans all input files. More...
 
dict build_class_map (dict found_ids, list ignore_ids, dict overrides)
 Builds the class mapping {odm_id -> name}.
 
None print_class_preview (dict found_ids, dict class_map, list ignore_ids)
 Tabular display of the detected classes.
 
Optional[dict] interactive_confirm (dict found_ids, dict class_map, list ignore_ids)
 
tuple detect_features (set available_attrs, logger)
 Determines from the available ODM attributes which SPT features can be used. More...
 
dict create_split (list files, dict per_file_counts, str split_type, dict ratios, logger)
 
None report_split_composition (dict per_file_counts, dict split_result, logger)
 
dict create_project_structure (str project_dir, logger)
 Creates the project directories and returns their paths.
 
None copy_split_files (list files, dict split_result, dict paths, logger)
 
None write_dataset_config_py (str output_path, str datensatz, dict class_map, list ignore_ids, dict feature_flags, dict split_result)
 Generates {dataset}_config.py.
 
None write_cfg_yaml (str output_path, str datensatz, str project_dir, list point_hf, dict feat_size)
 Generates {dataset}.cfg as a YAML file. More...
 

Variables

 message
 
 SPT_ROOT = os.path.join(_DISTRO_ROOT, 'addons', 'superpoint_transformer', 'superpoint_transformer')
 
 SPT_CONFIG_DIR = os.path.join(SPT_ROOT, 'configs')
 
dictionary ASPRS_CLASSES
 
list DEFAULT_IGNORE_IDS = [0, 1, 7, 18]
 
dictionary ATTRIBUTE_TO_FEATURE
 
list GEOMETRIC_FEATURES
 
 script
 

Detailed Description

Analyses a set of labelled point cloud tiles and sets up a new SPT project directory. Running clfSPTSetup is the mandatory first step in the training workflow before proceeding with clfSPTPreprocess and clfSPTTrain.

This script serves as the entry point for the SPT training workflow. Its primary job is to generate the necessary configuration files and directory structure required by the downstream tools. To do this, it scans the point cloud files (supporting all formats handled by pyDM.Import) to determine their semantic class distributions and check which point attributes are available for model training. Based on the class distributions, it creates either a stratified or random train/validation/test split and organises everything into a clean project structure containing <project>.cfg and <project>_config.py. For adjusting the dataset splits it is not necessary to re-run the script, it is also possible to move files between the split folders manually.

See also
Script documentation

Function Documentation

◆ copy_split_files()

None python.workflows.clfSPTSetup.copy_split_files ( list  files,
dict  split_result,
dict  paths,
  logger 
)
Copies the tiles into their corresponding split directories.

◆ create_split()

dict python.workflows.clfSPTSetup.create_split ( list  files,
dict  per_file_counts,
str  split_type,
dict  ratios,
  logger 
)
Creates the train/val/test split.
Returns {split_name: [file_stems]}.

◆ detect_features()

tuple python.workflows.clfSPTSetup.detect_features ( set  available_attrs,
  logger 
)

Determines from the available ODM attributes which SPT features can be used.

Returns (point_hf_list, feat_size_dict, feature_flags_dict).

◆ interactive_confirm()

Optional[dict] python.workflows.clfSPTSetup.interactive_confirm ( dict  found_ids,
dict  class_map,
list  ignore_ids 
)
Displays the class table and allows interactive changes.
Returns: updated class_map, or None (cancelled).

References python.workflows.clfSPTSetup.print_class_preview().

◆ report_split_composition()

None python.workflows.clfSPTSetup.report_split_composition ( dict  per_file_counts,
dict  split_result,
  logger 
)
Checks the class distribution per split and warns if a class is
COMPLETELY missing from a split (typically: a rare class like Building
drops out of test). Without this warning, metrics for the missing
class in that split are silently meaningless.

◆ scan_dataset()

tuple python.workflows.clfSPTSetup.scan_dataset ( list  files,
  logger 
)

Scans all input files.

Returns (total_class_counts, available_attributes, per_file_counts).

◆ write_cfg_yaml()

None python.workflows.clfSPTSetup.write_cfg_yaml ( str  output_path,
str  datensatz,
str  project_dir,
list  point_hf,
dict  feat_size 
)

Generates {dataset}.cfg as a YAML file.

Contains all model parameters for clfSPTTrain.py. Can be edited manually before training.

Variable Documentation

◆ ASPRS_CLASSES

dictionary ASPRS_CLASSES
Initial value:
1 = {
2  0: 'Never Classified',
3  1: 'Unclassified',
4  2: 'Ground',
5  3: 'Low Vegetation',
6  4: 'Medium Vegetation',
7  5: 'High Vegetation',
8  6: 'Building',
9  7: 'Low Point (Noise)',
10  8: 'Reserved',
11  9: 'Water',
12  10: 'Rail',
13  11: 'Road Surface',
14  12: 'Reserved (Overlap)',
15  13: 'Wire - Guard',
16  14: 'Wire - Conductor',
17  15: 'Transmission Tower',
18  16: 'Wire-Structure Connector',
19  17: 'Bridge Deck',
20  18: 'High Noise',
21 }

◆ ATTRIBUTE_TO_FEATURE

dictionary ATTRIBUTE_TO_FEATURE
Initial value:
1 = {
2  'Amplitude': ('intensity', 1),
3  '_Reflectance': ('reflectance', 1),
4  'EchoRatio': ('echo_ratio', 1),
5  'NrOfEchos': ('num_returns', 1)
6 }

◆ GEOMETRIC_FEATURES

list GEOMETRIC_FEATURES
Initial value:
1 = [
2  'linearity', 'planarity', 'scattering', 'verticality', 'elevation',
3 ]