Skip to main content

A package for segmenting LiDAR data using Segment-Anything Model (SAM) from Meta AI Research.

Project description

logo

segment-lidar

License: MIT Geomatics Unit of ULiege - Development

A package for segmenting LiDAR data using Segment-Anything Model (SAM) from Meta Research.

This package is specifically designed for unsupervised instance segmentation of aerial LiDAR data. It brings together the power of the Segment-Anything Model (SAM) developed by Meta Research and the segment-geospatial package from Open Geospatial Solutions. Whether you're a researcher, developer, or a geospatial enthusiast, segment-lidar opens up new possibilities for automatic processing of aerial LiDAR data and enables further applications. We encourage you to explore our code, contribute to its development and leverage its capabilities for your segmentation tasks.

results

Installation

We recommand using python==3.9. To install segment-lidar from source, you need to run the following commands:

git clone https://github.com/Yarroudh/segment-lidar
cd segment-lidar
python setup.py install

Usage of the package

After installation, you have a small program called segment-lidar. Use segment-lidar --help to see the detailed help:

Usage: segment-lidar [OPTIONS] COMMAND [ARGS]...

  A package for segmenting LiDAR data using Segment-Anything from Meta AI
  Research.

Options:
  --help  Show this message and exit.

Commands:
  create-config  Create a configuration YAML file.
  segment        Segment LiDAR data.

The package reads .LAS or .LAZ file, then perform instance segmentation using segment-geospatial or/and segment-anything algorithms. The user should first create the configuration file by running:

segment-lidar create-config -o config.yaml

This will create a configuration file as follow:

algorithm: segment-geospatial
classification: null
device: cuda:0
image_path: raster.tif
input_path: pointcloud.las
model_path: sam_vit_h_4b8939.pth
model_type: vit_h
output_path: classified.las
resolution: 0.15
sam_geo:
  automatic: true
  box_threshold: 0.24
  erosion_kernel_size: 3
  sam_kwargs: false
  text_prompt: null
  text_threshold: 0.3
sam_kwargs:
  crop_n_layers: 1
  crop_n_points_downscale_factor: 1
  min_mask_region_area: 10000
  points_per_side: 32
  pred_iou_thresh: 0.9
  stability_score_thresh: 0.92

The second step is to run the segmentation:

segment-lidar segment --config config.yaml

The resulted point cloud contains a new scalar field called segment_id. For visualization and further processing, we recommand using CloudCompare.

Related repositories

Documentation

Coming soon.

License

This software is under the MIT License, a permissive license that grants you extensive freedom to use, modify, and distribute the software, provided that you include the MIT copyright and license notice in all copies or substantial portions of the software. Please refer to the LICENSE file for more detailed information.

Author

This software was developped by Anass Yarroudh, a Research Engineer in the Geomatics Unit of the University of Liege. For more detailed information please contact us via ayarroudh@uliege.be, we are pleased to send you the necessary information.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

segment-lidar-0.1.0.tar.gz (6.4 kB view hashes)

Uploaded Source

Built Distributions

segment_lidar-0.1.0-py3.9.egg (10.2 kB view hashes)

Uploaded Source

segment_lidar-0.1.0-py3-none-any.whl (7.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page