terrainseg.utils.spatialpredict

Functions

terrainPredict(image_in, pred_out, model[, chip_size, ...])

Use train model to make predictions over a spatial extent.

Module Contents

terrainseg.utils.spatialpredict.terrainPredict(image_in: str, pred_out: str, model: torch.nn.Module, chip_size: int = 640, stride_x: int = 256, stride_y: int = 256, crop: int = 128, device: str = 'cuda')[source]

Use train model to make predictions over a spatial extent.

Parameters:
  • image_in (str) – Path and name of input DTM over which to make prediction. Must include the file extension.

  • pred_out (str) – Path and name of output raster grid. Must include the file extension.

  • model (nn.Module) – Instantiated model with weights loaded.

  • chip_size (int, default=640) – Size of window used to make predictions.

  • stride_x (int, default=256) – Stride in the x direction. Must be smaller than chip_size.

  • stride_y (int, default=256) – Stride in the y direction. Must be smaller than chip_size.

  • crop (int, default=128) – Number of rows and columns of cells or pixels to crop from each window. Avoids including margin cells in final predictions.

  • device (str) – Device on which to perform predictions. Default is “cuda”.