Coder Social home page Coder Social logo

tensorflow-unreal's Introduction

TensorFlow Unreal Plugin

GitHub release Github All Releases

badge

Unreal Engine plugin for TensorFlow. Enables training and implementing state of the art machine learning algorithms for your unreal projects.

This plugin contains C++, Blueprint and python scripts that encapsulate TensorFlow operations as an Actor Component. It depends on an UnrealEnginePython plugin fork and the SocketIO Client plugin; these are always included in binary releases so no manual external downloading is necessary. See Note on Dependencies section for details on implementation and architecture.

See unreal forum thread for discussions.

Discord Server

Issues and Limitations

There is currently only a working build for the Windows platform. Be careful where you place your project as you may hit 240 char filepath limit with your python dependencies.

Near future refactor to open up dev environments and native support (WIP): #53

Tensorflow UnrealEnginePython Platform Issues

If you have ideas or fixes, consider contributing! See https://github.com/getnamo/TensorFlow-Unreal/issues for current issues.

Installation & Setup

  1. (GPU only) Install CUDA and cudNN pre-requisites if you're using compatible GPUs (NVIDIA)
  2. Download Latest Release choose CPU or GPU download version if supported.
  3. Create new or choose project.
  4. Browse to your project folder (typically found at Documents/Unreal Project/{Your Project Root})

copy plugins

  1. Copy Plugins folder into your Project root.
  2. Launch your project.
  3. (Optional) All plugins should be enabled by default, you can confirm via Edit->Plugins. Scroll down to Project and you should see three plugins, TensorFlow in Computing, Socket.IO Client in Networking and UnrealEnginePython in Scripting Languages. Click Enabled if any is disabled and restart the Editor and open your project again.
  4. Wait for tensorflow dependencies to be automatically installed. It will auto-resolve any dependencies listed in Content/Scripts/upymodule.json using pip. Note that this step may take a few minutes and depends on your internet connection speed and you will see nothing in the output log window until it has fully completed.

image

  1. Once you see an output similar to this (specific packages will change with each version of tensorflow), the plugin is ready to use.

Note on Git Cloning

Using full plugin binary releases is recommended, this allows you to follow the installation instructions as written and get up to speed quickly.

If you instead wish to git clone and sync to master repository manually then it is expected that you download the latest python binary dependency release for UnrealEnginePython. This contains an embedded python build; select the BinariesOnly-.7z file from Downloads and drag the plugins folder into your project root. With that step complete, your clone repository should work as expected, all other dependencies will be pulled via pip on first launch.

Examples

mnist spawn samples

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.

An example project is found at https://github.com/getnamo/TensorFlow-Unreal-examples.

The repository has basic examples for general tensorflow control and different mnist classification examples with UE4 UTexture2D input for prediction. The repository should expand as more plug and play examples are made. Consider contributing samples via pull requests!

It is also the main repository where all development is tracked for all dependencies for this plugin.

Python API

You can either train directly or use a trained model inside UE4.

To start, add your python script file to {Project Root Folder}/Content/Scripts.

wrap your tensorflow python code by subclassing TFPluginAPI.

MySubClass(TFPluginAPI)

import tensorflow, unreal_engine and TFPluginAPI in your module file and subclass the TFPluginAPI class with the following functions.

import tensorflow as tf
import unreal_engine as ue
from TFPluginAPI import TFPluginAPI

class ExampleAPI(TFPluginAPI):

	#expected optional api: setup your model for training
	def onSetup(self):
		pass
		
	#expected optional api: parse input object and return a result object, which will be converted to json for UE4
	def onJsonInput(self, jsonInput):
		result = {}
		return result

	#expected optional api: start training your network
	def onBeginTraining(self):
		pass
    
#NOTE: this is a module function, not a class function. Change your CLASSNAME to reflect your class
#required function to get our api
def getApi():
	#return CLASSNAME.getInstance()
	return ExampleAPI.getInstance()

Note the getApi() module function which needs to return a matching instance of your defined class. The rest of the functionality depends on what API you wish to use for your use case. At the moment the plugin supports input/output from UE4 via JSON encoding.

If you wish to train in UE4, implement your logic in onBeginTraining() and ensure you check for self.shouldStop after each batch/epoch to handle early exit requests from the user e.g. when you EndPlay or manually call StopTraining on the tensorflow component. You will also receive an optional onStopTraining callback when the user stops your training session.

If you have a trained model, simply setup your model/load it from disk and omit the training function, and forward your evaluation/input via the onJsonInput(jsonArgs) callback. See mnistSaveLoad.py example on how to train a network once, and then save the model, reloading it on setup such that you skip retraining it every time.

Note that both onBeginTraining() and onSetup() are called asynchronously by default. If you use a high level library like e.g. keras, may need to store your tf.Session and tf.Graph separately and use it as default with self.session.as_default(): and with self.graph.as_default(): to evaluate, since all calls will be generally done in separate threads.

Below is a very basic example of using tensorflow to add or subtract values passed in as {"a":<float number or array>, "b":<float number or array>}.

import tensorflow as tf
import unreal_engine as ue
from TFPluginAPI import TFPluginAPI

class ExampleAPI(TFPluginAPI):

	#expected optional api: setup your model for training
	def onSetup(self):
		self.sess = tf.InteractiveSession()

		self.a = tf.placeholder(tf.float32)
		self.b = tf.placeholder(tf.float32)

		#operation
		self.c = self.a + self.b
		pass
		
	#expected optional api: json input as a python object, get a and b values as a feed_dict
	def onJsonInput(self, jsonInput):
		
		#show our input in the log
		print(jsonInput)

		#map our passed values to our input placeholders
		feed_dict = {self.a: jsonInput['a'], self.b: jsonInput['b']}

		#run the calculation and obtain a result
		rawResult = self.sess.run(self.c,feed_dict)
		
		#convert to array and embed the answer as 'c' field in a python object
		return {'c':rawResult.tolist()}

	#custom function to change the operation type
	def changeOperation(self, type):
		if(type == '+'):
			self.c = self.a + self.b

		elif(type == '-'):
			self.c = self.a - self.b


	#expected optional api: We don't do any training in this example
	def onBeginTraining(self):
		pass
    
