image_processing.py 文件源码

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

项目:terngrad 作者: wenwei202 项目源码 文件源码
def eval_alexnet_image(image, height, width, scope=None):
  """Prepare one image for evaluation.

  Args:
    image: 3-D float Tensor
    height: integer
    width: integer
    scope: Optional scope for op_scope.
  Returns:
    3-D float Tensor of prepared image.
  """
  with tf.op_scope([image, height, width], scope, 'eval_image'):
    image = tf.image.resize_images(image, [_RESIZE_SIDE, _RESIZE_SIDE])

    # Crop the central region of the image
    image = tf.image.resize_image_with_crop_or_pad(image, height, width)

    # scale and reduce mean
    image = tf.multiply(image, 255.0)
    image.set_shape([height, width, 3])
    image = _mean_image_subtraction(image, [_R_MEAN, _G_MEAN, _B_MEAN])
    return image
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号