Treedentifier allows you to identify trees in your country. The algorithm can learn what the characteristics of a specific tree species are and detect them when properly learned. For the development of this algorithm we use LiDAR data of the Netherlands.
After cloning the project, please install the required python packages first. For this project we use Python 3.6. If you don't have python already, you can download it here. To install the required packages, just execute:
pip install -r python-requirements.txt
To process the LAZ files in which most LiDAR datasets are formatted, you can use LAStools. You can download LAStools here. Please note that LAStools is not free. You can use LAStools without paying but it will distort your data and insert black diagonals in LAScanopy.
After that, you'll need a vegetation dataset of your area, as well as a filtered and a unfiltered LiDAR dataset. We used a modified version of the Dutch Vegetation Database as our vegetation dataset and as LiDAR data we used filtered AHN2 data and filtered out AHN2 data.
To be able to use this data in our algorithm, we need to do some preprocessing first.
The vegetation dataset contains a lot of different plants. Since we are only interested in trees, we need to remove all non-trees. In the file treespecies, you can find a list of trees extracted from the Dutch Vegetation Database.
To extract all dominant trees from the vegetation dataset, you can run 'tree_processing.py'.
python tree_processing.py
Please note that this program looks for the 'joined_db2.csv' file, so you'll have to name your vegetation dataset like this. This program will create a file called 'dominant_trees.csv' which will be used in a later step.
Now you can run all LAStools you want. We set up a default batch script which will basically work for everyone. Just run the batch file and you should be fine. You'll need the output file 'ID_growing_forest' of the 'tree_processing.py' step, for the last LAStools step 'LAScanopy'.
When done with LAStools run 'data_processing.py' to combine the dominant trees and the result matrix of LAScanopy and to remove any unnecessary data..
python data_processing.py input_directory output.csv
(The 'dominant_trees.csv' file in used by the program above is one of the output files of the earlier executed 'tree_processing.py' step).
Now you're done with the setup. You now should be able to run the algorithms without any problems.
In this project we created python algorithms based on two machine learning principles. You can choose between decision trees and support vector machines. It is recommended using the decision tree algorithm. During tests decision trees showed better accuracy as well as efficiency (speed) than support vector machines.
When running the decision tree algorithm, you can take one of the following versions:
- Dependent
- independent
This runs the algorithm on the same forestry data as the training data is originating from.
This runs the algorithm on forest data from other geographic places than the training data is originating from.
This algorithm is provided as a Jupyter Notebook ('SVM LiDAR tree classifier.ipynb'). To run this program you'll have to install Jupyter/Ipython Notebook.
You have to test your code first before pushing. Pushing while failing to do so, may result in failed builds. For testing you should use PyCodeStyle. You can test your code with the following command:
pycodestyle --show-source --show-pep8 ./
If you want, you can let autopep8 fix your issues with the following command:
autopep8 --in-place --aggressive --aggressive -r ./
The core contributors are:
- Patrick Spaans
- Geerten Rijsdijk
- Thom Visser
- Joris Jonkers Both