urbanlc.model.train_utils.segment_satelite_image#

urbanlc.model.train_utils.segment_satelite_image(img: Tensor, sub_size: Optional[int] = 224, stride: Optional[int] = None) Tuple[List[Tensor], List[tuple]]#

Partition a satellite image into patches of specified size and stride.

This function takes a satellite image and partitions it into patches of a specified size and stride. It returns a list of partitioned patches and a list of corresponding coordinates (bounding boxes) for each patch.

Parameters:
  • img (torch.Tensor) – Input satellite image.

  • sub_size (Optional[int]) – Size of the patches. Defaults to 224.

  • stride (Optional[int]) – Stride for patch extraction. Defaults to None.

Returns:

List of partitioned patches and corresponding coordinates.

Return type:

Tuple[List[torch.Tensor], List[tuple]]