API Reference

deeptrees.predict(image_path, config_path)[source]

Run tree crown delineation prediction on the provided image paths using the given configuration.

Parameters:
  • image_path (list[str]) – A list of file paths to the images to be processed.

  • config_path (str) – The file path to the configuration file for the prediction.

Returns:

This function does not return any value. It performs the prediction in-place.

Return type:

None

Tree Crown Delineation Inference Script

This script performs tree crown delineation using a pre-trained DeepTreesModel. It loads the model configuration, initializes the model, and runs inference on input raster images to predict tree crowns. The predictions are saved as raster files, and post-processing is performed to extract polygons representing tree crowns.

Classes:

TreeCrownPredictor: A class to handle the loading of the model, running inference, and post-processing.

Usage:

python inference.py

Example

predictor = TreeCrownPredictor(config_path=”./config”, image_path=[“/path/to/raster/image.tif”]) predictor.predict(‘/path/to/raster/image.tif’, ‘/path/to/config’)

class deeptrees.inference.TreeCrownPredictor(image_path=None, config_path='./config/inference_on_individual_tiles.yaml')[source]

Bases: object

A class to handle the loading of the model, running inference, and post-processing.

config

The configuration loaded from a YAML file.

Type:

OmegaConf

model

The deep learning model for tree crown delineation.

Type:

DeepTreesModel

image_path

The path to the input raster image.

Type:

str

dataset

The dataset for inference.

Type:

TreeCrownDelineationInferenceDataset

_initialize_model()[source]

Initializes the model with the configuration parameters.

predict()[source]

Runs inference on the input data and performs post-processing and saves the results.

__init__(image_path=None, config_path='./config/inference_on_individual_tiles.yaml')[source]

Initializes the TreeCrownPredictor with the given configuration.

Parameters:
  • config_path (str) – The path to the configuration folder.

  • image_path (str) – The path to the input raster image.

_initialize_model()[source]

Initializes the model with the configuration parameters.

predict()[source]

Runs inference on the input data and performs post-processing.