Unity ML Agents | Visual Chameleons

chameleons_thumbnail.jpg

Start Here First!

In the video, I skip over the setup (which is common to all ML Agents projects) to get right into the content specific to our Visual Chameleon Agents. Unity has excellent documentation on installation and setup and they will always have the most up-to-date instructions.

Installation

Follow the ML-Agents Installation Instructions first. I’m using Unity version 2018.3 in my video. If you use an older version you may have trouble following along in the prefab section because the prefab workflow has changed recently.

I’m using Anaconda on Windows for training. There are specific Windows Installation Instructions for this.

Common Project Setup

Follow the Basic Guide to make sure your ML Agents project is set up. I would recommend attempting to start training the 3D Ball example just to make sure you don’t get any error messages.

Training

We use Curriculum Learning to train our chameleons. If you haven’t done this before, click the link for a helpful documentation page on this.

Chameleon Project Setup

Once you understand how to run an example ML-Agent training session with curriculum, do this:

  1. Download the Code Files and 3d Mesh Files linked below

  2. Import the Scripts folder into your Unity project, it should include ChameleonAcademy.cs, ChameleonArea.cs, and ChameleonAgent.cs

  3. Import the two .fbx 3d models into a new Meshes folder in your Unity project

  4. Add the “ChameleonLearning” section of the trainer_config.yaml to your config/trainer_config.yaml

  5. Add the ChameleonLearning.json curriculum files to config/curricula/chameleons

Code & Assets

Code Files

3d Mesh Files

Helpful Additions

Training Command

The command I used to train (in my Anaconda Prompt) with curriculum was:

mlagents-learn config/trainer_config.yaml --curriculum=config/curricula/chameleon/ --run-id=chameleon01 --train

Contact

You can reach out to me at @aktwelve on Twitter or connect with me on LinkedIn.

For future updates