RandomSolarize#

class torchaug.transforms.RandomSolarize(threshold, p=0.5, value_check=False)[source]#

Solarize the image randomly with a given probability by inverting all pixel values above a threshold.

The image is expected to be in […, 1 or 3, H, W] format, where … means it can have an arbitrary number of leading dimensions.

Parameters:
  • threshold (float) – all pixels equal or above this value are inverted.

  • p (float, optional) – probability of the image being solarized.

    Default: 0.5

  • value_check (bool, optional) – Bool to perform tensor value check. Might cause slow down on some devices because of synchronization.

    Default: False

apply_transform(img)[source]#

Solarize the image.

Parameters:

img (Tensor) – Image to be solarized.

Returns:

Solarized image.