metallic.data.transforms

class metallic.data.transforms.Rotation(angle: int, resample: int = False, expand: bool = False, center: Optional[Union[list, tuple]] = None)[source]

Rotate the the given PIL Image or torch Tensor by the given angle.

Parameters
  • angle (int) – Rotation angle

  • resample (int, optional, default=False) – An optional resampling filter. See filter for more information. If omitted, or if the image has mode “1” or “P”, it is set to PIL.Image.NEAREST. If input is Tensor, only PIL.Image.NEAREST and PIL.Image.BILINEAR are supported.

  • expand (bool, optional, default=False) – Optional expansion flag. If true, expands the output to make it large enough to hold the entire rotated image. If false or omitted, make the output image the same size as the input image. Note that the expand flag assumes rotation around the center and no translation.

  • center (list or tuple, optional, default=False) – Optional center of rotation, (x, y). Origin is the upper left corner. Default is the center of the image.

class metallic.data.transforms.HorizontalFlip[source]

Horizontal flip the given PIL Image or torch Tensor.

class metallic.data.transforms.VerticalFlip[source]

Vertically flip the given PIL Image or torch Tensor.

class metallic.data.transforms.Categorical(n_classes: Optional[int] = None)[source]

Given k classes, map the their labels to [0, k).