For the past couple of months I’ve been working on bringing TensorFlow to UE4, enabling the use of state of the art machine learning in our projects. The plugin has reached something I think is ready to try out, but it is very much a work in progress so please check it out and give some feedback if you can!
Resources
Latest documentation is always available at the github repositories.
Plugin
Examples Project
Examples - Mnist
Made a simple mnist recognition example.
Basic MNIST softmax classifier trained on begin play with sample training inputs streamed to the editor during training. When fully trained, UTexture2D (1-3) samples are tested for prediction.
you can even use your browser on your phone or desktop to draw some shapes to try recognition
Examples - Basic adding in TensorFlow
Want just the basics? check out the basic.umap map which uses addExample.py to add float array together. This is a good entry point to see how to pass UE4 blueprint data into and out of python tensorflow.
There are certain really cool projects that use TF that I’d love to be able to integrate into a game, e.g., Google’s NLP parser SyntaxNet.
Training a net to differentiate a person stepping vs just leaning in VR would also be really cool (though there’s a nice asset for doing this already on the marketplace VR Footstep Plugin), and allow people to use full body avatars in VR without having to have extra trackers other than hands and head.
First of all, thank you very much @getnamo for your tremendous amount of work you’re giving away basically for free (the couple of bucks on the marketplace are merely symbolic in this regard). I’ve started to play with Reinforcement Learning and tensorflow using Unity and the Learning Agents preview they provide, but now have switched to Unreal because of - well, many reasons.
So already working with tensorflow, I was and still am excited that the Unreal environment also has integration already. Big thanks again for making this possible!
I also was used to having tensorboard for better understanding what is going on with my learning agent. I’ve tried for a day now to get tensorboard running (writing out logs with the simple MNIST example from Beginnen Sie mit TensorBoard | TensorFlow worked flawlessly), but I’m totally lost now, also because I’m just beginning writing python code, coming from a C++ and C# background. Have you tested running tensorboard already and could kindly give some guideline or tips how to make it work?
Now that you say it, this absolutely makes sense. I tried to run tensorboard from inside UE, the idea that I easily could run it from a standalone python console as well on the logs didn’t come to my mind at that time. Thanks for the enlightenment.
I’ll experiment with the inbuilt chromium browser first. I wanted to adopt the workflow and setup Unity uses (external python distro via Anaconda) anyways since they have some nice goodies in their SDK like curiosity reinforced learning, circulum learning, imitation learning etc, and I’ll certainly contribute it to your repo as soon as it’s stable.
Do you prefer pull requests from a branch, a fork or another way?
Have you released the pong game yet? I’m currently developing a simple 2d game with a stick that tries to avoid enemies that are moving in the environment by pulling up/down the stick.
This is incredibly cool coding ! Can one use ue4 node editor as general c++ visual coding platform, by following this gourgeous implementation ? Is it basically about linking dll functions to the blueprint nodes ?
The unreal side for communicating data is typically done in blueprint (node editor) via a *TensorflowComponent *and the machine learning is done in python (which is what tensorflow uses so you can copy paste examples).