lightly.transforms

The lightly.transforms package provides additional augmentations.

Contains implementations of Gaussian blur and random rotations which are not part of torchvisions transforms.

.gaussian_blur

Gaussian Blur

class lightly.transforms.gaussian_blur.GaussianBlur(kernel_size: float, prob: float = 0.5, scale: float = 0.2)

Implementation of random Gaussian blur.

Utilizes the built-in ImageFilter method from PIL to apply a Gaussian blur to the input image with a certain probability. The blur is further randomized as the kernel size is chosen randomly around a mean specified by the user.

Attributes:
kernel_size:

Mean kernel size for the Gaussian blur.

prob:

Probability with which the blur is applied.

scale:

Fraction of the kernel size which is used for upper and lower limits of the randomized kernel size.

.rotation

Random Rotation

class lightly.transforms.rotation.RandomRotate(prob: float = 0.5, angle: int = 90)

Implementation of random rotation.

Randomly rotates an input image by an angle.

Attributes:
prob:

Probability with which image is rotated.

angle:

Angle by which the image is rotated.