Hi, When we reader video using nvidia-dali, we get tensorlist with size of (N, F, H, W, C) . How to resize these images using resize op? We get such error: The layout "FHWC" does not match any of the allowed layouts for input 0. Valid layouts are:
HWC
Hi,
Resize operator doesn't support Video kind of input yet. We plan to enable this in the near feature.
In special case, when you extract a sequence of length 1 you can use Reshape or ElementExtract operators and treat the data as an image:
class VideoPipe(Pipeline):
def __init__(self, batch_size, num_threads, device_id, data, shuffle):
super(VideoPipe, self).__init__(batch_size, num_threads, device_id, seed=16)
self.input = ops.VideoReader(device="gpu", filenames=data, sequence_length=1,
shard_id=0, num_shards=1,
random_shuffle=shuffle, initial_fill=initial_prefetch_size)
self.extract = ops.ElementExtract(device="gpu", element_map=0)
self.reshape = ops.Reshape(device="gpu", shape=[720, 1280, 3], layout="HWC") # assumes one frame, this is more efficient, no-copy Op
self.resize = ops.Resize(device="gpu", resize_x=360, resize_y=720)
def define_graph(self):
frames = self.input(name="Reader")
extracted = self.extract(frames)
reshaped = self.reshape(frames)
out0 = self.resize(extracted)
out1 = self.resize(reshaped)
return out0, out1
or
class VideoPipe(Pipeline):
def __init__(self, batch_size, num_threads, device_id, data, shuffle):
super(VideoPipe, self).__init__(batch_size, num_threads, device_id, seed=16)
self.input = ops.VideoReader(device="gpu", filenames=data, sequence_length=4,
shard_id=0, num_shards=1,
random_shuffle=shuffle, initial_fill=initial_prefetch_size)
# Can be used to extract subset of elements from sequence, here taking 0th and 1st element from 4 element sequence
self.extract = ops.ElementExtract(device="gpu", element_map=[0, 1])
self.resize = ops.Resize(device="gpu", resize_x=360, resize_y=720)
def define_graph(self):
frames = self.input(name="Reader")
extracted_0, extracted_1 = self.extract(frames)
out0 = self.resize(extracted_0)
out1 = self.resize(extracted_1)
return out0, out1
Most helpful comment
Hi,
Resize operator doesn't support Video kind of input yet. We plan to enable this in the near feature.
In special case, when you extract a sequence of length 1 you can use Reshape or ElementExtract operators and treat the data as an image:
or