Skip to content

tungcorn/ground_binary_classification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ground Binary Classification (Ground vs Non-ground)

Tiếng Việt | English

Binary LiDAR point cloud pipeline:

  1. Ground filter (SMRF or CSF)
  2. Merge (ground from algorithm + keep original non-ground classes)
  3. HAG (HeightAboveGround)
  4. ML binary classification (ground vs non-ground)

Requirements

pip install pdal laspy numpy scikit-learn joblib matplotlib
pip install cloth-simulation-filter   # only for CSF mode

Label convention

  • Internal model labels:
    • 1 = ground
    • 0 = non-ground
  • LAS output labels:
    • ground -> class 2
    • non-ground -> class 1

Configuration

Defaults are in config.json.

Section Parameters
smrf slope, window, threshold, scalar
csf cloth_resolution, rigidness, slope_smooth, class_threshold
training max_train_points, min_class_points, sample_ratio
random_forest n_jobs, n_estimators, class_weight

1. Train (binary)

# Train binary ground model with SMRF
python train_classify.py --mode train --input "data/**/*.las" --ground-method smrf \
    --ml-model random-forest --model models

# Train with original labels as target (recommended when original labels are QA/QC ground truth)
python train_classify.py --mode train --input "data/**/*.las" --ground-method smrf \
    --ml-model random-forest --model models --train-target original

# Train binary ground model with CSF
python train_classify.py --mode train --input "data/**/*.las" --ground-method csf \
    --ml-model random-forest --model models

Output example (now includes train target to avoid overwrite):

  • models/smrf_rf_merged.sav
  • models/smrf_rf_orig.sav

--train-target:

  • merged (default): train with binary labels after ground reclassification + merge
  • original: train with original binary labels (class 2 vs non-2) while still using SMRF/CSF-derived features

2. Evaluate (binary)

# Evaluate with original binary target (default)
python train_classify.py --mode evaluate --input "test/**/*.las" --ground-method smrf \
    --model models/smrf_rf_orig.sav --output-dir results

# Evaluate with merged binary target
python train_classify.py --mode evaluate --input "test/**/*.las" --ground-method smrf \
    --model models/smrf_rf_merged.sav --output-dir results --eval-target merged

# Evaluate and also export predicted LAS files
python train_classify.py --mode evaluate --input "test/**/*.las" --ground-method smrf \
    --model models/smrf_rf_orig.sav --output-dir results --save-eval-pred-las

--eval-target:

  • original (default): compare with original binary labels (class 2 vs non-2)
  • merged: compare with merged binary labels after reclassification

--save-eval-pred-las output:

  • results/<model_name>/predicted_las/*_eval_predicted.las

3. Predict (binary)

# Standard predict (rerun SMRF/CSF)
python train_classify.py --mode predict --input "new/**/*.las" --ground-method smrf \
    --model models/smrf_rf_orig.sav

# Predict from premerged LAS (skip SMRF/CSF rerun)
python train_classify.py --mode predict --input "new/**/*.las" \
    --model models/smrf_rf_orig.sav --use-premerged

Each abc.las -> abc_predicted.las with binary LAS classes (2 ground, 1 non-ground).

Notes

  • Keep train and predict pipelines consistent (smrf vs csf vs --use-premerged).
  • Large datasets: use --sample-ratio 0.01.
  • Ground quality matters most: optimize ground precision first.

About

Binary LiDAR ground classification pipeline (ground vs non-ground) with SMRF/CSF reclassification, HAG feature extraction, and ML train/evaluate/predict workflows.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages