(image, image_size)
return tf.expand_dims(image, 0)
Center-crop into a square and resize to image_size.

  Args:
    image: A 3-D image `Tensor`.
    image_size: int, Desired size. Crops the image to a square and resizes it
      to the requested size.

  Returns:
    A 4-D tensor of shape [1, image_size, image_size, 3] and dtype float32,
    with values in [0, 1].
Center-crop into a square and resize to image_size.
Center - crop into a square and resize to image_size .
def center_crop_resize_image(image, image_size):
  """Center-crop into a square and resize to image_size.

  Args:
    image: A 3-D image `Tensor`.
    image_size: int, Desired size. Crops the image to a square and resizes it
      to the requested size.

  Returns:
    A 4-D tensor of shape [1, image_size, image_size, 3] and dtype float32,
    with values in [0, 1].
  """
  shape = tf.shape(image)
  small_side = tf.minimum(shape[0], shape[1])
  image = tf.image.resize_image_with_crop_or_pad(image, small_side, small_side)
  image = tf.to_float(image) / 255.0

  image = tf.image.resize_images(image, tf.constant([image_size, image_size]))

  return tf.expand_dims(image, 0)
def center_crop_resize_image ( image , image_size ) : shape = tf . shape ( image ) small_side = tf . minimum ( shape [ 0 ] , shape [ 1 ] ) image = tf . image . resize_image_with_crop_or_pad ( image , small_side , small_side ) image = tf . to_float ( image ) / 255.0 image = tf . image . resize_images ( image , tf . constant ( [ image_size , image_size ] ) ) return tf . expand_dims ( image , 0 )