Regarding ML-Agents which is Unity plugin to realized Machine Learning environment in Unity, last time, I explained about pre-preparation step (create Python environment) to try 3Dball which is sample of ML-Agents.
[Link: I tried 3DBall sample of Unity “ML-Agents” (Using sample learned model) Part1]
This time, I’ll explain set up in Unity to try the 3Dball sample.
[2. Make machine learning environment in Unity]
2.1. Open ML-Agents project in Unity
Start Unity, and open “ml-agents-master” project under unity-environment folder extracted earlier.
And open “3Dball” scene in Project view.
2.2. Import “TFSharpPlugin” into Unity
To use TensorFlow in Unity, download “TFSharpPlugin” package from following link.
[Link: https://s3.amazonaws.com/unity-agents/TFSharpPlugin.unitypackage]
Import this package, by directly drag and drop this to Project view or by importing from ‘Import Package’.
Here is the case of importing from ‘Import Package’:
Assets > Import Package > Custom Package…
2.3. Set up ML-Agents project
Open ‘Player Setting’ screen from menu of Unity editor.
Edit > Project Settings > Player
Set up following setting in ‘Other Settings’ area of Player Setting in Inspector view.
– ‘Scripting Runtime Version’: Select ‘Experimental (.Net 4.6 Equivalent)’
– ‘Scripting Defined Symbols’: Input ‘ENABLE_TENSORFLOW’
After that, save both the scene and the project.
File > Save Scene and File > Save Project
Close Unity one time, and re-open Unity.
3. Try to play 3Dball
3.1. Try to play by yourself
One time, to understand this game, let’s try to play by ourselves. In Hierarchy view, click ‘Ball3Dbrain’ game object under ‘Ball3Dacademy’.
On Brain component in Inspector view, change ‘Brain Type’ to ‘Player’.
Ok, let’s try to play.
You can control by arrow keys on keyboard. It’s impossible to control all plates, so focus on one plate… However, it’s impossible.
3.2. Try to use sample learned model
Click ‘Ball3Dbrain’ game object under ‘Ball3Dacademy’ in hierarchy view again.
This time, on Brain component in Inspector view, change ‘Brain Type’ to ‘Internal’.
By checking ‘Graph Model’, you can know which learned model is used. In this case, ‘3DBall’ which is included in TFModels folder originally as sample is used.
Ok, let’s make the machine play the game. It’s sample learned model, so it’s balancing very well!
Next, I’ll finally introduce how to make a machine to learn by yourself.
[Link: I tried 3DBall sample of Unity “ML-Agents” (Tried Machine Learning)]
[Original Japanese Site: http://blog.lab7.biz/archives/11184043.html]