#NOTE: this is a module function, not a class function. Change your CLASSNAME to reflect your class
#required function to get our api
def getApi():
	#return CLASSNAME.getInstance()
	return ExampleAPI.getInstance()

A full example using mnist can be seen here: https://github.com/getnamo/TensorFlow-Unreal-examples/blob/master/Content/Scripts/mnistSimple.py

A full example using save/load setup can be seen here: https://github.com/getnamo/TensorFlow-Unreal-examples/blob/master/Content/Scripts/mnistSaveLoad.py

Another full example using keras api can be found here: https://github.com/getnamo/TensorFlow-Unreal-examples/blob/master/Content/Scripts/mnistKerasCNN.py. Note the keras callback used for stopping training after current batch completes, this cancels training on early gameplay exit e.g. EndPlay.

Asynchronous Events to Tensorflow Component

If you need to stream some data to blueprint e.g. during training you can use the self.callEvent() api.

String Format

The format is self.callEvent('EventName', 'MyString')

Json Format

The format is self.callEvent('EventName', PythonObject, True)

Example use case in mnistSpawnSamples.py where sample training images are emitted to unreal for preview.

Blueprint API

Load your python module from your TensorflowComponent

Once you've written your python module, Select your TensorflowComponent inside your actor blueprint

select component

and change the TensorFlowModule name to reflect your filename without .py. e.g. if my python file is ExampleAPI.py it would look like this

change module name

Optionally disable the verbose python log and change other toggles such as training on BeginPlay or disabling multithreading (not recommended).

Training

By default the onBeginTraining() function will get called on the component's begin play call. You can optionally untick this option and call Begin Training manually.

manual train

Sending Json inputs to your model for e.g. prediction

You control what type of data you forward to your python module and the only limitation for the current api is that it should be JSON formatted.

Basic Json String

In the simplest case you can send e.g. a basic json string {"MyString","SomeValue"} constructed using SIOJson like so

send json string

Any UStruct Example

SIOJson supports completely user defined structs, even ones only defined in blueprint. It's highly recommended to use such structs for a convenient way to organize your data and to reliably decode it on the python side. Below is an example where we send a custom bp struct and encode it straight to JSON.

send custom struct

with the struct defined in blueprint as

custom struct definition

You can also interweave structs, even common unreal types so feel free to mix and match both of the above methods. In this particular example we interweave a 3D vector in a json object we defined. The sent input should now be {"SomeVector":{"x":1.0,"y":2.3,"z":4.3}}

send struct

Special convenience case: UTexture2D

A convenience function wraps a UTexture2D into a json object with {"pixels":[<1D array of pixels>], "size":{"x":<image width>,:"y":<image height>}} which you can reshape using numpy.

send texture

Note that this currently will convert an image into full alpha greyscale. If you need color texture inputs, use own custom method or make a pull request.

Custom functions

If you need to call python functions from blueprint which the current api doesn't support, you can do so by using the CallCustomFunction method on the TensorflowComponent. You specify the function name and pass in a string as arguments. The function runs on the game thread and will return immediately with an expected string value. For both arguments and returning values, JSON encoding is recommended, but optional.

custom function call

Example custom function call passing in a string argument to changeOperation in addExample.py

Handling Tensorflow Events

Select your Tensorflow Component from your actor blueprint and then click + to subscribe to the chosen event in the event graph.

events

current api supports the following events

On Input Results

Called when onJsonInput() completes in your python module. The returned data is a json string of the return data you pass at the end of the function.

onresults

Normally you'd want to convert this string into SIOJsonObject so you can use your results data in blueprint. It is also typical to have a prediction field attached to this object for e.g. classification tasks.

If you have a regular return format, consider making your own custom bp struct and fill its value from the json string like this

fill struct from json

Note that the function will only fill fields that have matching names and ignore all other struct fields. This means you can safely fill a partial struct from a json string that has more fields than the struct defines.

On Training Complete

When the onBeginTraining() call is complete you receive this event with {'elapsed':<time taken>} json, optionally with additional return data passed in from your function.

ontraining

On Event

If you use self.callEvent() you will receive this event dispatch. You can filter your event types by the event name and then do whatever you need to with the data passed in.

onevent

For example mnistSpawnSamples.py uses self.callEvent() to async stream training images and we'd filter this via checking for 'PixelEvent'

Blueprint Utilities

Conversion

A large portion of the plugin capability comes from its ability to convert data types. See TensorflowBlueprintLibrary.h for full declarations and code comments.

UTexture2D to float array (grayscale)

Convert a UTexture2D as grayscale to a 1D float array; obtains size from texture.

Blueprint

ToGrayScaleFloatArray (Texture2D)

C++

static TArray<float> Conv_GreyScaleTexture2DToFloatArray(UTexture2D* InTexture);

UTexture2D to float array

Convert a UTexture2D to a 1D float array; obtains size from texture. Expects 4 1-byte values per pixel e.g. RGBA.

Blueprint

ToFloatArray (Texture2D)

C++

static TArray<float> Conv_Texture2DToFloatArray(UTexture2D* InTexture);

Invert Float Array

Invert values in a given float array (1->0, 0->1) on a 0-1 scale.

Blueprint

InvertFloatArray

C++

static TArray<float> InvertFloatArray(const TArray<float>& InFloatArray);

Float array to UTexture2D

Convert a 4 value per pixel float array to a UTexture2D with specified size, if size is unknown (0,0), it will assume a square array.

Blueprint

ToTexture2D (Float Array)

C++

static UTexture2D* Conv_FloatArrayToTexture2D(const TArray<float>& InFloatArray, const FVector2D Size = FVector2D(0,0));

Float array (Grayscale) to UTexture2D

