I would like to use tf.Data to process some video frames but I can't get Decord to work with from_generator.
Versions: Decord: 0.3.9 tf: 2.2.0
Here's some minimal code to reproduce the issue. Any help is appreciated.
from decord import VideoReader
from decord import cpu, gpu
import tensorflow as tf
# use whatever video here e.g. http://file.all-free-download.com/downloadfiles/footage/traffic_jam_new_work_street_583.zip
vr = VideoReader('traffic_jam_new_work_street_583.mp4', ctx=cpu(0))
def frame_gen_decord():
for k in range(len(vr)):
sample = vr.next().asnumpy()
yield sample
g = frame_gen_decord()
x = next(g)
h, w, c = x.shape
dataset = tf.data.Dataset.from_generator(
frame_gen_decord,
output_types=(tf.int32),
output_shapes=(tf.TensorShape([h, w, c]))
)
# this throws an error
for frame in dataset.take(1):
x = frame
Hello;
I would like to use tf.Data to process some video frames but I can't get Decord to work with from_generator. Versions: Decord: 0.3.9 tf: 2.2.0
Here's some minimal code to reproduce the issue. Any help is appreciated.