Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Point-Cloud Segmentation for Infrastructure Inspection

A geometric segmentation pipeline that classifies LiDAR-style point-cloud data into ground, structure, vegetation, and defect-candidate classes, built around the kind of inspection workflow used for bridges, buildings, and other built infrastructure.

Live demo (Streamlit) | Related project: bridge-defect-detector (YOLOv8, 99.1% mAP@0.5)

What it does

The pipeline takes a 3D point cloud and segments it in three stages:

  1. Ground plane removal — RANSAC plane fitting isolates the ground plane so it doesn't interfere with structure/vegetation classification.
  2. Clustering and classification — DBSCAN clusters the remaining points, then each cluster is classified as structure or vegetation using PCA-based planarity and height heuristics. Flat, vertical, tall clusters (walls, beams, panels) are structure; irregular, lower-planarity clusters are vegetation.
  3. Defect candidate detection — within points already classified as structure, local point density is compared against the surface's overall density (via k-nearest-neighbour distances). Patches that are locally denser than the surrounding surface are flagged as defect candidates, a proxy for things like spalling, corrosion patches, or crack zones that an inspector would want to review.

On the synthetic test scene included in this repo, the pipeline achieves:

Class Accuracy
Ground 98.8%
Structure 97.5%
Vegetation 77.3%
Defect candidate 82.5%
Overall 95.5%

Why a rule-based pipeline, not a deep network

This deliberately uses classical geometric segmentation (RANSAC + DBSCAN + PCA + local density) rather than a trained model like PointNet++ or RandLA-Net. Two reasons:

  1. It requires no labelled training data and no GPU, which makes it a realistic first stage for an edge or resource-constrained deployment, and it's how a lot of real point-cloud inspection pipelines actually start before a learned model is layered on top.
  2. It is honest about what was actually built and tested here in the time available, rather than wrapping a pretrained model whose performance on this kind of data wasn't independently verified.

The natural next step, once labelled real-world scan data is available, is to swap the rule-based classifier for a trained segmentation model and compare performance directly against this baseline.

About the data

The point cloud used in the demo is synthetically generated (scripts/generate_sample_cloud.py), simulating a ground plane, a structure wall, scattered vegetation, and an embedded defect cluster. No real LiDAR scan was available for this project, so the synthetic scene exists to demonstrate the pipeline end-to-end with verifiable ground-truth labels for the accuracy numbers above.

The pipeline itself works unchanged on real point-cloud data. To use a real scan, load it into a NumPy array of shape (N, 3) and pass it to segment.run_pipeline() directly, or save it as an .npz file with a points key and adapt app.py's load_scene() function to read it instead of calling build_scene().

Running locally

git clone https://github.com/lakshan-d/point-cloud-segmentation-infra.git
cd point-cloud-segmentation-infra
pip install -r requirements.txt
streamlit run app.py

Open the local URL Streamlit prints (usually http://localhost:8501). The sidebar lets you adjust the DBSCAN clustering radius and the defect density-ratio threshold live and see how the segmentation changes.

Running the pipeline directly

cd scripts
python segment.py

This generates the sample scene, runs the full pipeline, and prints a per-class accuracy report as JSON.

Running tests

python tests/test_segment.py

Project structure

point-cloud-segmentation-infra/
├── app.py                          # Streamlit dashboard
├── requirements.txt
├── scripts/
│   ├── generate_sample_cloud.py    # synthetic scene generator
│   └── segment.py                  # segmentation pipeline
├── tests/
│   └── test_segment.py
└── README.md

Background

Built as part of a broader portfolio of computer vision and LiDAR projects targeting infrastructure inspection, alongside an MSc dissertation on drone-based autonomous inspection (LiDAR + YOLOv5) and a co-authored IEEE paper on LiDAR-based self-localisation (FNWF Dubai 2024).

Author

Lakshan Divakar | github.com/lakshan-d | linkedin.com/in/lakshan-d

About

Geometric point-cloud segmentation pipeline for infrastructure inspection (RANSAC + DBSCAN + PCA), with defect candidate detection and an interactive Streamlit dashboard.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages