Skip to content

tls-tools-ucl/TLS2trees

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TLS2trees: point cloud semantic classification and individual tree segmentation

TLS2trees segments individual trees from TLS point clouds. This is done using a 3-step process

1. rxp-pipeline

This step preprocesses data captured with RIEGL VZ TLS data. Code and details can be found here.

2. Semantic segmentation with semantic.py

This is forked from @SKrisanski and is a lite version that only runs the semantic segmentation (ground, wood, leaf, cwd). Typical usage is:

python semantic.py -p <point_cloud> --tile-index <path_to_index> --buffer <buffer> --verbose

optional arguments:
  -h, --help            show this help message and exit
  --point-cloud POINT_CLOUD, -p POINT_CLOUD
                        path to point cloud
  --params PARAMS       path to pickled parameter file
  --odir ODIR           output directory
  --step STEP           which process to run to
  --redo REDO           which process to run to
  --tile-index TILE_INDEX
                        path to tile index in space delimited format "TILE X Y"
  --buffer BUFFER       included data from neighbouring tiles
  --batch_size BATCH_SIZE
                        If you get CUDA errors, try lowering this.
  --num_procs NUM_PROCS
                        Number of CPU cores you want to use. If you run out of RAM, lower this.
  --keep-npy            Keeps .npy files used for segmentation after inference is finished.
  --output_fmt OUTPUT_FMT
                        file type of output
  --verbose             print stuff

3. Instance segmentation with instance.py

Following classification an instance segmenation can be run to seperate individual trees using:

python instance.py -t 001.downsample.segmented.ply --tindex ../tile_index.dat -o ../clouds/ --n-tiles 5 --slice-thickness .5 --find-stems-boundary 2 2.5 --pandarallel --verbose --add-leaves --add-leaves-voxel-length .5 --graph-maximum-cumulative-gap 3 --save-diameter-class --ignore-missing-tiles

optional arguments:
  -h, --help            show this help message and exit
  --tile TILE, -t TILE  fsct directory
  --odir ODIR, -o ODIR  output directory
  --tindex TINDEX       path to tile index
  --n-tiles N_TILES     enlarges the number of tiles i.e. 3x3 or tiles or 5 x 5 tiles
  --n-zeros             leading zeros for tile names
  --overlap OVERLAP     buffer to crop adjacent tiles
  --slice-thickness SLICE_THICKNESS
                        slice thickness for constructing graph
  --find-stems-boundary boundary height for slice used for identifying stems: default [1.5, 2.]:w
  --find-stems-min-radius FIND_STEMS_MIN_RADIUS
                        minimum radius of found stems
  --find-stems-min-points FIND_STEMS_MIN_POINTS
                        minimum number of points for found stems
  --graph-edge-length GRAPH_EDGE_LENGTH
                        maximum distance used to connect points in graph
  --graph-maximum-cumulative-gap GRAPH_MAXIMUM_CUMULATIVE_GAP
                        maximum cumulative distance between a base and a cluster
  --min-points-per-tree MIN_POINTS_PER_TREE
                        minimum number of points for a identified tree
  --add-leaves          add leaf points
  --add-leaves-voxel-length ADD_LEAVES_VOXEL_LENGTH
                        voxel sixe when add leaves
  --add-leaves-edge-length ADD_LEAVES_EDGE_LENGTH
                        maximum distance used to connect points in leaf graph
  --save-diameter-class
                        save into dimeter class directories
  --ignore-missing-tiles
                        ignore missing neighbouring tiles
  --pandarallel         use pandarallel
  --verbose             print something

Docker

To build a Docker container with all the libraries installed use:

docker build -t tls2trees:latest .

Then to run FSCT and the instance segmentation use:

docker run -it -v /path/to/data/outsidecontainer:/path/to/data/incontainer fsct:latest semantic.py
docker run -it -v /path/to/data/outsidecontainer:/path/to/data/incontainer fsct:latest instance.py

For HPC systems, where you don't have permission to run Docker, you can build the container on your local machine and convert to a singularity file using:

sudo singularity build tls2trees_latest.sif docker-daemon://tls2trees:latest

Copy this to the HPC system and run this using

singularity exec tls2trees_latest.sif semantic.py
singularity exec tls2trees_latest.sif instance.py

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published