image_processing.py 文件源码

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

项目:terngrad 作者: wenwei202 项目源码 文件源码
def decode_raw(image_buffer, orig_height, orig_width, scope=None):
  """Decode a RAW string into one 3-D float image Tensor.

  Args:
    image_buffer: scalar string Tensor.
    [orig_height, orig_width]: the size of original image
    scope: Optional scope for op_scope.
  Returns:
    3-D float Tensor with values ranging from [0, 1).
  """
  with tf.op_scope([image_buffer], scope, 'decode_raw'):
    # Decode the string as an raw RGB.
    image = tf.decode_raw(image_buffer, tf.uint8)

    image = tf.reshape(image, tf.concat([orig_height,orig_width,[3]],0))

    # After this point, all image pixels reside in [0,1)
    # The various adjust_* ops all require this range for dtype float.
    image = tf.image.convert_image_dtype(image, dtype=tf.float32)
    return image
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号