urbanlc.model.train_utils.combine_prediction#

urbanlc.model.train_utils.combine_prediction(preds: Tensor, coordinates: List[Tuple[int]], original_size: Tuple[int], method: Optional[str] = 'mean') Tensor#

Combine predictions from partitioned patches into a complete prediction.

This function combines predictions from partitioned patches into a complete prediction for the entire image. The method for combining predictions in the overlapped regions can be specified (default is mean).

Parameters:
  • preds (torch.Tensor) – Predictions from partitioned patches.

  • coordinates (List[Tuple[int]]) – List of coordinates (bounding boxes) for each patch.

  • original_size (Tuple[int]) – Original size of the complete prediction.

  • method (Optional[str]) – Method for combining predictions in the overlapped regions. Defaults to “mean”.

Returns:

Combined prediction.

Return type:

torch.Tensor