(image,
                         output_height,
                         output_width,
                         resize_side_min=_RESIZE_SIDE_MIN,
                         resize_side_max=_RESIZE_SIDE_MAX)
return _mean_image_subtraction(image, [_R_MEAN, _G_MEAN, _B_MEAN])
Preprocesses the given image for training.

  Note that the actual resizing scale is sampled from
    [`resize_size_min`, `resize_size_max`].

  Args:
    image: A `Tensor` representing an image of arbitrary size.
    output_height: The height of the image after preprocessing.
    output_width: The width of the image after preprocessing.
    resize_side_min: The lower bound for the smallest side of the image for
      aspect-preserving resizing.
    resize_side_max: The upper bound for the smallest side of the image for
      aspect-preserving resizing.

  Returns:
    A preprocessed image.
Preprocesses the given image for training.
Preprocesses the given image for training .
def preprocess_for_train(image,
                         output_height,
                         output_width,
                         resize_side_min=_RESIZE_SIDE_MIN,
                         resize_side_max=_RESIZE_SIDE_MAX):
  """Preprocesses the given image for training.

  Note that the actual resizing scale is sampled from
    [`resize_size_min`, `resize_size_max`].

  Args:
    image: A `Tensor` representing an image of arbitrary size.
    output_height: The height of the image after preprocessing.
    output_width: The width of the image after preprocessing.
    resize_side_min: The lower bound for the smallest side of the image for
      aspect-preserving resizing.
    resize_side_max: The upper bound for the smallest side of the image for
      aspect-preserving resizing.

  Returns:
    A preprocessed image.
  """
  resize_side = tf.random_uniform(
      [], minval=resize_side_min, maxval=resize_side_max+1, dtype=tf.int32)

  image = _aspect_preserving_resize(image, resize_side)
  image = _random_crop([image], output_height, output_width)[0]
  image.set_shape([output_height, output_width, 3])
  image = tf.to_float(image)
  image = tf.image.random_flip_left_right(image)
  return _mean_image_subtraction(image, [_R_MEAN, _G_MEAN, _B_MEAN])
def preprocess_for_train ( image , output_height , output_width , resize_side_min = _RESIZE_SIDE_MIN , resize_side_max = _RESIZE_SIDE_MAX ) : resize_side = tf . random_uniform ( [ ] , minval = resize_side_min , maxval = resize_side_max + 1 , dtype = tf . int32 ) image = _aspect_preserving_resize ( image , resize_side ) image = _random_crop ( [ image ] , output_height , output_width ) [ 0 ] image . set_shape ( [ output_height , output_width , 3 ] ) image = tf . to_float ( image ) image = tf . image . random_flip_left_right ( image ) return _mean_image_subtraction ( image , [ _R_MEAN , _G_MEAN , _B_MEAN ] )