RandomColorJitter¶
- class torchaug.transforms.RandomColorJitter(brightness=None, contrast=None, saturation=None, hue=None, p=0.5, 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:Nonecontrast (
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:Nonesaturation (
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:Nonehue (
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:Nonep (
float, optional) – probability of image being color jittered. Default:0.5batch_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:Falsenum_chunks (
int, optional) – number of chunks to split the input into. Default:1permute_chunks (
bool, optional) – whether to permute the chunks. Default:Falsebatch_transform (
bool, optional) – whether to apply the transform in batch mode. Default:False