Open ggregoire opened 1 year ago
It's not faster but it is more concise:
vr = VideoReader(video, ctx=gpu(0))
frames = vr[:].asnumpy()
Also do you really need ctx=gpu(0)
? Isn't numpy always on cpu anyway ?
I'm not a numpy expert but we see our script appearing in nvidia-smi
when we use ctx=gpu(0)
so I guess it works.
The weird thing though: when we hash the frames, the hashes are different when we use ctx=cpu(0)
and ctx=gpu(0)
.
For instance:
vr_gpu = VideoReader(video, ctx=gpu(0))
vr_cpu = VideoReader(video) # defaults to ctx=cpu(0)
hash(vr_gpu[0].asnumpy()) == hash(vr_cpu[0].asnumpy()) # => False
Hi there,
I'm using
get_batch
to get all the frames from a 1 min video and I wanted to ask you if there is a fastest method to achieve this? I read the code fromvideo_reader.py
and I don't think so, but I just wanted to confirm.Here is my code:
Thank you.