← All latest work

Forestry Geomatics

ForAINet on terrestrial forest LiDAR

I trained the ForAINet deep-learning model on terrestrial forest LiDAR, compared two sparse-convolution backbones and checked the results against the original publication.

Python · PyTorch · LiDAR · Point clouds · 3DFin · Docker

This was my final assignment for Introduction to AI in Forestry, part of the “Geomatics and AI in Forestry” postgraduate programme at the Forest Research Institute (Poland). I took ForAINet, a published deep-learning model for segmenting forest point clouds that was built for airborne LiDAR, and trained it on SegmentedForests, a public dataset of 14 terrestrial LiDAR plots. I then swapped its sparse-convolution backbone from MinkowskiEngine to TorchSparse 1.4, retrained, and compared both models with each other and with the figures in the original paper.

Preparing the data

The dataset and the model did not match. SegmentedForests has semantic labels only, so I generated tree identifiers with 3DFin. I wrote a Python pipeline (Hydra configuration, laspy, NumPy) that runs 3DFin over each plot, merges 16 source classes into 4, centres the coordinates and writes the train, validation and test split into the file name, which is how ForAINet reads it.

One silent mismatch mattered most. 3DFin gives ground points the id of the nearest tree, and ForAINet then discards any tree whose id also appears on ground: 0 of 42 trees survived on one plot. Clearing the id outside the tree classes fixed it.

Data volume shaped the design. 4.4 GB of compressed input grows into 46 GB of intermediates, so the pipeline works plot by plot and deletes each intermediate once it is used, which cut peak disk use from 108.6 GB to 34.3 GB. It exports compressed LAZ for upload: 4.3 GB instead of 29.2 GB of PLY.

Training

I packaged the environment in Docker, stored the data on Cloudflare R2 and trained each model for 99 epochs on a rented NVIDIA A100 through Vast.ai, tracking the runs in Weights & Biases. Several crashes appeared only after epoch 30, when the instance branch switches on, so I built a pre-flight check that runs the whole chain on a cheap GPU first. My changes to ForAINet (five classes to four, TorchSparse fixes, evaluation repairs) are kept as a patch with a script that verifies it. I used Claude Code as a coding assistant throughout.

Results

On the two test plots (41.5 million points) MinkowskiEngine reached an mIoU of 77.7 % and TorchSparse 76.6 %, against 73.0 % for the paper’s basic setting. The paper averages over five classes and I over four, so the fair word is comparable, not better. Instance segmentation did not transfer: an F-score of 32.4 % against 79.0 %. The likely causes are the terrestrial viewpoint and tree labels made by an algorithm rather than by hand. TorchSparse was 1.2 to 2.1 times slower and no more accurate, so MinkowskiEngine stays the default.

What I learned

A model can train without a single error and still learn the wrong thing, so every data conversion needs its own check. On rented hardware, a cheap test run before the long one pays for itself.