Convert a 1 value per pixel float array to a UTexture2D with specified size, if size is unknown (0,0), it will assume a square array.

Blueprint

ToTexture2D (Grayscale Array)

C++

static UTexture2D* Conv_FloatArrayToTexture2D(const TArray<float>& InFloatArray, const FVector2D Size = FVector2D(0,0));

ToTexture2D (Render Target 2D)

Convert a UTextureRenderTarget2D to a UTexture2D

Blueprint

ToTexture2D (Render Target 2D)

C++

static UTexture2D* Conv_RenderTargetTextureToTexture2D(UTextureRenderTarget2D* InTexture);

ToFloatArray (bytes)

Convert a byte array into a float array, normalized by the passed in scale

Blueprint

ToFloatArray (bytes)

C++

static TArray<float> Conv_ByteToFloatArray(const TArray<uint8>& InByteArray, float Scale = 1.f);

TF Audio Capture Component

A c++ component that uses windows api to capture and stream microphone audio without the need of an online subsystem. See https://github.com/getnamo/TensorFlow-Unreal/blob/master/Source/TFAudioCapture/Public/TFAudioCaptureComponent.h for details on API.

This component is aimed to be used for native speech recognition when Tensorflow examples mature.

File Utility Component

A simple blueprint wrapper to save and load bytes from file. Allows to easily flush e.g. audio capture for later use. See https://github.com/getnamo/TensorFlow-Unreal/blob/master/Source/CoreUtility/Public/FileUtilityComponent.h for details on API.

Use pip to manage your dependencies in the python console

The plugin uses a pip wrapper script that uses a subproccess to not cause blocking behavior. Simply import it using

import upypip as pip

in your script and then type e.g.

pip.list() which should very shortly list all your installed python modules.

Package        Version  
-------------- ---------
absl-py        0.1.10   
astor          0.6.2    
bleach         1.5.0    
gast           0.2.0    
grpcio         1.10.0   
html5lib       0.9999999
Markdown       2.6.11   
numpy          1.14.1   
pip            9.0.1    
protobuf       3.5.1    
setuptools     38.5.1   
six            1.11.0   
tensorboard    1.6.0    
tensorflow     1.6.0    
tensorflow-gpu 1.6.0    
termcolor      1.1.0    
Werkzeug       0.14.1   
wheel          0.30.0   

If you'd like to add another module call the install function e.g. if you wanted to upgrade to gpu version you could simply type

pip.install('tensorflow-gpu')

or you can go back to a clean slate with

pip.uninstallAll()

which should leave you with just the basics

Package    Version
---------- -------
pip        9.0.1  
setuptools 38.5.1 
wheel      0.30.0 

See upypip.py for all the available commands.

Note on Dependencies

Depends on an UnrealEnginePython plugin fork and the SocketIO Client plugin. Both of these and an embedded python build are included in every release so you don't need to manually include anything, just drag and drop the Plugins folder into your project from any release.

Architecture and Purpose

architecture

UnrealEnginePython

Based on the wonderful work by 20tab, the UnrealEnginePython plugin fork contains changes to enable multi-threading, python script plugin encapsulation and automatic dependency resolution via pip. Simply specifying tensorflow as a pythonModule dependency in https://github.com/getnamo/TensorFlow-Unreal/blob/master/Content/Scripts/upymodule.json makes the editor auto-resolve the dependency on first run. The multi-threading support contains a callback system allowing long duration operations to happen on a background thread (e.g. training) and then receiving callbacks on your game-thread. This enables TensorFlow to work without noticeably impacting the game thread.

SocketIO Client

SocketIO Client is used for easy conversion between native engine types (BP or C++ structs and variables) and python objects via JSON. Can optionally be used to connect to a real-time web service via socket.io.

Packaging

Note on Blueprint Only projects

You will need to convert your blueprint only project to mixed (bp and C++) before packaging. Follow these instructions to do that: https://allarsblog.com/2015/11/04/converting-bp-project-to-cpp/

Extra step

Since v0.10.0 the plugin should package correctly, but will require to run the packaged build once to pull the dependencies. You can optionally manually copy them from {Project Root}/Plugins/UnrealEnginePython/Binaries/Win64/Lib/site-packages to the packaged folder to {Packaged Root}/{Project Name}/Plugins/UnrealEnginePython/Binaries/Win64/Lib/site-packages.

