lenet_preprocessing.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:segmentation-models 作者: desimone 项目源码 文件源码
def preprocess_image(image, output_height, output_width, is_training):
  """Preprocesses the given image.

      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.
        is_training: `True` if we're preprocessing the image for training and
          `False` otherwise.

      Returns:
        A preprocessed image.
      """
  image = tf.to_float(image)
  image = tf.image.resize_image_with_crop_or_pad(image, output_width,
                                                 output_height)
  image = tf.sub(image, 128.0)
  image = tf.div(image, 128.0)
  return image
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号