code: def preprocess_image(
      image_buffer,
      output_height,
      output_width,
      num_channels,
      is_training=False,
  ):
      """Preprocesses the given image.
  
      Preprocessing includes decoding, cropping, and resizing for both training
      and eval images. Training preprocessing, however, introduces some random
      distortion of the image to improve accuracy.
  
      Args:
          image_buffer: scalar string Tensor representing the raw JPEG image buffer.
          bbox: 3-D float Tensor of bounding boxes arranged [1, num_boxes, coords]
              where each coordinate is [0, 1) and the coordinates are arranged as
              [ymin, xmin, ymax, xmax].
          output_height: The height of the image after preprocessing.
          output_width: The width of the image after preprocessing.
          num_channels: Integer depth of the image buffer for decoding.
          is_training: `True` if we're preprocessing the image for training and
              `False` otherwise.
  
      Returns:
          A preprocessed image.
      """
      if is_training:
          # For training, we want to randomize some of the distortions.
          image = _decode_crop_and_flip(image_buffer, num_channels)
          image = _resize_image(image, output_height, output_width)
      else:
          # For validation, we want to decode, resize, then just crop the middle.
          if isinstance(image_buffer, bytes):
              image = tf.image.decode_jpeg(
                  image_buffer, channels=num_channels
              )
          else:
              image = image_buffer
          image = _aspect_preserving_resize(image, _RESIZE_MIN)
          image = _central_crop(image, output_height, output_width)
  
      image.set_shape([output_height, output_width, num_channels])
  
      return _mean_image_subtraction(image, CHANNEL_MEANS, num_channels)
  
file_path: ray/release/air_tests/air_benchmarks/mlperf-train/tf_utils.py
imports: import tensorflow
  import functools
  import logging
label_desc: Use image node_id 12 for calling a global function with example usage: preprocess_image(image_buffer, output_height, output_width, num_channels, is_training) and returns: _mean_image_subtraction