getnamo / TensorFlow-Unreal

TensorFlow plugin for the Unreal Engine.
Other
1.15k stars 211 forks source link

Do I need tensorflow to run this? #6

Closed tcmxx closed 7 years ago

tcmxx commented 7 years ago

Hello,

This plugin looks like what I am looking for! I am new to both tensorflow and unreal, so just wanna as some questions: Do I need tensorflow installed to run this plugin? Also how are the tensorflow libraries linked to this plugin?

Thank yo very much!

getnamo commented 7 years ago

As you're a beginner to tensorflow, I recommend you follow https://www.tensorflow.org/get_started/ first to get familiar with how tensorflow is used in python. This plugin uses python to do the machine learning bits and focuses on providing BP<->Python communication so you can send UE4 data types as machine learning inputs and receive results back as blueprint events all mediated using JSON.

In terms of setup and documentation, this repository's readme always has the latest up to date documentation. e.g. https://github.com/getnamo/tensorflow-ue4#installation--setup

A quick rundown of setup: just drag and drop the plugin to your project. On the first run the plugin will use python pip to pull tensorflow (cpu or gpu version depending on what you have set in https://github.com/getnamo/tensorflow-ue4/blob/master/Content/Scripts/upymodule.json). This may take a while so I recommend just waiting a few minutes, when it is done it will show up in your editor output log.

Once that's done you're good to go, if it gives you errors saying tensorflow is missing, just restart the editor and it should work.

Note if you're using gpu (NVIDIA cuda) you will need to have the pre-requisites installed: https://www.tensorflow.org/install/install_windows.

In terms of how it's linked to tensorflow, the plugin uses a fork (https://github.com/getnamo/UnrealEnginePython) of https://github.com/20tab/UnrealEnginePython to include an embedded python interpreter. You can then use blueprint/c++ to communicate with python scripts you write to train or run tensorflow networks. The https://github.com/getnamo/tensorflow-ue4-examples contains early examples of MNIST classification training and evaluation using UTexture2D (unreal textures) format.

I refer you back to https://github.com/getnamo/tensorflow-ue4 for up to date documentation on how to use the plugin. Please be aware that this plugin is in early stages and while it should be functional, it may have features missing.

tcmxx commented 7 years ago

Hello,

Thank you very much for your answer! It is way more than I asked. Thanks!

I have been used tensorflow for a little while , and are currently trying to embed deep learning training/evaluation into games. This plugin is really helpful while unity 2017 is not so stable with tensorflowsharp yet.

My question before is answered by knowing that this plugin will pull tensorflow the first run, and python scripts are called by UnrealEnginePython. I was asking because I need to know whether the user can run the standalone game without those dependencies on PC.

Anyway, this is a really good plugin, and thanks for your contribution!

getnamo commented 7 years ago

I haven't tested packaging yet so it won't work out of the box, but I see no major issue with dragging your python binary folder with site packages into the final packaged project at the appropriate place and for the plugin to work as expected.

There are also potential ways to include cuda dependencies in your release project so that your end user has 0 dependencies to install outside of your project, but it's a bit too early in development to add that release burden for the repo.

If you try the plugin, please let me know how the workflow works for you, it's early development and any feedback would be quite helpful.