Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Help with pretrained model

Discussion in 'Barracuda' started by Archi_16, Aug 12, 2021.

  1. Archi_16

    Archi_16

    Joined:
    Apr 7, 2017
    Posts:
    87
    Hello. Im just started lwarning ML and have small question.

    I have trained model, for now it is in h5 format. The model input is image, output is some numbers.

    Question 1. Is it actually possible to run this type of model? Will i be able to give value and get value from model.
    Question 2. Which format Unity need to run the model (pb, onnx, bytes,...)
    Question 3. I should use barracuda right, instead of ml agents?

    Any sources will be good.
    Thanks.
     
  2. amirebrahimi_unity

    amirebrahimi_unity

    Joined:
    Aug 12, 2015
    Posts:
    400
    Q1. Depends on the model and what operators are used, but potentially yes.
    Q2. Using Barracuda in Unity you will need to generate an .onnx file.
    Q3. Yes.

    Take a look at https://github.com/onnx/tensorflow-onnx for converting your model to onnx format.
     
  3. Archi_16

    Archi_16

    Joined:
    Apr 7, 2017
    Posts:
    87
    Thanks you. i have succeeded.
     
  4. alexandreribard_unity

    alexandreribard_unity

    Unity Technologies

    Joined:
    Sep 18, 2019
    Posts:
    53
    Awesome! Did you get it to run in Unity?
     
  5. Archi_16

    Archi_16

    Joined:
    Apr 7, 2017
    Posts:
    87
    yeap. it works perfectly.
    Except for one thing. the worker type set to Auto crashes on my phone with the snapdragon video card.
    So I changed to Csharp, and now it works. Didn't test the other 5 types.
     
  6. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    Out of curiosity, what is your phone model?
     
  7. alexandreribard_unity

    alexandreribard_unity

    Unity Technologies

    Joined:
    Sep 18, 2019
    Posts:
    53
    Can you also share the onnx file? That way we can investigate on our end
     
  8. Archi_16

    Archi_16

    Joined:
    Apr 7, 2017
    Posts:
    87
  9. amirebrahimi_unity

    amirebrahimi_unity

    Joined:
    Aug 12, 2015
    Posts:
    400
    Okay, well, if you are able to reproduce the crash with a smaller version of the network that doesn't reveal the full architecture or just the part that you think is causing the crash, then we can take a look at it.