Giter VIP home page Giter VIP logo

Comments (7)

Tpcsy avatar Tpcsy commented on May 30, 2024 1

Thank you very much for your response. I have successfully resolved my issue. I will close this matter now and once again thank you for your advice.

from dali.

JanuszL avatar JanuszL commented on May 30, 2024

Hi @Tpcsy,

Thank you for reaching out.
Can you try:

             b=np.frombuffer(f.read(), dtype=np.uint8)
             # print(b)
             batch.append(b)
         return [batch] 

As the documentation states:

Depending on the value of num_outputs, the source can supply one or more data items. The data item can be a whole batch (default) or a single batch entry (when batch==False). If num_outputs is not set, the source is expected to return one item (a batch or a sample). If this value is specified (even if its value is 1), the data is expected to a be tuple, or list, where each element corresponds to respective return value of the external_source.

from dali.

Tpcsy avatar Tpcsy commented on May 30, 2024

from dali.

Tpcsy avatar Tpcsy commented on May 30, 2024

Hi @JanuszL
Thank you very much for your reply.
I tried the changes you suggested, and it resulted in the following error:
RuntimeError: [/opt/dali/dali/pipeline/data/tensor_list.cc:1012] Assert on "IsDenseTensor()" failed: The batch must be representable as a tensor - it must have uniform shape and be allocated in contiguous memory.
I'm not sure if this is related to the different sizes of my audio files.

from dali.

JanuszL avatar JanuszL commented on May 30, 2024

Hi @Tpcsy,

I'm not sure if this is related to the different sizes of my audio files.

DALI expects (similarly to Torch data processing) samples to have uniform shapes in the batch. What you can do is to either trim/pad them or use 'DALIRaggedIterator' that will allow you to return nonuniform batch as a set of Torch tensors.

from dali.

Tpcsy avatar Tpcsy commented on May 30, 2024

Thank you very much for your suggestion. I tried the DALIRaggedIterator as you mentioned and successfully retrieved a batch of data. Now, I want to perform cropping operations on my tensors in the pipeline. Due to the nature of my task, each audio clip needs a different cropping position, and I need to return string-type data from an external source to guide the cropping operation on my audio tensors. However, I couldn't find a method in the pipeline that can accept and use string data. Can you please advise me on how to proceed? Thanks again for your help.

from dali.

JanuszL avatar JanuszL commented on May 30, 2024

I need to return string-type data from an external source to guide the cropping operation on my audio tensors

I'm not sure if I understand your idea correctly.
What you should do is to return the start and size of the cropping window and use the slice operator.

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.