Giter VIP home page Giter VIP logo

Comments (1)

JanuszL avatar JanuszL commented on May 31, 2024

Hi @Tomsen1410,

Can you provide a standalone and selfcontained repro? Something like this works for me:

docker run --rm -ti --gpus 'all,"capabilities=compute,utility,video"' ubuntu:22.04

apt update && apt install -y vim wget python3-pip
pip install --extra-index-url https://pypi.nvidia.com/ --upgrade nvidia-dali-cuda120 torch numpy
wget https://github.com/NVIDIA/DALI_extra/raw/main/db/video/sintel/sintel_trailer-720p.mp4
python3 test.py

import nvidia.dali.fn as fn
from nvidia.dali import pipeline_def
from nvidia.dali.plugin.pytorch import DALIRaggedIterator, LastBatchPolicy

files = ["sintel_trailer-720p.mp4"]
batch_size = 3
device = "gpu"
device_id = 0
n_threads = 4

@pipeline_def
def read_decode_pipe(filenames, device="cpu"):
    video = fn.readers.video(
        sequence_length=3, filenames=filenames, pad_sequences=True, device=device
    )
    source_info = fn.get_property(video, key="source_info")
    return video, source_info


pipe = read_decode_pipe(
    files,
    batch_size=batch_size,
    device=device,
    device_id=device_id,
    num_threads=n_threads,
)
pipe.build()
it = DALIRaggedIterator(
    pipe,
    output_map=["snippets", "paths"],
    output_types=[DALIRaggedIterator.SPARSE_LIST_TAG, DALIRaggedIterator.SPARSE_LIST_TAG],
    auto_reset=False,
    last_batch_policy=LastBatchPolicy.PARTIAL,
)

for data in it:
    snippets = data[0]["snippets"]
    bytes_paths = data[0]["paths"]  # <--- might not yet be filled with data
    str_paths = [path.cpu().numpy().tobytes().decode() for path in bytes_paths]
    print(str_paths)

from dali.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.