This project uses the game engine Unity and the Unity ML-Agents Toolkit to provide a reinforcement learning environment for training an agent to actively track a moving target. The Unity scenes CubeTrack and VisualCubeTrack are set up to use the ML-Agents implementation of PPO (Proximal Policy Optimization), a 5-choice discrete action space, vector and visual observations respectively, and the reward function described in this paper by Luo et al. (2018)
Blog post on Medium: https://knrichardson.medium.com/cubetrack-deep-rl-for-active-tracking-with-unity-ml-agents-6b92d58acb5d
The game objects used in the Unity scenes have been sourced from the ML-Agents example environment PushBlock
Version information used in development: ml-agents: 0.18.0, ml-agents-envs: 0.18.0, Communicator API: 1.0.0, TensorFlow: 1.14.0, Unity: 2019.4.4f1, Python: 3.6.9
The CubeTrack GitHub repository includes the saved models and tensorboard files for five training runs within the results folder. The runs 'visual_grayscale_simple' and 'visual_colour_simple' are unsuccessful training runs that were cut short at around 2M steps. The run 'visual_grayscale_simple(old)' was ran on an older, simpler version of the CubeTrack environment (explained in Medium blog). The runs 'vector_simple' and 'visual_colour_resnet' are the successful training runs (5M steps) using vector and visual observations respectively. The training statistics for all of these runs can be viewed in Tensorboard with the terminal command
tensorboard --logdir results
To watch an agent in action ..
To train an agent, first make sure to change the Model field of every agent game object to None. Edit the training configuration by changing the hyperparameters in the appropriate yaml file, located in the config folder. From the root of the CubeTrack directory, open a terminal, activate your python virtual environment, and issue the command
mlagents-learn ./config/ppo/CubeTrack.yaml --run-id=runName
with a run name of your choice and with any additional options tagged on the end (use -h to explore the full usage of the mlagents-learn command). If training with visual observations, the filepath should be to VisualCubeTrack.yaml. Note you can also issue this command from the root of the ML-Agents repository so long as the appropriate yaml file is in the ML-Agents config folder alongside the yaml files for the example environments. Models and training statistics will go into the ML-Agents results folder in this instance.