PyTorch LightningVideoenhancementhelp wantedperf
Repository-Metriken
- Stars
- (5.722 Stars)
- PR-Merge-Metriken
- (PR-Metriken ausstehend)
Beschreibung
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(hencenvidia-dali-cuda110==1.18.0) - GPU Tesla V100-SXM2
- Video specs: 1920x1080@30fps, yuv420p, libx264, ~1.5Mbps (created with
ffmpeg -i .... output.mp4with 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?