osc.data.utils.augment_train

augment_train(img: tensorflow.python.framework.ops.Tensor, *, seed: tensorflow.python.framework.ops.Tensor, crop_size: Tuple[int, int], crop_scale: Tuple[float, float], mean: Tuple[float, float, float], std: Tuple[float, float, float]) tensorflow.python.framework.ops.Tensor[source]

Augment image for train/val. Pass different seeds to get different augmentations.

Augmentations applied:

  • uint8 [0-255] -> float32 [0-1]

  • random flip

  • random resized crop (random aspect ratio, zoom factor, resize to crop_size)

  • color jitter (brightness, saturation, hue)

  • normalization to given mean and std

  • pytorch channel order [H W C] -> [C H W]

Parameters
  • img (Tensor) – tf.uint8 tensor

  • seed (Tensor) – random seed used as base seed for all transformations

  • crop_size (Tuple[int, int]) – size of the image after cropping

  • crop_scale (Tuple[float, float]) – minimum and maximum crop scale for example (0.3, 1.0)

  • mean (Tuple[float, float, float]) – image mean for normalization

  • std (Tuple[float, float, float]) – image std for normalization

Return type

Tensor