resize

dnois.utils.resize(image: Tensor, target_size: int | tuple[int, int], mode: str = 'constant', value: float = 0) Tensor

Resize an image to given size by padding or cropping around its edges.

Parameters:
  • image (Tensor) – The image to be resized.

  • target_size (int | tuple[int, int]) – Target size in vertical and horizontal direction.

  • mode (str) – See torch.nn.functional.pad().

  • value (float) – See torch.nn.functional.pad().

Returns:

Resized image with given size.

Return type:

Tensor