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