y_preprocessing.py 文件源码

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

项目:spoofnet-tensorflow 作者: yomna-safaa 项目源码 文件源码
def preprocess_for_eval(image, output_height, output_width, resize_side, # YY: ):
                        sub_mean_pixel=True, use_per_img_std=False,
                        use_aspect_pres_resize=True):
  """Preprocesses the given image for evaluation.

  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.
    resize_side: The smallest side of the image for aspect-preserving resizing.

  Returns:
    A preprocessed image.
  """
  if use_aspect_pres_resize:
    image = _aspect_preserving_resize(image, resize_side)
  else:
    image = _square_resize(image, resize_side)
  image = _central_crop([image], output_height, output_width)[0]
  image.set_shape([output_height, output_width, 3])
  image = tf.to_float(image)
  return process_image_crop(image, sub_mean_pixel, use_per_img_std)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号