RandomPhotometricDistort¶
- class torchaug.transforms.RandomPhotometricDistort(brightness=(0.875, 1.125), contrast=(0.5, 1.5), saturation=(0.5, 1.5), hue=(-0.05, 0.05), p_transform=0.5, p=0.5, batch_inplace=False, num_chunks=1, permute_chunks=False, batch_transform=False)[source]¶
Randomly distorts the image or video as used in SSD: Single Shot MultiBox Detector.
This transform relies on
ColorJitterunder the hood to adjust the contrast, saturation, hue, brightness, and also randomly permutes channels.- Parameters:
brightness (
Tuple[float,float], optional) – How much to jitter brightness. brightness_factor is chosen uniformly from [min, max]. Should be non negative numbers. Default:(0.875, 1.125)contrast (
Tuple[float,float], optional) – How much to jitter contrast. contrast_factor is chosen uniformly from [min, max]. Should be non-negative numbers. Default:(0.5, 1.5)saturation (
Tuple[float,float], optional) – How much to jitter saturation. saturation_factor is chosen uniformly from [min, max]. Should be non negative numbers. Default:(0.5, 1.5)hue (
Tuple[float,float], optional) – How much to jitter hue. hue_factor is chosen uniformly from [min, max]. Should have -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:(-0.05, 0.05)p_transform (
float, optional) – probability each distortion operation (contrast, saturation, …) to be applied. Default:0.5p (
float, optional) – probability of the image being photometrically distorted. 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 batched 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