Code Monkey home page Code Monkey logo

Comments (3)

mohamadmansourX avatar mohamadmansourX commented on August 25, 2024 1

Done!!
I solved it by converting the array to double then float rather than 1e-6. Not sure why 1e-6 was mapped to double no matter what I do.
My solution:

@torch.jit.script
def rescoring_mask(scores, mask_pred, masks):
    mask_pred_ = mask_pred.float()
    factrr = mask_pred_.sum([1, 2]).double()
    factrr = factrr + 1e-6
    return scores * ((masks * mask_pred_).sum([1, 2]) / factrr.float())

from sparseinst_tensorrt.

leandro-svg avatar leandro-svg commented on August 25, 2024

Dear @mohamadmansourX, thank you for saying that 😉
Would you mind sharing your ONNX file with me? Such that I can check it out on netron with the verbose output.

On my ONNX, the last Add node I have a the Add_319 which is link to the "rescoring_mask" definition in the sparseinst.py, called line 229. If it is the case, you should be able to change line 21 which define mask_pred_ as a float that could possibily be converted to double.
Let's see from where your Add_398 comes from ...

from sparseinst_tensorrt.

mohamadmansourX avatar mohamadmansourX commented on August 25, 2024

Hello, thank you for your reply.
Yeah as you mentioned, after debugging with netron, the issue is in this line:

return scores * ((masks * mask_pred_).sum([1, 2]) / (mask_pred_.sum([1, 2]) + 1e-6))

Adding the terms mask_pred_.sum([1, 2]) and 1e-6 is causing that issue.
Tried changing 1e-6 to torch.tensor(1e-6).float() but for some reason it's still being interpreted as a tensor(double)!

from sparseinst_tensorrt.

Related Issues (3)

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.