MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / random_flip_left_right

Function random_flip_left_right

tensorflow/python/ops/image_ops_impl.py:348–366  ·  view source on GitHub ↗

Randomly flip an image horizontally (left to right). With a 1 in 2 chance, outputs the contents of `image` flipped along the second dimension, which is `width`. Otherwise output the image as-is. Args: image: 4-D Tensor of shape `[batch, height, width, channels]` or 3-D Tensor of s

(image, seed=None)

Source from the content-addressed store, hash-verified

346
347@tf_export('image.random_flip_left_right')
348def random_flip_left_right(image, seed=None):
349 """Randomly flip an image horizontally (left to right).
350
351 With a 1 in 2 chance, outputs the contents of `image` flipped along the
352 second dimension, which is `width`. Otherwise output the image as-is.
353
354 Args:
355 image: 4-D Tensor of shape `[batch, height, width, channels]` or 3-D Tensor
356 of shape `[height, width, channels]`.
357 seed: A Python integer. Used to create a random seed. See
358 `tf.compat.v1.set_random_seed` for behavior.
359
360 Returns:
361 A tensor of the same type and shape as `image`.
362
363 Raises:
364 ValueError: if the shape of `image` not supported.
365 """
366 return _random_flip(image, 1, seed, 'random_flip_left_right')
367
368
369def _random_flip(image, flip_index, seed, scope_name):

Callers

nothing calls this directly

Calls 1

_random_flipFunction · 0.85

Tested by

no test coverage detected