Esempio n. 1
0
def check_corrupted_videos():
    corrupted_videos = [corrupted_video_data_root + '/' + f for f in os.listdir(corrupted_video_data_root)]
    for corrupted in corrupted_videos:
        pipe = Pipeline(batch_size=BATCH_SIZE, num_threads=4, device_id=0)
        with pipe:
            vid = fn.video_reader(device="gpu", filenames=corrupted, sequence_length=1)
            pipe.set_outputs(vid)
        pipe.build()
Esempio n. 2
0
def check_container(cont):
    pipe = Pipeline(batch_size=1, num_threads=4, device_id=0)
    path = os.path.join(video_containers_data_root, cont)
    test_videos = [path + '/' + f for f in os.listdir(path)]
    with pipe:
        # mkv container for some reason fails in DALI VFR heuristics
        vid = fn.video_reader(device="gpu",
                              filenames=test_videos,
                              sequence_length=10,
                              skip_vfr_check=True,
                              stride=1,
                              name="Reader")
        pipe.set_outputs(vid)
    pipe.build()

    iter_num = pipe.reader_meta("Reader")["epoch_size"]
    for _ in range(iter_num):
        pipe.run()
Esempio n. 3
0
def create_video_reader_pipeline(sequence_length, files, crop_size):
    images = fn.video_reader(device="gpu",
                             filenames=files,
                             sequence_length=sequence_length,
                             normalized=False,
                             random_shuffle=True,
                             image_type=types.RGB,
                             dtype=types.UINT8,
                             initial_fill=16,
                             pad_last_batch=True,
                             name="Reader")
    images = fn.crop(images,
                     crop=crop_size,
                     dtype=types.FLOAT,
                     crop_pos_x=fn.uniform(range=(0.0, 1.0)),
                     crop_pos_y=fn.uniform(range=(0.0, 1.0)))

    images = fn.transpose(images, perm=[3, 0, 1, 2])

    return images
Esempio n. 4
0
def init_video_data():
    batch_size = 2
    video_directory = os.path.join(os.environ['DALI_EXTRA_PATH'], "db",
                                   "video", "sintel", "video_files")

    video_files = [
        os.path.join(video_directory, f)
        for f in sorted(os.listdir(video_directory))
    ]

    video_pipe = dali.pipeline.Pipeline(batch_size, 3, 0, seed=16)
    with video_pipe:
        input = fn.video_reader(device="gpu",
                                filenames=video_files,
                                sequence_length=32,
                                stride=5)
        video_pipe.set_outputs(input)

    video_pipe.build()
    out = video_pipe.run()
    in_seq = out[0].as_cpu().at(0)
    return in_seq