Skip to content

Instantly share code, notes, and snippets.

View tomrunia's full-sized avatar

Tom Runia tomrunia

View GitHub Profile
@tomrunia
tomrunia / video_input_pipeline.py
Created January 9, 2018 15:28
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)