Skip to content

Latest commit

 

History

History
103 lines (76 loc) · 3.5 KB

File metadata and controls

103 lines (76 loc) · 3.5 KB

Ground Binary Classification (Ground vs Non-ground)

Tiếng Việt | English

Pipeline LiDAR nhị phân:

  1. Lọc đất (SMRF hoặc CSF)
  2. Merge (ground từ thuật toán + giữ lớp non-ground gốc)
  3. HAG (HeightAboveGround)
  4. ML nhị phân (đất vs không phải đất)

Yêu cầu

pip install pdal laspy numpy scikit-learn joblib matplotlib
pip install cloth-simulation-filter   # chỉ cho mode CSF

Quy ước nhãn

  • Nhãn nội bộ cho model:
    • 1 = ground
    • 0 = non-ground
  • Nhãn ghi ra LAS:
    • ground -> class 2
    • non-ground -> class 1

Cấu hình

Tham số mặc định nằm trong config.json.

Phần Tham số
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 (nhị phân)

# Train model nhị phân với SMRF
python train_classify.py --mode train --input "data/**/*.las" --ground-method smrf \
    --ml-model random-forest --model models

# Train với nhãn gốc làm target (khuyến nghị khi nhãn gốc đã QA/QC)
python train_classify.py --mode train --input "data/**/*.las" --ground-method smrf \
    --ml-model random-forest --model models --train-target original

# Train model nhị phân với CSF
python train_classify.py --mode train --input "data/**/*.las" --ground-method csf \
    --ml-model random-forest --model models

Output ví dụ (đã thêm train target để tránh ghi đè):

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

--train-target:

  • merged (mặc định): train bằng nhãn binary sau ground reclassification + merge
  • original: train bằng nhãn binary gốc (class 2 vs non-2) nhưng vẫn dùng feature tạo từ SMRF/CSF

2. Evaluate (nhị phân)

# Evaluate theo nhãn binary gốc (mặc định)
python train_classify.py --mode evaluate --input "test/**/*.las" --ground-method smrf \
    --model models/smrf_rf_orig.sav --output-dir results

# Evaluate theo nhãn binary merged
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 và đồng thời xuất LAS dự đoán
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 (mặc định): so với nhãn binary gốc (class 2 vs non-2)
  • merged: so với nhãn binary sau reclassification + merge

Output khi bật --save-eval-pred-las:

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

3. Predict (nhị phân)

# Predict chuẩn (chạy lại SMRF/CSF)
python train_classify.py --mode predict --input "new/**/*.las" --ground-method smrf \
    --model models/smrf_rf_orig.sav

# Predict từ LAS đã premerged (không chạy lại SMRF/CSF)
python train_classify.py --mode predict --input "new/**/*.las" \
    --model models/smrf_rf_orig.sav --use-premerged

Mỗi abc.las -> abc_predicted.las với nhãn LAS nhị phân (2 ground, 1 non-ground).

Ghi chú

  • Giữ nhất quán pipeline train/predict (smrf vs csf vs --use-premerged).
  • Dữ liệu lớn: dùng --sample-ratio 0.01.
  • Ground quality quan trọng nhất: ưu tiên tối ưu precision ground trước.