NVIDIA / NVIDIA/DALI

Which video decoding speed should I expect from DALI?

Open
#4,498 20 comments 0 reactions 1 assignee View on GitHub

@szalpal is already working on this.

Since Dec 9, 2022.

enhancement help wanted perf PyTorch Lightning Video
Dominant language
C++
Stars
5.8k
Forks
678
Avg merge
3d 1h
Merged PRs (30d)
27

Description

Hi, I did few simple experiments and I had the feeling that I am getting a lower frame rate than expected. Can you help me understanding if I am doing things properly? Here some info:

  • Docker image built on top of nvcr.io/nvidia/pytorch:22.11-py3 (hence nvidia-dali-cuda110==1.18.0)
  • GPU Tesla V100-SXM2
  • Video specs: 1920x1080@30fps, yuv420p, libx264, ~1.5Mbps (created with ffmpeg -i .... output.mp4 with default settings)

This is the code I am running:

import time
from pathlib import Path
from typing import Union

import nvidia.dali.fn as fn
from nvidia.dali import pipeline_def
from nvidia.dali.plugin.pytorch import DALIGenericIterator
from nvidia.dali.tensors import TensorListGPU
from tqdm import tqdm


def profile_dali_video_reader(profile_video_path: Union[Path, str]) -> None:
    @pipeline_def
    def video_pipeline(
        video_path: str,
        sequence_length: int = 1,
        step: int = -1,
    ) -> TensorListGPU:
        frames = fn.readers.video(
            name="reader",
            filenames=f"{video_path}",
            sequence_length=sequence_length,
            step=step,
            initial_fill=16,
            device="gpu",
        )
        return frames

    iterator = DALIGenericIterator(
        [
            video_pipeline(
                video_path=profile_video_path, batch_size=4, device_id=0, num_threads=1
            )
        ],
        ["frames"],
        reader_name="reader",
    )

    t_start = time.monotonic()
    for _ in tqdm(iterator):
        pass
    t_end = time.monotonic()
    print(f"Total time: {t_end - t_start:.2f}sec ({1000 / (t_end - t_start):.2f}FPS)")


if __name__ == "__main__":
    profile_dali_video_reader("tests/files/1000frames1080p.mp4")

Output is:

Total time: 203.96sec (4.90FPS)

Is it reasonable? Am I doing something wrong?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.