When you first launch your packaged project there may be a black screen for a while (2min) as it reinstalls pip and pulls the dependencies for the first time. You can then reload the map after a few minutes or just restart (check your packaged log to see when it's ready). Each time after that the project should load quickly. Note that you can zip up and move the packaged project to another computer with all the dependencies, but it will have ~20sec boot up on first run as it re-installs pip to the correct location, but it won't have to pull the pip dependencies saving most of the waiting and then quick bootup each time after that.

Troubleshooting / Help

I see pip errors from upgrading tensorflow version

Delete Plugins\UnrealEnginePython\Binaries\Win64\Lib\site-packages and restart project

No module named 'tensorflow'

On first run you may see this message in your python console

no tensorflow

Wait until pip installs your dependencies fully, this may take ~3-5min. When the dependencies have installed, it should look something like this

installed

After you see this, go ahead and close your editor and re-launch the project. When the project has launched again this error should not show up again.

2-3 sec hitch on first begin play

This is due to python importing tensorflow on begin play and loading all the dlls. Currently unavoidable, only happens once per editor launch.

Issue not listed?

Post your issue to https://github.com/getnamo/TensorFlow-Unreal/issues

Plugin - MIT

TensorFlow and TensorFlow Icon - Apache 2.0

tensorflow-unreal's People

Contributors

getnamo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tensorflow-unreal's Issues

Mac OS support

Hi there,
I was wondering if there are any future plans to support this plugin running on Mac OS.

Thanks

Unable to Parse JSON File

Greetings,

I am fairly new to Unreal Engine. When I followed the instructions provided in the README, I simply dragged in the provided plugins and I receive the following error messages:


Running E:/UnrealEngineBuilds/UE_4.18/Engine/Binaries/DotNET/UnrealBuildTool.exe -projectfiles -project="E:/UnrealProjects/NeuraSample/NeuraSample.uproject" -game -rocket -progress
Discovering modules, targets and source code for project...
ERROR: UnrealBuildTool Exception: Tools.DotNETCommon.JsonParseException: Unable to parse E:\UnrealProjects\NeuraSample\Plugins\socketio-client-ue4._SocketIOClient.uplugin: Could not find token at index 0
at Tools.DotNETCommon.JsonObject.Read(FileReference File)
at UnrealBuildTool.PluginDescriptor.FromFile(FileReference FileName)
at UnrealBuildTool.PluginInfo..ctor(FileReference InFile, PluginType InType)
at UnrealBuildTool.Plugins.ReadPluginsFromDirectory(DirectoryReference ParentDirectory, PluginType Type)
at UnrealBuildTool.Plugins.ReadProjectPlugins(DirectoryReference ProjectDirectory)
at UnrealBuildTool.RulesCompiler.CreateProjectRulesAssembly(FileReference ProjectFileName)
at UnrealBuildTool.ProjectFileGenerator.AddProjectsForAllTargets(List1 AllGames, ProjectFile& EngineProject, ProjectFile& EnterpriseProject, Dictionary2& GameProjects, Dictionary2& ModProjects, Dictionary2& ProgramProjects, Dictionary2& TemplateGameProjects, Dictionary2& SampleGameProjects)
at UnrealBuildTool.ProjectFileGenerator.GenerateProjectFiles(String[] Arguments)
at UnrealBuildTool.UnrealBuildTool.GuardedMain(String[] Arguments)

Has anyone encountered this and found a solution to the problem?

Thank you!

failed_to_open

Crash if Python is not installed

Hey!

I've come to receive crash at breakpoint seen on image, if there is no python installed on system.
I tried this using releases for 4.21, 4.20.
Maybe some error should be thrown and caught exception for initialize threads or something.
Hope it helps.

image

Be careful with long with long path names.

I've encountered a very annoying issue where my project couldn't ever find the TensorFlowComponent after moving my project in some new folders. After a few hours, I found your suggestion on getnamo/TensorFlow-Unreal-Examples#12 about the long path names in Windows 10 which I tried but wouldn't help. So, I decided to move my project some hierachies down and there you go! It works again.... I don't know if that's a common issue because I've encountered it the first time but maybe you could add that to the known issues section :)
Or, do you know a solution to this problem? After a little research, it seems like that it is an issue with UE4 itself rather than Windows 10.

Making Microphone to be "Voice Activated" instead push-to-talk

Hello! This is not actually an Issue, but an request for help. I activated your plugin and added the TFAudioCapture component to player character.

Then in Beginplay I binded the delegate, convert the raw binary to Wav file and finally convert the Wav to USoundWave and play the thing. This allows me to play the sound that was just recorded
playsound

Here is the .CPP code for the Wav to USoundWave conversion if anybody needs:

USoundWave* AAudioCaptureSimpleCharacter::GetSoundWaveFromRawWav(TArray<uint8> Bytes)
{
	USoundWave* sw = NewObject<USoundWave>(USoundWave::StaticClass());`

	if (!sw)
		return nullptr;

	TArray < uint8 > rawFile;
	rawFile = Bytes;
	//FFileHelper::LoadFileToArray(rawFile, filePath.GetCharArray().GetData());
	FWaveModInfo WaveInfo;

	if (WaveInfo.ReadWaveInfo(rawFile.GetData(), rawFile.Num()))
	{
		sw->InvalidateCompressedData();

		sw->RawData.Lock(LOCK_READ_WRITE);
		void* LockedData = sw->RawData.Realloc(rawFile.Num());
		FMemory::Memcpy(LockedData, rawFile.GetData(), rawFile.Num());
		sw->RawData.Unlock();

		int32 DurationDiv = *WaveInfo.pChannels * *WaveInfo.pBitsPerSample * *WaveInfo.pSamplesPerSec;
		if (DurationDiv)
		{
			sw->Duration = *WaveInfo.pWaveDataSize * 8.0f / DurationDiv;
		}
		else
		{
			sw->Duration = 0.0f;
		}
		sw->SampleRate = *WaveInfo.pSamplesPerSec;
		sw->NumChannels = *WaveInfo.pChannels;
		sw->RawPCMDataSize = WaveInfo.SampleDataSize;
		sw->SoundGroup = ESoundGroup::SOUNDGROUP_Default;

	}
	else {
		return nullptr;
	}

	return sw;
}
USoundWave* AAudioCaptureSimpleCharacter::GetSoundWaveFromRawWav(TArray<uint8> Bytes)
{
	USoundWave* sw = NewObject<USoundWave>(USoundWave::StaticClass());

	if (!sw)
		return nullptr;

	TArray < uint8 > rawFile;
	rawFile = Bytes;
	//FFileHelper::LoadFileToArray(rawFile, filePath.GetCharArray().GetData());
	FWaveModInfo WaveInfo;

	if (WaveInfo.ReadWaveInfo(rawFile.GetData(), rawFile.Num()))
	{
		sw->InvalidateCompressedData();

		sw->RawData.Lock(LOCK_READ_WRITE);
		void* LockedData = sw->RawData.Realloc(rawFile.Num());
		FMemory::Memcpy(LockedData, rawFile.GetData(), rawFile.Num());
		sw->RawData.Unlock();

		int32 DurationDiv = *WaveInfo.pChannels * *WaveInfo.pBitsPerSample * *WaveInfo.pSamplesPerSec;
		if (DurationDiv)
		{
			sw->Duration = *WaveInfo.pWaveDataSize * 8.0f / DurationDiv;
		}
		else
		{
			sw->Duration = 0.0f;
		}
		sw->SampleRate = *WaveInfo.pSamplesPerSec;
		sw->NumChannels = *WaveInfo.pChannels;
		sw->RawPCMDataSize = WaveInfo.SampleDataSize;
		sw->SoundGroup = ESoundGroup::SOUNDGROUP_Default;

	}
	else {
		return nullptr;
	}

	return sw;
}

Now, I tried to see what value the bytes are that are coming from the OnAudioData Array, but when ever I try to do something with them, the whole game freezes. I guess it's because the data is constantly coming through and if something is done with the data, it never stops and computer chokes.

Could you point out what would be procedure to start doing the constantly listening microphone? You gave some advice for the subject in Unreal Forum, but I didn't quite grasp what you meant. Thank you for your time.

Packaging Support

I did a quick build of the MNIST demo in the ue4-examples (win x64), but I get an error on launch:

AsyncLoading.cpp [Line: 3013]
Missing Dependency, request for SockedIOClientComponent but it hasn't been created yet.

(Embedded Python dll Error) Project crashes on startup after installing plugins

I'm pretty new to UE4, so I'm not sure if I'm being dumb or if there actually is a bug.

I've installed the Plugins following the instructions, then copied the Content folder from the examples into a clean project. Running the project the first time works. I then restart and can access things like the TensorflowComponent in Blueprint. However, when I build my Visual Studio project and then restart UE4, it fails to load UnrealEnginePython and UE4 crashes at 71%.

I've noticed a few things, which may or may not be useful:
When loading up the project for the second time, I can access TensorFlow in the Editor however, none of the plugins appear under the Edit>Plugins tab.

If I build the solution from Visual Studio and try to launch through the debugger there, it crashes when running PyEval_InitThreads on line 466 of UnrealEnginePython.cpp. When building the VS project, it seems to run through all the UnrealEnginePython cpp files and builds them.
The error for this is: Unhandled exception at 0x00007FFD9ECF5A4E (ucrtbase.dll) in UE4Editor.exe: Fatal program exit requested.

Removing the UnrealEnginePython folder allows UE4 to load.

The call stack of UE4 starting up leads to ucrtbase.dll (image attached)
1pemnyt

Packaging error, cannot produce ..\Plugins\UnrealEnginePython\Binaries\Win64\UE4-UnrealEnginePython.lib

Hey!

I was trying to package my game and got the error that UE cannot produce the UE4-UnrealEnginePython.lib! Now, I'm asking myself if I need the entire source code of the Python plugin to get that running?

I'm using the latest version of UE4 and your TF release which means UE 4.19.2 and the 0.8.0 version of the plugin.

UPDATE: I'm using the source code of all the plugins now but it is still the same error
UPDATE 2: it seems to be an issue with the Python plugin and I created an issue there.

Thanks in advance for your help!

Make pip platform agnostic

Pip currently uses windows cmd to work asynchronously. We should be able to use python methods to work around this.

Documentation

Need gifs and examples of v0.1 API and expected python functions.

  • github API
  • expanded example gifs and documentation
  • video
  • document auxiliary c++ utility functions such as texture-> float array and byte streams.
  • rebuild mnist beginner sample from scratch
  • start with constant ops, move to placeholder, finally move to mnist beginner
  • include a saved model?

Documentation

Github looks good atm, but still missing example videos showing basics from start.

Part 1

  • introduction & setup
  • talk about constant and placeholder ops for e.g. basic adding

Part 2

  • mnist example
  • save load example

h5py install crash

Steps to reproduce:

  1. Create new project using ue4 4.19
  2. Copy extracted v0.8.0 for UE4.19 release into newly created Plugins folder
  3. Open Ue4 python editor:
import upypip as pip
pip.install("h5py")
  1. Close project and open it again
  2. Type in ue4 python console:
import tensorflow as tf

I have installed Cuda and i have working tensorflow-gpu in anaconda enviroment

can ue4.18.3 use v0.13.0 for UE4.22 with all dependencies met

can ue4.18.3 use v0.13.0 for UE4.22 with
UnrealEnginePython plugin dependency updated to 1.9.0
Socketio-client-ue4 plugin dependency update to 1.0.0
TensorFlow default updated to 1.12.0. Requires h5py to be 2.7.0.

cause I found v0.7.0 for UE4.18 is a bit older

Communication with C++

Hi, there

I'm recently building a machine learning project in UE4 and trying to use this plugin to deploy a trained model. Is there any way to directly get the output data from tensorflow in C++?

Building environment:
Windows 10
UE4.20
VS2015

Thanks for any help!

Failed to load the native TensorFlow runtime after UE restart.

Steps to reproduce:

  1. Unzip plugins from tensorflow-ue4.17-v0.4.1-gpu.7z
  2. Open TensorFlowExamples.uproject in UE and Play. Everythings run fine.
  3. Close Unreal Editor.
  4. Re-open the project and Play. TensorFlow won't work anymore.
  5. Check Python Console and see the red error message about TensorFlow runtime failed to load.

Temporary solution:
Delete "Plugins\UnrealEnginePython\Binaries\Win64\Lib\site-packages" folder before re-open .uproject

UnrealEnginePython plugin will have to re-install modules.

JSON input processing on background thread?

Hey!

I'm using the TF plugin for my thesis project and was annoyed of a delay during the json input processing and discovered that you don't use a BT thread for the processing like you do for training and setup. Therefore, I changed the code like you implemented it for the training and setup and it works fine! The only problem is that I can't forward arguments to the background thread with ut.run_on_bt() which is the reason why I needed to introduce a new variable with the current input -> which would cause problems if it'd be overriden by a new value before its actually processed. But that isn't a problem in my case since I double check if I'm currently processing a JSON input in my derived API class.

Anyways, is there a reason why you haven't implemented that? If there's no proper reason then I'd suggest to include that in the TF component to avoid game freezes :)

how to deploy to end user? / allow cpu fallback for gpu version?

when making a packaged build for end user release we can't really predict whether or not they have a compatible gpu, so how would I go about a procedure like:

  • detect gpu compatibility
  • if compatible, (ask them to; or automatically) install the cuda/cudnn dependencies
  • or fall back to the cpu version

the first one would be rather easy (check hardware info and show links to or provide the installers), but would i have to package 2 builds for the different versions, or could the plugin be made to automatically fall back?

EDIT: i guess this would also require multiplatform support which as far as i can see isn't provided yet? so I'd probably be better off not using this plugin directly and rather either provide a "cloud" solution or custom external worker started by the game that then gets connected to using the normal ue4 tcp socket stuff?

Support for 4.18

Error while building.
in TensorFlow.cpp the IsAvailable() and Get() do not exist in FUnrealEnginePythonModule
if (FUnrealEnginePythonModule::IsAvailable())
{
FUnrealEnginePythonModule::Get().AddPythonDependentPlugin("TensorFlow");
}
else
{
UE_LOG(TensorFlowLog, Warning, TEXT("UnrealEnginePython Plugin not found! Make sure you've enabled it in Edit->Plugins."));
}

save/load tensorflow models

Ensure we have a way to save/load tensor models so we don't have to retrain the models every run or run pretrained networks.

Retrain not working?

I was wondering if I'm using the retraining variable the right way --> I'm setting it to True when i want to force the API to retrain but it never happens! And I couldn't find the code part where it'd trigger a retraining? Therefore, I decided to do it manually with self.tf_component.train()

Fail to convert project to cpp

Plugin version: tensorflow-ue4.22-v0.13.0-cpu
UE4 version: 4.22.3
Visual Studio Community: 2017 15.9.14

Issue:
When converting the project from a Blueprint only as per the documentation and https://allarsblog.com/2015/11/04/converting-bp-project-to-cpp/ , the build fails when building with the configuration set to Development. Visual studio throws two errors:
Severity Code Description Project File Line Suppression State
Error C2039 'SetCurrentLevel': is not a member of 'UWorld' TensorFlowExamples D:\Unreal Projects\tensorflow-ue4-examples\Plugins\UnrealEnginePython\Source\UnrealEnginePython\Private\UObject\UEPyWorld.cpp 319

and
Severity Code Description Project File Line Suppression State
Error MSB3075 The command ""D:\Unreal Engine\UE_4.22\Engine\Build\BatchFiles\Build.bat" TensorFlowExamples Win64 Development -Project="D:\Unreal Projects\tensorflow-ue4-examples\TensorFlowExamples.uproject" -WaitMutex -FromMsBuild" exited with code 5. Please verify that you have sufficient rights to run this command. TensorFlowExamples C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets 44

I've tried both using one of the UE4 template projects, an empty newly created project, as well as the tensorflow-ue4-examples project. All fail with the same issue.

If I try to package the project without converting the python code will not run, but the game will start.
If I try to package the project after the failed conversion UE4 will fail with the same error.
Building with configuration Development Editor is successful.

Steps to recreate:

  1. Create a new UE4 project (UE4 4.22.3)
  2. Add the Plugins folder from tensorflow-ue4.22-v0.13.0-cpu.7z
  3. Start the project
  4. Create a new .cpp file, let UE4 compile
  5. Open visual studio, select configuration Development Editor
  6. Right-click project name and select Build, build successful
  7. Change configuration to Development
  8. Right-click project name and select Build, build fails with the above errors.

Am I doing something wrong? :)

Can we build tensorflow graph using UE4 blueprint?

Hello,
I am still building graphs with Tensorflow and haven't tried tensorflowue4 a lot yet. However, I am wondering is it possible to make changes to the plugin so that I can build tensorflow nn graphs using the blueprint of unreal?
I guess It will be possible if I can call any python functions, with some input parameters modifiable in blueprint, and feed the output of that python function, for example, a tensorflow operation, to another python function as input.

Thanks!

Commit plugin content to game repository (fails without binaries)

Hey :)
I had to commit the binaries in the three plugin folders to make it work on another machine. This is obviously not preferred so I am wondering what in my setup is wrong:

Steps to reproduce:

  • Create a blueprint project
  • Add a gitignore (I used UnrealEngine.gitignore from github)
  • Git init + commit for setup (just for fallbacks)
  • Start the project -> Works
  • Add the plugin
  • Start the project again to get dependencies -> Works
  • Commit all added files
  • Use git clean -xdf or simply clone to another folder to simulate clean checkout
  • Open the project -> Missing libaries -> Build -> Failes

Info

  • Used the latest release (v0.11.0 for UE4.21)
  • and (obviously) UE4.21.0

What am I doing wrong?

Multithreading frequent calls is crashing

If i call the JSON input function around once every second, its crashing the game with a large python log.
This happens on the CPU version of the plugin but I don't call any tensorflow commands so i doubt that would be causing it.

My JSON input function doesn't do anything for now, just returns an empty quote.

    def onJsonInput(self, jsonInput):
        result = ""
        return result

This crash doesn't occur with multi threading off.
Attached the crash logs.
ShooterAIProject-backup-2019.04.15-14.17.37.log

Packaging and and running packaged project with prebuilt binaries

Hi everyone

Can somebody tell me the procedure that I should follow when packaging project with one of binary releases (I am using tensorflow-ue4.19-v0.8.0-cpu.7z release, with upgraded tensorflow to 1.9).

I added this release to my Plugins folder and it works fine in editor, but project packaging is failing.
Do I package project using prebuilt binaries, or do I have to have source of this repo to package?

And after successful package, where do i include these prebuilt binaries in packaged game folder?

I have seen issue #16, but can anyone tell me workaround, for maybe adding binary releases to packaged bin folder?

I haven't seen anywhere this tutorial on how to package this plugin and it would be great if it is written somewhere.

Thanks!

Dependency problem on WIN64 UE 4.18.3

Hi, I am trying to get the example project going. I followed all instructions about installing GPU support with CUDA and setting of env variables. Then downloaded the project example and included the plugin folder.
Running on Basic Map seems to work fine, even though i get a ue_site not found error, i can send operations and getting results as you can see from the output log.
basic_outputlog.txt

Running the Mnist map causes an error of simplejson not found, and if I try sending inputs while playing in the editor viewport I get a AttributeError: 'TensorFlowComponent' object has no attribute 'tfapi' error too.
mnist_outputlog.txt

Do you have any idea of what can cause this issue?
Thx in advance for your support and for your effort in getting ML on UE4.

how to use in self-compiled UE4

I use UE4.15 compiled by my self. The problem is I used v0.2.0 for UE4.15 and v0.4.1 for UE4.17 all failed. the python can not include tendoeflow module. What can I do?
How to use the git cloning? could you show the detail step by step, thank you.

float array pointer pass

A main optimization, we need a way to declare a buffer of given length and pass that to python without copying, then reinterpret it as a float array in python. Essentially passing a float array with no copying.

This would in theory allow for streaming high amount of data through input/output streams

Do I need tensorflow to run this?

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!

Export Project with the plug-in

Hello,

I have used your Plug-in for my masterthesis and I want to create a windows executable of my scene, so other users without Unreal Engine can use my programm.
Could you write a tutorial or add a section to the README and explain how this is possible? I have a lot of difficulties to create the .exe and the documentation of the Unreal Engine is not very good for this problem.
If you could give me some feedback or advice soon, that would be very very appreciated (I have to submit my masterthesis next Tuesday).
Thanks a lot for your help!
Best regards
Marcel #

Async load and notify dependencies in TF Component

If dependencies aren't installed yet in a packaged build there may be a blocking load (usually in a black screen) and require a map restart to enable the tensorflow component.

This isn't ideal, consider try/catch importing or checking a json file on bootup and if it's not ready, wait for a signal from the dependency installs to continue with imports.

We could then expose a multicast delegate in the Tensorflow Component that notifies if dependencies are still pending (progress? likely will go 0 to 100 immediately), and when they're fully installed/ready. Devs could use this event to signal to user that there are installations going on and show e.g. a spinning widget.

Import error after install (GPU version)

Hi guys
Hope all is well
the tensorflow plugin is installed and
CUDA and CUDNN installed

LogPluginManager: Mounting plugin TensorFlow
LogPython: Python Scripts search path: ../../../../../../Users/U1/Documents/Unreal Projects/MyProject/Plugins/tensorflow-ue4/Content/Scripts
LogPython: Added TensorFlow Plugin Content/Scripts (C:/Users/U1/Documents/Unreal Projects/MyProject/Plugins/tensorflow-ue4/Content/Scripts) to sys.path
LogPython: upymodule_importer::Resolving upymodule dependencies for tensorflow-ue4
LogPython: upymodule_importer::tensorflow-gpu 1.12.0 installed? True
LogPython: upymodule_importer::2 tensorflow-ue4 upymodule dependencies resolved (if installation in progress, more async output will stream)
LogPython: TensorFlow Plugin upymodule.json parsed

Then when i do :
LogTemp: >>> import tensorflow as tf

This is the message:
File "C:\Users\U1\Documents\Unreal Projects\MyProject\Plugins\UnrealEnginePython\Binaries\Win64\Lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\U1\Documents\Unreal Projects\MyProject\Plugins\UnrealEnginePython\Binaries\Win64\Lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\U1\Documents\Unreal Projects\MyProject\Plugins\UnrealEnginePython\Binaries\Win64\Lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors
LogPython: Error: File "C:\Users\U1\Documents\Unreal Projects\MyProject\Plugins\UnrealEnginePython\Binaries\Win64\Lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
LogPython: Error: File "C:\Users\U1\Documents\Unreal Projects\MyProject\Plugins\UnrealEnginePython\Binaries\Win64\Lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
LogPython: Error: File "C:\Users\U1\Documents\Unreal Projects\MyProject\Plugins\UnrealEnginePython\Binaries\Win64\Lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
mod = imp.load_module('pywrap_tensorflow_internal', fp, pathname, description)
LogPython: Error: File "C:\Users\U1\Documents\Unreal Projects\MyProject\Plugins\UnrealEnginePython\Binaries\Win64\Lib\site-packages\tensorflow_init
.py", line 24, in
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
LogPython: Error: File "C:\Users\U1\Documents\Unreal Projects\MyProject\Plugins\UnrealEnginePython\Binaries\Win64\Lib\site-packages\tensorflow\python_init
.py", line 49, in
from tensorflow.python import pywrap_tensorflow
LogPython: Error: File "C:\Users\U1\Documents\Unreal Projects\MyProject\Plugins\UnrealEnginePython\Binaries\Win64\Lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in
File "C:\Users\U1\Documents\Unreal Projects\MyProject\Plugins\UnrealEnginePython\Binaries\Win64\Lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\U1\Documents\Unreal Projects\MyProject\Plugins\UnrealEnginePython\Binaries\Win64\Lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\U1\Documents\Unreal Projects\MyProject\Plugins\UnrealEnginePython\Binaries\Win64\Lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors

h5py produce crash of ue 4.20.2

Hi,

I used this pluggin with Unreal Engine 4.18 where I was able to load keras models with the load_weights function. This one use h5py module so it was installed as well. And everything worked fine :)

Today i tryed to migrate my work to UE 4.20.2 and tensorflow-ue4 v0.9.0. Python modules seems to be correctly installed, and basic examples works fine.
But when I install h5py module and run my project, the engine crash instantly (even if i dont import/use it in my python script)
I tried to install manually keras and cython too... with no positive effects

This problem disapear when I uninstall h5py (but i can't load my weights anymore).

Have you an idea to solve this issue, or have you some suggestions to save/load keras models without using h5py dependencie ?

Thank you in advance,
--Selim

Refactor into base tensorflow component

We can probably add a tickbox or a tensorflow component subclass which would enable remote tensorflow. This would work via re-routing calls to the tensorflow component to e.g. a python socket.io server which would call the same TFPluginAPI scripts on the server and return results without changing any blueprint or python API currently used.

This would enable easy scaling for training or production if greater performance is needed without depending on it locally.

[SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac

Downloading dependencies is failing for me with the following error:

LogPython: Collecting tensorflow-gpu==1.10.0
  Downloading https://files.pythonhosted.org/packages/ae/d9/60e1e73abffaeb0aaca7cc2bcfeb973ec3b314a3e46e26270966829b5207/tensorflow_gpu-1.10.0-cp36-cp36m-win_amd64.whl (115.8MB)
Could not install packages due to an EnvironmentError: [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:2217)

I'm new to python in UE4, any advice on where to even start with this?

4.22 - Failed to load the native TensorFlow runtime.

Ok so, to confirm the machine can build TF. I installed it via Anaconda
Windows 10
Python 3.6.9
install tensorflow-gpu=1.12.0 will grab CUDA9.0/cuDNN AND CUDA9.1 as part of the prerequisite libraries.
This works. Builds and trains models in VS.

Using the plugin, It grabs TF1.12.0 and the associated dependencies, But it will not run using the same CUDA/cuDNN configuration (I have tried9.0 with various versions of cuDNN) It gives a missing library error. I have the path variable pointing to cuDNN as explained on the installation guide.

full log:

Traceback (most recent call last): File "C:\Users\Administrator\Desktop\tensorflow-ue4-examples-master\Plugins\UnrealEnginePython\Binaries\Win64\Lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module> from tensorflow.python.pywrap_tensorflow_internal import * File "C:\Users\Administrator\Desktop\tensorflow-ue4-examples-master\Plugins\UnrealEnginePython\Binaries\Win64\Lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module> _pywrap_tensorflow_internal = swig_import_helper() File "C:\Users\Administrator\Desktop\tensorflow-ue4-examples-master\Plugins\UnrealEnginePython\Binaries\Win64\Lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "imp.py", line 243, in load_module File "imp.py", line 343, in load_dynamic ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed. Failed to load the native TensorFlow runtime. See https://www.tensorflow.org/install/errors for some common reasons and solutions. Include the entire stack trace above this error message when asking for help. Traceback (most recent call last): File "C:\Users\Administrator\Desktop\tensorflow-ue4-examples-master\Plugins\UnrealEnginePython\Binaries\Win64\Lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module> from tensorflow.python.pywrap_tensorflow_internal import * File "C:\Users\Administrator\Desktop\tensorflow-ue4-examples-master\Plugins\UnrealEnginePython\Binaries\Win64\Lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module> _pywrap_tensorflow_internal = swig_import_helper() File "C:\Users\Administrator\Desktop\tensorflow-ue4-examples-master\Plugins\UnrealEnginePython\Binaries\Win64\Lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "imp.py", line 243, in load_module File "imp.py", line 343, in load_dynamic ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\Administrator\Desktop\tensorflow-ue4-examples-master\Plugins\tensorflow-ue4\Content\Scripts\TensorFlowComponent.py", line 2, in <module> import tensorflow as tf File "C:\Users\Administrator\Desktop\tensorflow-ue4-examples-master\Plugins\UnrealEnginePython\Binaries\Win64\Lib\site-packages\tensorflow\__init__.py", line 24, in <module> from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import File "C:\Users\Administrator\Desktop\tensorflow-ue4-examples-master\Plugins\UnrealEnginePython\Binaries\Win64\Lib\site-packages\tensorflow\python\__init__.py", line 49, in <module> from tensorflow.python import pywrap_tensorflow File "C:\Users\Administrator\Desktop\tensorflow-ue4-examples-master\Plugins\UnrealEnginePython\Binaries\Win64\Lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module> raise ImportError(msg) ImportError: Traceback (most recent call last): File "C:\Users\Administrator\Desktop\tensorflow-ue4-examples-master\Plugins\UnrealEnginePython\Binaries\Win64\Lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module> from tensorflow.python.pywrap_tensorflow_internal import * File "C:\Users\Administrator\Desktop\tensorflow-ue4-examples-master\Plugins\UnrealEnginePython\Binaries\Win64\Lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module> _pywrap_tensorflow_internal = swig_import_helper() File "C:\Users\Administrator\Desktop\tensorflow-ue4-examples-master\Plugins\UnrealEnginePython\Binaries\Win64\Lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "imp.py", line 243, in load_module File "imp.py", line 343, in load_dynamic ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed. Failed to load the native TensorFlow runtime. See https://www.tensorflow.org/install/errors for some common reasons and solutions. Include the entire stack trace above this error message when asking for help.

Running a packaged exe contains errors

Started a blank project add all plugins and demo content. Everything works fine in editor. but after packaging a game I get these errors.

The game packages successfully and runs fine, but none of the tensorflow components work.

[2018.08.06-16.01.18:482][ 0]LogPackageName: Error: DoesPackageExist: DoesPackageExist FAILED: '/TensorFlow/ImageStruct' is not a standard unreal filename or a long path name. Reason: Path does not start with a valid root. Path must begin with: '/Engine/', '/Game/', '/Paper2D/', '/CryptoKeys/', '/MeshEditor/', '/DatasmithContent/', '/MediaCompositing/', '/OculusVR/', '/SteamVR/', '/Config/', '/Script/', '/Memory/', or '/Temp/'
[2018.08.06-16.01.18:482][ 0]LogStreaming: Error: Couldn't find file for package /TensorFlow/ImageStruct requested by async loading code. NameToLoad: /TensorFlow/ImageStruct

Full Logs: https://pastebin.com/scmjiDP5

I can upload a .zip if needed of the project.

OpenAI integration

Hello,

I must thank you from the bottom of my heart! This plug in is absolutely fantastic and I have been playing with it for a couple weeks now. Amazing job and I can't thank you enough for publishing this.

I am a machine learning noob but looking to pick up some skills. I am working on integrating the OpenAI work into this but I am having some difficulty.

Do you have any pointers that might be of help?

And can/how do you run the pip command to install packages?

Best,
Paul

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.