Exemplo n.º 1
0
def random_crop(image, size, seed=None, name=None):
    """Randomly crops `image` to size `[target_height, target_width]`.

  The offset of the output within `image` is uniformly random. `image` always
  fully contains the result.

  Args:
    image: 3-D tensor of shape `[height, width, channels]`
    size: 1-D tensor with two elements, specifying target `[height, width]`
    seed: A Python integer. Used to create a random seed. See
      [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed)
      for behavior.
    name: A name for this operation (optional).

  Returns:
    A cropped 3-D tensor of shape `[target_height, target_width, channels]`.
  """
    seed1, seed2 = random_seed.get_seed(seed)
    return gen_image_ops.random_crop(image, size, seed=seed1, seed2=seed2, name=name)
Exemplo n.º 2
0
def random_crop(image, size, seed=None, name=None):
  """Randomly crops `image` to size `[target_height, target_width]`.

  The offset of the output within `image` is uniformly random. `image` always
  fully contains the result.

  Args:
    image: 3-D tensor of shape `[height, width, channels]`
    size: 1-D tensor with two elements, specifying target `[height, width]`
    seed: A Python integer. Used to create a random seed. See
      [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed)
      for behavior.
    name: A name for this operation (optional).

  Returns:
    A cropped 3-D tensor of shape `[target_height, target_width, channels]`.
  """
  seed1, seed2 = random_seed.get_seed(seed)
  return gen_image_ops.random_crop(image, size, seed=seed1, seed2=seed2,
                                   name=name)