getnamo / TensorFlow-Unreal-Examples

Drag and drop Unreal Engine TensorFlow examples repository.
MIT License
218 stars 44 forks source link

First Release #3

Closed getnamo closed 6 years ago

getnamo commented 7 years ago

Todo:

Current focus: cleanup and fixes

getnamo commented 7 years ago

threads possible with https://github.com/getnamo/UnrealEnginePython#threading-experimental and _thread but its currently breaks our encapsulation loading.

They also only are able to run tensorflow once, the graph seems to get corrupted or nil referenced otherwise.

Performance however is excellent and shows great promise of being able to train networks while in play.

getnamo commented 7 years ago

Log wrapping possible using e.g.

class Logwrapper(object):
    def __init__(self):
        self.terminal = sys.stdout

    def write(self, message):
        ue.log(message)

    def flush(self):
        ue.log("")

and

sys.stdout = Logwrapper()
sys.stderr = Logwrapper()
getnamo commented 7 years ago

pip install from python on background thread appears to be working, need to add pip dependency json file to plugins and auto-resolve on editor start, or add a command/button to resolve dependencies

getnamo commented 7 years ago

pip auto dependency resolution works. Plugins now simply call e.g.

FUnrealEnginePythonModule::Get().AddPythonDependentPlugin("TensorFlow");

In their StartupModule() to both add their Content/Scripts to the python system path and auto resolves the upymodule.json found in that folder

Tensorflow example upymodule.json:

{
    "name" : "tensorflow-ue4",
    "pythonModules": {
        "tensorflow": "0.12.1"
    }
}
getnamo commented 7 years ago

callback api works now with

ue.run_on_gt(function, <optional>args)

which schedules a callback to come back on the game thread. Also added convenience threading functions through upythread.py

import upythread as ut
ut.run_on_bt(function, <optional>callback)

which wraps threading->thread into a one function fire and forget.

getnamo commented 7 years ago

with TF 1.0.0 release, it is time to link up the API to the blueprint layer (basic for now, later: fine control BP).

getnamo commented 7 years ago

TensorFlowComponent is now fully encapsulated with very basic API:

Variables: -TensorFlowModule (name of your python script module with train and runJsonInput) -Multithreaded Training toggle -Verbose log toggle -Train on begin play toggle

Functions: -Train -TensorInput

Callback Events: -OnTraining Complete -OnResults

Test another TF model with this setup and push first release.

Critically we will need a way to save/load the model before non-proof of concept scripts should be tested.

getnamo commented 7 years ago

drag and drop isn't working as expected yet, a bit more work required.

getnamo commented 7 years ago

https://github.com/getnamo/tensorflow-ue4/releases/tag/0.1.2-pre seems to be a working drag and drop release, cleanup first mnist example and release them as a package along with early documentation

getnamo commented 7 years ago

Two more issues should be fixed before closing this issue: -https://github.com/getnamo/tensorflow-ue4-examples/issues/7 -https://github.com/getnamo/tensorflow-ue4-examples/issues/8

getnamo commented 7 years ago

Need to wrap up documentation. TF basics -> beginner mnist in a video.

getnamo commented 6 years ago

Released. Videos will come when qlearning example is ready.