The TreeSeg toolbox is outdated and no longer actively supported. While the code remains available for reference, it may not be compatible with the latest versions of ArcGIS Pro or Python environments. Use at your own risk.
A tool for the segmentation of individual trees. It utilizes ArcGIS Pro and Python and allows processing of UAV multispectral images with channels for RGB, near-infrared, and red edge. The tool provides selection among four tested models: Faster R-CNN, Mask R-CNN, TensorMask, and SAM.
For Faster R-CNN, Mask R-CNN, and TensorMask, the NDRE (Normalized Difference Red Edge Index) of the multispectral image is first calculated. Subsequently, instance segmentation is performed, and a shapefile containing the individual trees is generated. It should be noted that, due to the optimal hyperparameter configuration, the calculation using SAM may take more than a day.
To run this project, follow these steps:
- Download the toolbox file here.
- Open TreeSegV1.0.atbx in ArcGIS Pro. See Connect to a toolbox for more information.
- Run the script tool and follow the instructions.
- Import the UAV multispectral image (B, G, R, NIR, RE) into ArcGIS Pro.
- Select the desired model.
- Run the script tool to perform the instance segmentation and generate the shapefile of individual trees.
Upon first execution of the tool, automatic installation of the required dependencies will occur. This process may take 20 minutes or longer, depending on your internet connection and system performance.
To test or explore the tool with example data, you can download a sample UAV multispectral dataset here:
Download Sample Dataset
This dataset includes:
- Multispectral UAV imagery (RGB, NIR, RE)
- Reference shapefiles of individual trees for validation or comparison
Some users have encountered the following error when running the tool:
AttributeError: module 'PIL' has no attribute 'Image'
This error typically occurs when PIL is imported incorrectly. To fix it:
-
Ensure you import the module correctly:
from PIL import Image -
Make sure that the Pillow library (a maintained fork of PIL) is installed and up to date:
pip install --upgrade pillow -
If the issue persists, refer to this helpful StackOverflow thread:
https://stackoverflow.com/questions/11911480/python-pil-has-no-attribute-image
The tool automatically downloads the required model checkpoints. For reference, the checkpoints can be found at the following links:
For more detailed information, please refer to the related paper: Link to Paper.
This project is licensed under the License.