Skip to content

mickeycampbell/TreeMortNet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TreeMortNet

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.

Requirements

  • 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.

Installation

Clone the repository and install locally:

git clone https://github.com/mickeycampbell/TreeMortNet.git
cd TreeMortNet
pip install -e .

Example Usage

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 geopandas
  • naip_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 dead
  • pred_dead: A binary representation of live (0) or dead (1), based on a prob_dead ≥ 0.5 threshold

Notes

  • 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 the requirements.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-enabled tensorflow >= 2.19 installed. It is worth noting that, even with CPU, predictions are made for several thousand tree crowns within minutes.

Model Training and Reproducibility

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.

Citation

If you use this tool, please cite:

TBD

About

TreeMortNet is a Python package for predicting individual tree-level mortality using NAIP imagery and lidar-derived tree crown polygons. It uses a pre-trained residual convolutional neural network to make predictions, and should be applicable to most forest and woodland types of the Western US.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages