Skip to content

Instantly share code, notes, and snippets.

@AdityaKane2001
Created January 15, 2022 16:12
Show Gist options
  • Save AdityaKane2001/4b78596a3cf74c560626d918cd3ae837 to your computer and use it in GitHub Desktop.
Save AdityaKane2001/4b78596a3cf74c560626d918cd3ae837 to your computer and use it in GitHub Desktop.
def random_flip(self, image: tf.Tensor, target: tf.Tensor) -> tuple:
"""
Returns randomly flipped batch of images. Only horizontal flip
is available
Args:
image: Batch of images to perform random rotation on.
target: Target tensor.
Returns:
Augmented example with batch of images and targets with same dimensions.
"""
aug_images = tf.image.random_flip_left_right(image)
return aug_images, target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment