Shortcuts

ColorJitter

class mmcls.datasets.transforms.ColorJitter(brightness=0.0, contrast=0.0, saturation=0.0, hue=0.0)[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.

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: 1.x
Versions
master
latest
1.x
dev-1.x
Downloads
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.