pyiqa.matlab_utils.resize

A standalone PyTorch implementation for fast and efficient bicubic resampling. The resulting values are the same to MATLAB function imresize(‘bicubic’). ## Author: Sanghyun Son ## Email: sonsang35@gmail.com (primary), thstkdgus35@snu.ac.kr (secondary) ## Version: 1.2.0 ## Last update: July 9th, 2020 (KST) Dependency: torch Example:: >>> import torch >>> import core >>> x = torch.arange(16).float().view(1, 1, 4, 4) >>> y = core.imresize(x, sizes=(3, 3)) >>> print(y) tensor([[[[ 0.7506, 2.1004, 3.4503],

[ 6.1505, 7.5000, 8.8499], [11.5497, 12.8996, 14.2494]]]])

Module Contents

pyiqa.matlab_utils.resize.imresize(x: torch.Tensor, scale: float | None = None, sizes: Tuple[int, int] | None = None, kernel: str | torch.Tensor = 'cubic', sigma: float = 2, rotation_degree: float = 0, padding_type: str = 'reflect', antialiasing: bool = True) torch.Tensor[source]
Parameters:
  • x (torch.Tensor)

  • scale (float)

  • sizes (tuple(int, int))

  • kernel (str, default='cubic')

  • sigma (float, default=2)

  • rotation_degree (float, default=0)

  • padding_type (str, default='reflect')

  • antialiasing (bool, default=True)

Return type:

torch.Tensor