Skip to content

Instantly share code, notes, and snippets.

@showgood163
showgood163 / video_input_pipeline.py
Created January 21, 2019 08:59 — forked from tomrunia/video_input_pipeline.py
TensorFlow video input pipeline using TFRecord files (for Kinetics dataset)
def decode(serialized_example, sess):
'''
Given a serialized example in which the frames are stored as
compressed JPG images 'frames/0001', 'frames/0002' etc., this
function samples SEQ_NUM_FRAMES from the frame list, decodes them from
JPG into a tensor and packs them to obtain a tensor of shape (N,H,W,3).
Returns the the tuple (frames, class_label (tf.int64)
:param serialized_example: serialized example from tf.data.TFRecordDataset
:return: tuple: (frames (tf.uint8), class_label (tf.int64)