vis4d.data.transforms.photometric

Photometric transforms.

Classes

ColorJitter(*[, in_keys, out_keys, sensors, ...])

Apply color jitter to images.

RandomBrightness(*[, in_keys, out_keys, ...])

Apply Brightness transformation to images.

RandomContrast(*[, in_keys, out_keys, ...])

Apply Contrast transformation to images.

RandomGamma(*[, in_keys, out_keys, sensors, ...])

Apply Gamma transformation to images.

RandomHSV(*[, in_keys, out_keys, sensors, ...])

Apply HSV transformation to images.

RandomHue(*[, in_keys, out_keys, sensors, ...])

Apply hue transformation to images.

RandomSaturation(*[, in_keys, out_keys, ...])

Apply saturation transformation to images.

class ColorJitter(*, in_keys=['images'], out_keys=['images'], sensors=None, same_on_batch=True, **kwargs)[source]

Apply color jitter to images.

Parameters:
  • brightness_range (tuple[float, float]) – Range of brightness values.

  • contrast_range (tuple[float, float]) – Range of contrast values.

  • saturation_range (tuple[float, float]) – Range of saturation values.

  • hue_range (tuple[float, float]) – Range of hue values.

  • image_channel_mode (str, optional) – Image channel mode. Defaults to “RGB”.

__call__(images)[source]

Call function for Hue transformation.

Return type:

list[ndarray[Any, dtype[float32]]]

class RandomBrightness(*, in_keys=['images'], out_keys=['images'], sensors=None, same_on_batch=True, **kwargs)[source]

Apply Brightness transformation to images.

Parameters:
  • brightness_range (tuple[float, float]) – Range of brightness values.

  • image_channel_mode (str, optional) – Image channel mode. Defaults to “RGB”.

__call__(images)[source]

Call function for Brightness transformation.

Return type:

list[ndarray[Any, dtype[float32]]]

class RandomContrast(*, in_keys=['images'], out_keys=['images'], sensors=None, same_on_batch=True, **kwargs)[source]

Apply Contrast transformation to images.

Parameters:
  • contrast_range (tuple[float, float]) – Range of contrast values.

  • image_channel_mode (str, optional) – Image channel mode. Defaults to “RGB”.

__call__(images)[source]

Call function for Contrast transformation.

Return type:

list[ndarray[Any, dtype[float32]]]

class RandomGamma(*, in_keys=['images'], out_keys=['images'], sensors=None, same_on_batch=True, **kwargs)[source]

Apply Gamma transformation to images.

Parameters:
  • gamma_range (tuple[float, float]) – Range of gamma values.

  • image_channel_mode (str, optional) – Image channel mode. Defaults to “RGB”.

__call__(images)[source]

Call function for Gamma transformation.

Return type:

list[ndarray[Any, dtype[float32]]]

class RandomHSV(*, in_keys=['images'], out_keys=['images'], sensors=None, same_on_batch=True, **kwargs)[source]

Apply HSV transformation to images.

Used by YOLOX. Modifed from: https://github.com/Megvii-BaseDetection/YOLOX.

Parameters:
  • hue_delta (int) – Delta for hue.

  • saturation_delta (int) – Delta for saturation.

  • value_delta (int) – Delta for value.

  • image_channel_mode (str, optional) – Image channel mode. Defaults to “BGR”.

__call__(images)[source]

Call function for Hue transformation.

Return type:

list[ndarray[Any, dtype[float32]]]

class RandomHue(*, in_keys=['images'], out_keys=['images'], sensors=None, same_on_batch=True, **kwargs)[source]

Apply hue transformation to images.

Parameters:
  • hue_range (tuple[float, float]) – Range of hue values.

  • image_channel_mode (str, optional) – Image channel mode. Defaults to “RGB”.

__call__(images)[source]

Call function for Hue transformation.

Return type:

list[ndarray[Any, dtype[float32]]]

class RandomSaturation(*, in_keys=['images'], out_keys=['images'], sensors=None, same_on_batch=True, **kwargs)[source]

Apply saturation transformation to images.

Parameters:
  • saturation_range (tuple[float, float]) – Range of saturation values.

  • image_channel_mode (str, optional) – Image channel mode. Defaults to “RGB”.

__call__(images)[source]

Call function for saturation transformation.

Return type:

list[ndarray[Any, dtype[float32]]]