Chris Elion
5 年前
当前提交
3d8a70fb
共有 321 个文件被更改,包括 3716 次插入 和 2690 次删除
-
67.circleci/config.yml
-
19.pre-commit-config.yaml
-
4SURVEY.md
-
61UnitySDK/Assets/ML-Agents/Editor/AgentEditor.cs
-
214UnitySDK/Assets/ML-Agents/Editor/BrainParametersDrawer.cs
-
30UnitySDK/Assets/ML-Agents/Editor/DemonstrationDrawer.cs
-
2UnitySDK/Assets/ML-Agents/Editor/Tests/DemonstrationTests.cs
-
26UnitySDK/Assets/ML-Agents/Editor/Tests/EditModeTestInternalBrainTensorGenerator.cs
-
113UnitySDK/Assets/ML-Agents/Editor/Tests/MLAgentsEditModeTest.cs
-
29UnitySDK/Assets/ML-Agents/Examples/3DBall/Prefabs/3DBall.prefab
-
24UnitySDK/Assets/ML-Agents/Examples/3DBall/Prefabs/3DBallHardNew.prefab
-
47UnitySDK/Assets/ML-Agents/Examples/3DBall/Scenes/3DBall.unity
-
34UnitySDK/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DAgent.cs
-
25UnitySDK/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DHardAgent.cs
-
24UnitySDK/Assets/ML-Agents/Examples/Basic/Prefabs/Basic.prefab
-
13UnitySDK/Assets/ML-Agents/Examples/Basic/Scripts/BasicAgent.cs
-
24UnitySDK/Assets/ML-Agents/Examples/Bouncer/Prefabs/Environment.prefab
-
10UnitySDK/Assets/ML-Agents/Examples/Bouncer/Scripts/BouncerAgent.cs
-
25UnitySDK/Assets/ML-Agents/Examples/Crawler/Prefabs/DynamicPlatform.prefab
-
24UnitySDK/Assets/ML-Agents/Examples/Crawler/Prefabs/FixedPlatform.prefab
-
128UnitySDK/Assets/ML-Agents/Examples/FoodCollector/Prefabs/FoodCollectorArea.prefab
-
868UnitySDK/Assets/ML-Agents/Examples/FoodCollector/Prefabs/VisualFoodCollectorArea.prefab
-
92UnitySDK/Assets/ML-Agents/Examples/FoodCollector/Scenes/VisualFoodCollector.unity
-
102UnitySDK/Assets/ML-Agents/Examples/FoodCollector/Scripts/FoodCollectorAgent.cs
-
849UnitySDK/Assets/ML-Agents/Examples/GridWorld/Scenes/GridWorld.unity
-
113UnitySDK/Assets/ML-Agents/Examples/GridWorld/Scripts/GridAcademy.cs
-
32UnitySDK/Assets/ML-Agents/Examples/GridWorld/Scripts/GridAgent.cs
-
24UnitySDK/Assets/ML-Agents/Examples/Hallway/Prefabs/SymbolFinderArea.prefab
-
43UnitySDK/Assets/ML-Agents/Examples/Hallway/Prefabs/VisualSymbolFinderArea.prefab
-
79UnitySDK/Assets/ML-Agents/Examples/Hallway/Scenes/VisualHallway.unity
-
57UnitySDK/Assets/ML-Agents/Examples/Hallway/Scripts/HallwayAgent.cs
-
24UnitySDK/Assets/ML-Agents/Examples/PushBlock/Prefabs/PushBlockArea.prefab
-
37UnitySDK/Assets/ML-Agents/Examples/PushBlock/Prefabs/PushBlockVisualArea.prefab
-
59UnitySDK/Assets/ML-Agents/Examples/PushBlock/Scenes/VisualPushBlock.unity
-
21UnitySDK/Assets/ML-Agents/Examples/PushBlock/Scripts/PushAgentBasic.cs
-
24UnitySDK/Assets/ML-Agents/Examples/Pyramids/Prefabs/AreaPB.prefab
-
55UnitySDK/Assets/ML-Agents/Examples/Pyramids/Prefabs/VisualAreaPyramids.prefab
-
73UnitySDK/Assets/ML-Agents/Examples/Pyramids/Scenes/VisualPyramids.unity
-
65UnitySDK/Assets/ML-Agents/Examples/Pyramids/Scripts/PyramidAgent.cs
-
24UnitySDK/Assets/ML-Agents/Examples/Reacher/Prefabs/Agent.prefab
-
9UnitySDK/Assets/ML-Agents/Examples/SharedAssets/Scripts/RayPerception.cs
-
9UnitySDK/Assets/ML-Agents/Examples/SharedAssets/Scripts/RayPerception2D.cs
-
4UnitySDK/Assets/ML-Agents/Examples/SharedAssets/Scripts/RayPerception3D.cs
-
96UnitySDK/Assets/ML-Agents/Examples/Soccer/Prefabs/SoccerFieldTwos.prefab
-
48UnitySDK/Assets/ML-Agents/Examples/Tennis/Prefabs/TennisArea.prefab
-
9UnitySDK/Assets/ML-Agents/Examples/Tennis/Scripts/TennisAgent.cs
-
24UnitySDK/Assets/ML-Agents/Examples/Walker/Prefabs/WalkerPair.prefab
-
30UnitySDK/Assets/ML-Agents/Examples/WallJump/Prefabs/WallJumpArea.prefab
-
8UnitySDK/Assets/ML-Agents/Examples/WallJump/Scenes/WallJump.unity
-
37UnitySDK/Assets/ML-Agents/Examples/WallJump/Scripts/WallJumpAgent.cs
-
2UnitySDK/Assets/ML-Agents/Plugins/Barracuda.Core/Barracuda.md
-
2UnitySDK/Assets/ML-Agents/Plugins/Barracuda.Core/LICENSE.md
-
10UnitySDK/Assets/ML-Agents/Plugins/Barracuda.Core/ReleaseNotes.md
-
120UnitySDK/Assets/ML-Agents/Scripts/Academy.cs
-
316UnitySDK/Assets/ML-Agents/Scripts/Agent.cs
-
4UnitySDK/Assets/ML-Agents/Scripts/DemonstrationRecorder.cs
-
69UnitySDK/Assets/ML-Agents/Scripts/Grpc/CommunicatorObjects/AgentInfo.cs
-
44UnitySDK/Assets/ML-Agents/Scripts/Grpc/CommunicatorObjects/BrainParameters.cs
-
9UnitySDK/Assets/ML-Agents/Scripts/Grpc/CommunicatorObjects/SpaceType.cs
-
2UnitySDK/Assets/ML-Agents/Scripts/Grpc/CommunicatorObjects/CompressedObservation.cs.meta
-
56UnitySDK/Assets/ML-Agents/Scripts/Grpc/GrpcExtensions.cs
-
181UnitySDK/Assets/ML-Agents/Scripts/Grpc/RpcCommunicator.cs
-
22UnitySDK/Assets/ML-Agents/Scripts/ICommunicator.cs
-
354UnitySDK/Assets/ML-Agents/Scripts/InferenceBrain/BarracudaModelParamLoader.cs
-
16UnitySDK/Assets/ML-Agents/Scripts/InferenceBrain/GeneratorImpl.cs
-
23UnitySDK/Assets/ML-Agents/Scripts/InferenceBrain/TensorGenerator.cs
-
35UnitySDK/Assets/ML-Agents/Scripts/Timer.cs
-
69UnitySDK/Assets/ML-Agents/Scripts/Utilities.cs
-
4UnitySDK/README.md
-
8config/gail_config.yaml
-
2config/offline_bc_config.yaml
-
53config/sac_trainer_config.yaml
-
42config/trainer_config.yaml
-
2docs/Background-TensorFlow.md
-
75docs/Basic-Guide.md
-
20docs/Creating-Custom-Protobuf-Messages.md
-
2docs/FAQ.md
-
4docs/Feature-Memory.md
-
118docs/Getting-Started-with-Balance-Ball.md
-
12docs/Glossary.md
-
16docs/Installation.md
-
7docs/Learning-Environment-Best-Practices.md
-
212docs/Learning-Environment-Create-New.md
-
2docs/Learning-Environment-Design-Academy.md
-
206docs/Learning-Environment-Design-Agents.md
-
66docs/Learning-Environment-Design.md
-
76docs/Learning-Environment-Examples.md
-
17docs/Learning-Environment-Executable.md
-
97docs/ML-Agents-Overview.md
-
9docs/Migrating.md
-
6docs/Readme.md
-
2docs/Reward-Signals.md
-
35docs/Training-Behavioral-Cloning.md
-
14docs/Training-Curriculum-Learning.md
-
70docs/Training-Generalized-Reinforcement-Learning-Agents.md
-
26docs/Training-ML-Agents.md
-
2docs/Training-PPO.md
-
2docs/Training-SAC.md
-
2docs/Training-Using-Concurrent-Unity-Instances.md
-
5docs/Training-on-Amazon-Web-Service.md
|
|||
# Unity ML-Agents Toolkit Survey |
|||
|
|||
Your opinion matters a great deal to us. Only by hearing your thoughts on the Unity ML-Agents Toolkit can we continue to improve and grow. Please take a few minutes to let us know about it. |
|||
Your opinion matters a great deal to us. Only by hearing your thoughts on the Unity ML-Agents Toolkit can we continue to improve and grow. Please take a few minutes to let us know about it. |
|||
[Fill out the survey](https://goo.gl/forms/qFMYSYr5TlINvG6f1) |
|||
[Fill out the survey](https://goo.gl/forms/qFMYSYr5TlINvG6f1) |
868
UnitySDK/Assets/ML-Agents/Examples/FoodCollector/Prefabs/VisualFoodCollectorArea.prefab
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
849
UnitySDK/Assets/ML-Agents/Examples/GridWorld/Scenes/GridWorld.unity
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
|
|||
[HideInInspector] |
|||
public List<GameObject> actorObjs; |
|||
[HideInInspector] |
|||
public int[] players; |
|||
public Camera MainCamera; |
|||
public GameObject trueAgent; |
|||
|
|||
public int gridSize; |
|||
|
|||
public GameObject camObject; |
|||
Camera m_Cam; |
|||
Camera m_AgentCam; |
|||
|
|||
public GameObject agentPref; |
|||
public GameObject goalPref; |
|||
public GameObject pitPref; |
|||
GameObject[] m_Objects; |
|||
|
|||
GameObject m_Plane; |
|||
GameObject m_Sn; |
|||
GameObject m_Ss; |
|||
GameObject m_Se; |
|||
GameObject m_Sw; |
|||
|
|||
public override void InitializeAcademy() |
|||
public override void AcademyReset() |
|||
gridSize = (int)resetParameters["gridSize"]; |
|||
m_Cam = camObject.GetComponent<Camera>(); |
|||
|
|||
m_Objects = new[] {agentPref, goalPref, pitPref}; |
|||
|
|||
m_AgentCam = GameObject.Find("agentCam").GetComponent<Camera>(); |
|||
|
|||
actorObjs = new List<GameObject>(); |
|||
|
|||
m_Plane = GameObject.Find("Plane"); |
|||
m_Sn = GameObject.Find("sN"); |
|||
m_Ss = GameObject.Find("sS"); |
|||
m_Sw = GameObject.Find("sW"); |
|||
m_Se = GameObject.Find("sE"); |
|||
} |
|||
|
|||
public void SetEnvironment() |
|||
{ |
|||
m_Cam.transform.position = new Vector3(-((int)resetParameters["gridSize"] - 1) / 2f, |
|||
MainCamera.transform.position = new Vector3(-((int)resetParameters["gridSize"] - 1) / 2f, |
|||
m_Cam.orthographicSize = ((int)resetParameters["gridSize"] + 5f) / 2f; |
|||
|
|||
var playersList = new List<int>(); |
|||
|
|||
for (var i = 0; i < (int)resetParameters["numObstacles"]; i++) |
|||
{ |
|||
playersList.Add(2); |
|||
} |
|||
|
|||
for (var i = 0; i < (int)resetParameters["numGoals"]; i++) |
|||
{ |
|||
playersList.Add(1); |
|||
} |
|||
players = playersList.ToArray(); |
|||
|
|||
m_Plane.transform.localScale = new Vector3(gridSize / 10.0f, 1f, gridSize / 10.0f); |
|||
m_Plane.transform.position = new Vector3((gridSize - 1) / 2f, -0.5f, (gridSize - 1) / 2f); |
|||
m_Sn.transform.localScale = new Vector3(1, 1, gridSize + 2); |
|||
m_Ss.transform.localScale = new Vector3(1, 1, gridSize + 2); |
|||
m_Sn.transform.position = new Vector3((gridSize - 1) / 2f, 0.0f, gridSize); |
|||
m_Ss.transform.position = new Vector3((gridSize - 1) / 2f, 0.0f, -1); |
|||
m_Se.transform.localScale = new Vector3(1, 1, gridSize + 2); |
|||
m_Sw.transform.localScale = new Vector3(1, 1, gridSize + 2); |
|||
m_Se.transform.position = new Vector3(gridSize, 0.0f, (gridSize - 1) / 2f); |
|||
m_Sw.transform.position = new Vector3(-1, 0.0f, (gridSize - 1) / 2f); |
|||
|
|||
m_AgentCam.orthographicSize = (gridSize) / 2f; |
|||
m_AgentCam.transform.position = new Vector3((gridSize - 1) / 2f, gridSize + 1f, (gridSize - 1) / 2f); |
|||
} |
|||
|
|||
public override void AcademyReset() |
|||
{ |
|||
foreach (var actor in actorObjs) |
|||
{ |
|||
DestroyImmediate(actor); |
|||
} |
|||
SetEnvironment(); |
|||
|
|||
actorObjs.Clear(); |
|||
|
|||
var numbers = new HashSet<int>(); |
|||
while (numbers.Count < players.Length + 1) |
|||
{ |
|||
numbers.Add(Random.Range(0, gridSize * gridSize)); |
|||
} |
|||
var numbersA = Enumerable.ToArray(numbers); |
|||
|
|||
for (var i = 0; i < players.Length; i++) |
|||
{ |
|||
var x = (numbersA[i]) / gridSize; |
|||
var y = (numbersA[i]) % gridSize; |
|||
var actorObj = Instantiate(m_Objects[players[i]]); |
|||
actorObj.transform.position = new Vector3(x, -0.25f, y); |
|||
actorObjs.Add(actorObj); |
|||
} |
|||
|
|||
var xA = (numbersA[players.Length]) / gridSize; |
|||
var yA = (numbersA[players.Length]) % gridSize; |
|||
trueAgent.transform.position = new Vector3(xA, -0.25f, yA); |
|||
} |
|||
|
|||
public override void AcademyStep() |
|||
{ |
|||
MainCamera.orthographicSize = ((int)resetParameters["gridSize"] + 5f) / 2f; |
|||
} |
|||
} |
|
|||
Barracuda cross-platform Neural Net engine copyright © 2018 Unity Technologies ApS |
|||
|
|||
Licensed under the Unity Companion License for Unity-dependent projects--see [Unity Companion License](http://www.unity3d.com/legal/licenses/Unity_Companion_License). |
|||
Licensed under the Unity Companion License for Unity-dependent projects--see [Unity Companion License](http://www.unity3d.com/legal/licenses/Unity_Companion_License). |
|||
|
|||
Unless expressly provided otherwise, the Software under this license is made available strictly on an “AS IS” BASIS WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. Please review the license for details on these and other terms and conditions. |
|||
|
|
|||
# Unity ML-Agents SDK |
|||
|
|||
Contains the ML-Agents Unity Project, including |
|||
both the core plugin (in `Scripts`), as well as a set |
|||
Contains the ML-Agents Unity Project, including |
|||
both the core plugin (in `Scripts`), as well as a set |
|||
of example environments (in `Examples`). |
|
|||
# Training with Behavioral Cloning |
|||
|
|||
There are a variety of possible imitation learning algorithms which can |
|||
be used, the simplest one of them is Behavioral Cloning. It works by collecting |
|||
demonstrations from a teacher, and then simply uses them to directly learn a |
|||
policy, in the same way the supervised learning for image classification |
|||
There are a variety of possible imitation learning algorithms which can |
|||
be used, the simplest one of them is Behavioral Cloning. It works by collecting |
|||
demonstrations from a teacher, and then simply uses them to directly learn a |
|||
policy, in the same way the supervised learning for image classification |
|||
With offline behavioral cloning, we can use demonstrations (`.demo` files) |
|||
With offline behavioral cloning, we can use demonstrations (`.demo` files) |
|||
1. Choose an agent you would like to learn to imitate some set of demonstrations. |
|||
2. Record a set of demonstration using the `Demonstration Recorder` (see [here](Training-Imitation-Learning.md)). |
|||
For illustrative purposes we will refer to this file as `AgentRecording.demo`. |
|||
3. Build the scene, assigning the agent a Learning Brain. For more information on Brains, see |
|||
[here](Learning-Environment-Design-Brains.md). |
|||
4. Open the `config/offline_bc_config.yaml` file. |
|||
5. Modify the `demo_path` parameter in the file to reference the path to the |
|||
demonstration file recorded in step 2. In our case this is: |
|||
1. Choose an agent you would like to learn to imitate some set of demonstrations. |
|||
2. Record a set of demonstration using the `Demonstration Recorder` (see [here](Training-Imitation-Learning.md)). |
|||
For illustrative purposes we will refer to this file as `AgentRecording.demo`. |
|||
3. Build the scene(make sure the Agent is not using its heuristic). |
|||
4. Open the `config/offline_bc_config.yaml` file. |
|||
5. Modify the `demo_path` parameter in the file to reference the path to the |
|||
demonstration file recorded in step 2. In our case this is: |
|||
6. Launch `mlagent-learn`, providing `./config/offline_bc_config.yaml` |
|||
as the config parameter, and include the `--run-id` and `--train` as usual. |
|||
Provide your environment as the `--env` parameter if it has been compiled |
|||
6. Launch `mlagent-learn`, providing `./config/offline_bc_config.yaml` |
|||
as the config parameter, and include the `--run-id` and `--train` as usual. |
|||
Provide your environment as the `--env` parameter if it has been compiled |
|||
This will use the demonstration file to train a neural network driven agent |
|||
to directly imitate the actions provided in the demonstration. The environment |
|||
This will use the demonstration file to train a neural network driven agent |
|||
to directly imitate the actions provided in the demonstration. The environment |
|||
will launch and be used for evaluating the agent's performance during training. |
部分文件因为文件数量过多而无法显示
撰写
预览
正在加载...
取消
保存
Reference in new issue