def decode_jpeg_original(self, image_buffer, scope=None):
with tf.op_scope([image_buffer], scope, 'decode_jpeg'):
# decode jpeg
fn = lambda encoded: tf.image.decode_jpeg(encoded,
channels=3,
ratio=FLAGS.decode_downsample_factor)
# TODO: change parallel iterations
decoded = tf.map_fn(fn,
image_buffer,
dtype=tf.uint8,
parallel_iterations=1,
back_prop=False,
swap_memory=False,
infer_shape=True,
name="map_decode_jpeg")
# move the float convertion to GPU, to save bandwidth
# to float, to the range 0.0 - 255.0
#images = tf.cast(decoded, dtype=tf.float32, name="image_to_float")
decoded.set_shape([FLAGS.FRAMES_IN_SEG // FLAGS.temporal_downsample_factor,
FLAGS.IM_HEIGHT / FLAGS.decode_downsample_factor,
FLAGS.IM_WIDTH / FLAGS.decode_downsample_factor, 3])
return decoded
评论列表
文章目录