ColorJitter

class torchaug.transforms.ColorJitter(brightness=None, contrast=None, saturation=None, hue=None, batch_inplace=False, num_chunks=1, permute_chunks=False, batch_transform=False)[source]

Randomly change the brightness, contrast, saturation and hue of an image or video.

The input is expected to have […, 1 or 3, H, W] shape, where … means an arbitrary number of leading dimensions.

Parameters:
  • brightness (Union[float, Sequence[float], None], optional) – How much to jitter brightness. brightness_factor is chosen uniformly from [max(0, 1 - brightness), 1 + brightness] or the given [min, max]. Should be non negative numbers. Default: None

  • contrast (Union[float, Sequence[float], None], optional) – How much to jitter contrast. contrast_factor is chosen uniformly from [max(0, 1 - contrast), 1 + contrast] or the given [min, max]. Should be non-negative numbers. Default: None

  • saturation (Union[float, Sequence[float], None], optional) – How much to jitter saturation. saturation_factor is chosen uniformly from [max(0, 1 - saturation), 1 + saturation] or the given [min, max]. Should be non negative numbers. Default: None

  • hue (Union[float, Sequence[float], None], optional) – How much to jitter hue. hue_factor is chosen uniformly from [-hue, hue] or the given [min, max]. Should have 0<= hue <= 0.5 or -0.5 <= min <= max <= 0.5. To jitter hue, the pixel values of the input image has to be non-negative for conversion to HSV space; thus it does not work if you normalize your image to an interval with negative values, or use an interpolation that generates negative values before using this function. Default: None

  • p – probability of image being color jittered.

  • batch_inplace (bool, optional) – whether to apply the batch transform in-place. Does not prevent functionals to make copy but can reduce time and memory consumption. Default: False

  • num_chunks (int, optional) – number of chunks to split the input into. Default: 1

  • permute_chunks (bool, optional) – whether to permute the chunks. Default: False

  • batch_transform (bool, optional) – whether to apply the transform in batch mode. Default: False

extra_repr()[source]

Set the extra representation of the transform.

Return type:

str