MCPcopy Create free account
hub / github.com/NVIDIA/DALI / read_video

Function read_video

dali/test/python/operator_1/test_debayer.py:53–76  ·  view source on GitHub ↗
(num_sequences, num_frames, height, width, seed=42)

Source from the content-addressed store, hash-verified

51
52
53def read_video(num_sequences, num_frames, height, width, seed=42):
54 roi_start = (90, 0)
55 roi_end = (630, 1280)
56 vid_filenames = [os.path.join(vid_dir, vid_file) for vid_file in vid_files]
57
58 @pipeline_def
59 def pipeline():
60 video = fn.readers.video_resize(
61 filenames=vid_filenames,
62 name="video reader",
63 sequence_length=num_frames,
64 file_list_include_preceding_frame=True,
65 device="gpu",
66 roi_start=roi_start,
67 roi_end=roi_end,
68 seed=seed,
69 resize_x=width,
70 resize_y=height,
71 )
72 return video
73
74 pipe = pipeline(batch_size=num_sequences, device_id=0, num_threads=4)
75 (batch,) = pipe.run()
76 return [np.array(seq) for seq in batch.as_cpu()]
77
78
79def prepare_test_imgs(num_samples, dtype):

Callers 1

setUpClassMethod · 0.85

Calls 2

pipelineFunction · 0.70
runMethod · 0.45

Tested by

no test coverage detected