浏览代码
Support multi-dimensional and compressed observations stacking (#4476)
Support multi-dimensional and compressed observations stacking (#4476)
Added stacking to multi-dimensional and compressed observations and added compressed channel mapping in communicator to support decompression. Co-authored-by: Vincent-Pierre BERGES <vincentpierre@unity3d.com> Co-authored-by: Chris Elion <chris.elion@unity3d.com>/MLA-1734-demo-provider
GitHub
4 年前
当前提交
c3d2b902
共有 28 个文件被更改,包括 832 次插入 和 97 次删除
-
12com.unity.ml-agents/CHANGELOG.md
-
1com.unity.ml-agents/Editor/CameraSensorComponentEditor.cs
-
1com.unity.ml-agents/Editor/RenderTextureSensorComponentEditor.cs
-
6com.unity.ml-agents/Runtime/Academy.cs
-
62com.unity.ml-agents/Runtime/Communicator/GrpcExtensions.cs
-
4com.unity.ml-agents/Runtime/Communicator/UnityRLCapabilities.cs
-
40com.unity.ml-agents/Runtime/Grpc/CommunicatorObjects/Capabilities.cs
-
34com.unity.ml-agents/Runtime/Grpc/CommunicatorObjects/Observation.cs
-
54com.unity.ml-agents/Runtime/SensorHelper.cs
-
28com.unity.ml-agents/Runtime/Sensors/CameraSensorComponent.cs
-
28com.unity.ml-agents/Runtime/Sensors/RenderTextureSensorComponent.cs
-
190com.unity.ml-agents/Runtime/Sensors/StackingSensor.cs
-
31com.unity.ml-agents/Tests/Editor/Communicator/GrpcExtensionsTests.cs
-
156com.unity.ml-agents/Tests/Editor/Sensor/StackingSensorTests.cs
-
10com.unity.ml-agents/Tests/Editor/Sensor/VectorSensorTests.cs
-
11ml-agents-envs/mlagents_envs/communicator_objects/capabilities_pb2.py
-
6ml-agents-envs/mlagents_envs/communicator_objects/capabilities_pb2.pyi
-
19ml-agents-envs/mlagents_envs/communicator_objects/observation_pb2.py
-
6ml-agents-envs/mlagents_envs/communicator_objects/observation_pb2.pyi
-
4ml-agents-envs/mlagents_envs/environment.py
-
81ml-agents-envs/mlagents_envs/rpc_utils.py
-
76ml-agents-envs/mlagents_envs/tests/test_rpc_utils.py
-
3protobuf-definitions/proto/mlagents_envs/communicator_objects/capabilities.proto
-
1protobuf-definitions/proto/mlagents_envs/communicator_objects/observation.proto
-
20com.unity.ml-agents/Runtime/Sensors/ISparseChannelSensor.cs
-
11com.unity.ml-agents/Runtime/Sensors/ISparseChannelSensor.cs.meta
-
23com.unity.ml-agents/Tests/Editor/Sensor/SensorTestHelper.cs
-
11com.unity.ml-agents/Tests/Editor/Sensor/SensorTestHelper.cs.meta
|
|||
namespace Unity.MLAgents.Sensors |
|||
{ |
|||
/// <summary>
|
|||
/// Sensor interface for sparse channel sensor which requires a compressed channel mapping.
|
|||
/// </summary>
|
|||
public interface ISparseChannelSensor : ISensor |
|||
{ |
|||
/// <summary>
|
|||
/// Returns the mapping of the channels in compressed data to the actual channel after decompression.
|
|||
/// The mapping is a list of interger index with the same length as
|
|||
/// the number of output observation layers (channels), including padding if there's any.
|
|||
/// Each index indicates the actual channel the layer will go into.
|
|||
/// Layers with the same index will be averaged, and layers with negative index will be dropped.
|
|||
/// For example, mapping for CameraSensor using grayscale and stacking of two: [0, 0, 0, 1, 1, 1]
|
|||
/// Mapping for GridSensor of 4 channels and stacking of two: [0, 1, 2, 3, -1, -1, 4, 5, 6, 7, -1, -1]
|
|||
/// </summary>
|
|||
/// <returns>Mapping of the compressed data</returns>
|
|||
int[] GetCompressedChannelMapping(); |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 63bb76c1e31c24fa5b4a384ea0edbfb0 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using NUnit.Framework; |
|||
using UnityEngine; |
|||
using Unity.MLAgents.Sensors; |
|||
|
|||
namespace Unity.MLAgents.Tests |
|||
{ |
|||
public static class SensorTestHelper |
|||
{ |
|||
public static void CompareObservation(ISensor sensor, float[] expected) |
|||
{ |
|||
string errorMessage; |
|||
bool isOK = SensorHelper.CompareObservation(sensor, expected, out errorMessage); |
|||
Assert.IsTrue(isOK, errorMessage); |
|||
} |
|||
|
|||
public static void CompareObservation(ISensor sensor, float[,,] expected) |
|||
{ |
|||
string errorMessage; |
|||
bool isOK = SensorHelper.CompareObservation(sensor, expected, out errorMessage); |
|||
Assert.IsTrue(isOK, errorMessage); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: e769354f8bd404ca180d7cd7302a5d61 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue