Giter VIP home page Giter VIP logo

Comments (4)

JanuszL avatar JanuszL commented on May 30, 2024 1

Hi @wangdada-love,

Thank you for reaching out. If you want to add images with weights please just:

imge3 = img1 * weight1 + img2 * weight2

from dali.

wangdada-love avatar wangdada-love commented on May 30, 2024 1

Thanks for your reply.
I have tried this method before, But I received an error message as follows:

RuntimeError: Critical error in pipeline:
Error when executing GPU operator conditional__Merge, instance name: "__Merge_29", encountered:
[/opt/dali/dali/pipeline/operator/builtin/conditional/merge.cc:45] Assert on "base_input.type() == input.type()" failed: Divergent data found in different branches of conditional operation. All paths in conditional operation are merged into one batch which must have consistent type, number of dimensions, layout and other metadata. Found distinct types: float and uint8.

I just tried again, but got the same error message. Based on the error message, I speculate that the problem is caused by an incorrect data type. So, I made the following modifications to the code:

def rand_sharp(images, scale=1.0, window_size=3, device="gpu"):
    sharp = fn.laplacian(images, scale=scale, window_size=window_size, device=device)
    sharp = fn.cast(sharp, dtype=dali.types.DALIDataType.FLOAT)
    images = fn.cast(images, dtype=dali.types.DALIDataType.FLOAT)
    out = 0.7 * images + 0.3 * sharp
    out = fn.cast(out, dtype=dali.types.DALIDataType.UINT8)
    return out

it works.

from dali.

JanuszL avatar JanuszL commented on May 30, 2024 1

Hi @wangdada-love,

I'm happy you made that work. The issue is that out = 0.7 * images + 0.3 * sharp returns float type while the other branch of your if condition returns just int8, so in your context just

def rand_sharp(images, scale=1.0, window_size=3, device="gpu"):
    sharp = fn.laplacian(images, scale=scale, window_size=window_size, device=device)
    out = 0.7 * images + 0.3 * sharp
    out = fn.cast(out, dtype=dali.types.DALIDataType.UINT8)
    return out

should do as well.

from dali.

wangdada-love avatar wangdada-love commented on May 30, 2024

outstanding! thank you very much.

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.