BatchRandomSolarize#

class torchaug.batch_transforms.BatchRandomSolarize(threshold, p=0.5, inplace=False, value_check=False)[source]#

Solarize the batch of images randomly with a given probability by inverting all pixel values above a threshold.

The batch if images it is expected to be in [B, …, 1 or 3, H, W] format, where … means it can have an arbitrary number of 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

  • inplace (bool, optional) – If True, perform inplace operation to save memory and time.

    Default: False

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

    Default: False

apply_transform(imgs)[source]#

Solarize the batch of images.

Parameters:

imgs (Tensor) – Batch of images to be solarized.

Return type:

Tensor

Returns:

Randomly solarized batch of images.