Home > Enterprise >  How to use a python made and trained machine learning model in unity to predict something?
How to use a python made and trained machine learning model in unity to predict something?

Time:12-30

I have trained a machine learning model with images and was wondering if it is possible to use it in unity as an app. The goal is to use the camera of an android and use the picture as input for the model to predict something via app. My problem is I have no idea how to "import" it to unity or if it is even possible to do so. The model was made in Python with tensor flow. I've searched around and found somethings about Ml-agents in unity or ways to train your unity agents in Python but nothing seemed to address my problem. I need to use the model in unity and in the smartphone without a need to install python separately. Thank you in advance.

CodePudding user response:

It seems the internet has plenty of answers for you.
You can use TensorFlow.NET which implements all the needed functionality for training but can be used for testing and predicting just as well. There is even a load pre trained model and predict section in the official documentation!
There is also indeed Unity ML Agents which is still experimental but there is a code example.

If it is just a POC you can also get creative and setup a server which receives your images, runs the model, and return the results.

  • Related