Unity 机器学习代理工具包 (ML-Agents) 是一个开源项目,它使游戏和模拟能够作为训练智能代理的环境。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 

4.4 KiB

About ML-Agents package (com.unity.ml-agents)

The Unity ML-Agents package contains the C# SDK for the Unity ML-Agents Toolkit.

The package provides the ability for any Unity scene to be converted into a learning environment where character behaviors can be trained using a variety of machine learning algorithms. Additionally, it enables any trained behavior to be embedded back into the Unity scene. More specifically, the package provides the following core functionalities:

  • Define Agents: entities whose behavior will be learned. Agents are entities that generate observations (through sensors), take actions and receive rewards from the environment.
  • Define Behaviors: entities that specifiy how an agent should act. Multiple agents can share the same Behavior and a scene may have multiple Behaviors.
  • Record demonstrations of an agent within the Editor. These demonstrations can be valuable to train a behavior for that agent.
  • Embedding a trained behavior into the scene via the Unity Inference Engine. Thus an Agent can switch from a learning behavior to an inference behavior.

Note that this package does not contain the machine learning algorithms for training behaviors. It relies on a Python package to orchestrate the training. This package only enables instrumenting a Unity scene and setting it up for training, and then embedding the trained model back into your Unity scene.

Preview package

This package is available as a preview, so it is not ready for production use. The features and documentation in this package might change before it is verified for release.

Package contents

The following table describes the package folder structure:

Location Description
Documentation~ Contains the documentation for the Unity package.
Editor Contains utilities for Editor windows and drawers.
Plugins Contains third-party DLLs.
Runtime Contains core C# APIs for integrating ML-Agents into your Unity scene.
Tests Contains the unit tests for the package.

Installation

To install this package, follow the instructions in the Package Manager documentation.

To install the Python package to enable training behaviors, follow the instructions on our GitHub repository.

Requirements

This version of the Unity ML-Agents package is compatible with the following versions of the Unity Editor:

  • 2018.4 and later (recommended)

Known limitations

Training

Training is limited to the Unity Editor and Standalone builds on Windows, MacOS, and Linux. Your environment will default to inference mode if training is not supported or is not currently running.

Inference

Inference is executed via the Unity Inference Engine.

CPU

  • All platforms supported.

GPU

  • All platforms supported except:
    • WebGL and GLES 3/2 on Android / iPhone

NOTE: Mobile platform support includes:

  • Vulkan for Android
  • Metal for iOS.

Headless Mode

If you enable Headless mode, you will not be able to collect visual observations from your agents.

Rendering Speed and Synchronization

Currently the speed of the game physics can only be increased to 100x real-time. The Academy also moves in time with FixedUpdate() rather than Update(), so game behavior implemented in Update() may be out of sync with the agent decision making. See Execution Order of Event Functions for more information.

You can control the frequency of Academy stepping by calling Academy.Instance.DisableAutomaticStepping(), and then calling Academy.Instance.EnvironmentStep()

Unity Inference Engine Models

Currently, only models created with our trainers are supported for running ML-Agents with a neural network behavior.

If you are new to the Unity ML-Agents package, or have a question after reading the documentation, you can checkout our GitHUb Repository, which also includes a number of ways to connect with us including our ML-Agents Forum.