anomalib.pre_processing.transforms.custom

Dataset Utils.

Module Contents

Classes

Denormalize

Denormalize Torch Tensor into np image format.

ToNumpy

Convert Tensor into Numpy Array.

class anomalib.pre_processing.transforms.custom.Denormalize(mean: Optional[List[float]] = None, std: Optional[List[float]] = None)[source]

Denormalize Torch Tensor into np image format.

__call__(self, tensor: torch.Tensor) numpy.ndarray[source]

Denormalize the input.

Parameters

tensor (Tensor) – Input tensor image (C, H, W)

Returns

Denormalized numpy array (H, W, C).

__repr__(self)[source]

Representational string.

class anomalib.pre_processing.transforms.custom.ToNumpy[source]

Convert Tensor into Numpy Array.

__call__(self, tensor: torch.Tensor, dims: Optional[Tuple[int, Ellipsis]] = None) numpy.ndarray[source]

Convert Tensor into Numpy Array.

Parameters
  • tensor (Tensor) – Tensor to convert. Input tensor in range 0-1.

  • dims (Optional[Tuple[int, ...]], optional) – Convert dimensions from torch to numpy format. Tuple corresponding to axis permutation from torch tensor to numpy array. Defaults to None.

Returns

Converted numpy ndarray.

__repr__(self) str[source]

Representational string.