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
评论列表
文章目录