Shortcuts

ColorJitter

class mmpretrain.datasets.transforms.ColorJitter(brightness=0.0, contrast=0.0, saturation=0.0, hue=0.0, backend='pillow')[source]

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

Modified from https://github.com/pytorch/vision/blob/main/torchvision/transforms/transforms.py Licensed under the BSD 3-Clause License.

Required Keys:

  • img

Modified Keys:

  • img

Parameters:
  • brightness (float | Sequence[float] (min, max)) – 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. Defaults to 0.

  • contrast (float | Sequence[float] (min, max)) – 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. Defaults to 0.

  • saturation (float | Sequence[float] (min, max)) – 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. Defaults to 0.

  • hue (float | Sequence[float] (min, max)) – How much to jitter hue. hue_factor is chosen uniformly from [-hue, hue] (0 <= hue <= 0.5) or the given [min, max] (-0.5 <= min <= max <= 0.5). Defaults to 0.

  • backend (str) – The backend to operate the image. Defaults to ‘pillow’

transform(results)[source]

Transform function to resize images.

Parameters:

results (dict) – Result dict from loading pipeline.

Returns:

ColorJitter results, ‘img’ key is updated in result dict.

Return type:

dict

Read the Docs v: latest
Versions
latest
stable
mmcls-1.x
mmcls-0.x
dev
Downloads
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.