TreeMortNet is a Python package for predicting individual tree mortality from high-resolution, four-band (RGB + NIR) NAIP imagery using polygons representing tree crowns, perhaps delineated using airborne lidar.
The package wraps a pre-trained TensorFlow model and provides a simple, file-based prediction interface.
- Python 3.11 (other versions of Python might work, but must be compatible with TensorFlow version)
- TensorFlow ≥2.19
- GeoPandas / Rasterio stack
- NAIP imagery aligned with crown polygons
- Same CRS
GPU acceleration is optional. CPU-only inference works well for thousands of tree crowns.
Clone the repository and install locally:
git clone https://github.com/mickeycampbell/TreeMortNet.git
cd TreeMortNet
pip install -e .
The main function for applying TreeMortNet is treemortnet.predict_crowns(). It takes two inputs:
crown_path: File path pointing to tree crown polygons in any common vector format readable by geopandasnaip_path: File path pointing to NAIP imagery in any common raster format readable by rasterio
from treemortnet import predict_crowns
gdf = predict_crowns(
crown_path="crowns.gpkg",
naip_path="naip.tif",
output_path="predictions.gpkg"
)The function returns a GeoDataFrame equivalent to the input, but with two new fields appended:
prob_dead: The predicted probability that a given tree crown is deadpred_dead: A binary representation of live (0) or dead (1), based on aprob_dead≥ 0.5 threshold
- Input crown polygons must be in the same CRS as the NAIP image
- Crown polygons must overlap the NAIP data
- By default, this package is designed to work with
tensorflow-cpu, as defined in therequirements.txt. This was chosen to enhance broad applicability, given the complexities of GPU-CUDA-TensorFlow versions; however, you can leverage GPU acceleration if you have GPU-enabledtensorflow >= 2.19installed. It is worth noting that, even with CPU, predictions are made for several thousand tree crowns within minutes.
This repository also includes a simplified reference implementation of the model training workflow used to produce the pre-trained TreeMortNet model.
Training code is provided in the training/ subdirectory and is intended for transparency and reproducibility, not
as a supported or configurable training API. The training script demonstrates the key preprocessing steps, model
architecture, and training logic used in this study, but omits experiment tracking, hyperparameter search, and other
research-oriented scaffolding.
Users interested in applying TreeMortNet are encouraged to use the provided prediction interface. Users interested in model development or methodological details may consult the training reference materials.
If you use this tool, please cite:
TBD