浏览代码

Hotfix 0.3.1a (#625)

* [CoreBrain] Bug fix in the internal brain
Discrete vector observations did not have the right size

* [Docs] Removed all references to the unitypackages other than the TensorFlowSharp.unitypackage
.

* [Basic] Updated the bytes file of basic

* [Docs] Addressed comments

* [Docs] Re-addressed the comments

* [Bug Fix] Scalling the visual input between 0 and 1

* [Comments] Added comments to the
BatchVisualObservations method of the CoreInternalBrain.

* [Renaming] Renamed BlackAndWhite to blackAndWhite
/develop-generalizationTraining-TrainerController
GitHub 7 年前
当前提交
a99aad13
共有 6 个文件被更改,包括 135 次插入109 次删除
  1. 6
      docs/Installation.md
  2. 6
      docs/localized/zh-CN/docs/Installation.md
  3. 138
      unity-environment/Assets/ML-Agents/Examples/Basic/Scene.unity
  4. 42
      unity-environment/Assets/ML-Agents/Examples/Basic/TFModels/Basic.bytes
  5. 4
      unity-environment/Assets/ML-Agents/Examples/Basic/TFModels/Basic.bytes.meta
  6. 48
      unity-environment/Assets/ML-Agents/Scripts/CoreBrainInternal.cs

6
docs/Installation.md


## Unity Packages
You can download ML-Agents as Unity Packages:
* [ML-Agents with TensorflowSharp Plugin](https://s3.amazonaws.com/unity-ml-agents/0.3/ML-AgentsWithPlugin.unitypackage)
* [ML-Agents without TensorflowSharp Plugin](https://s3.amazonaws.com/unity-ml-agents/0.3/ML-AgentsNoPlugin.unitypackage)
* [TensorflowSharp Plugin Only](https://s3.amazonaws.com/unity-ml-agents/0.3/TFSharpPlugin.unitypackage)
You can download the [TensorFlowSharp](Background-TensorFlow.md#tensorflowsharp) plugin as a Unity package [here](https://s3.amazonaws.com/unity-ml-agents/0.3/TFSharpPlugin.unitypackage).
## Help

6
docs/localized/zh-CN/docs/Installation.md


## Unity 包
您可以通过 Unity 包的形式下载 ML-Agents:
* 带 TensorflowSharp 插件的 ML-Agents([AWS S3链接](https://s3.amazonaws.com/unity-ml-agents/0.3/ML-AgentsWithPlugin.unitypackage),[百度盘链接](https://pan.baidu.com/s/1qkWOqb0meyTorBG-So_PfA))
* 不带 TensorflowSharp 插件的 ML-Agents([AWS S3链接](https://s3.amazonaws.com/unity-ml-agents/0.3/ML-AgentsNoPlugin.unitypackage),[百度盘链接](https://pan.baidu.com/s/1K8fZFslW6PWNgmWA6oO4Yg))
* 仅包含 TensorflowSharp 插件([AWS S3链接](https://s3.amazonaws.com/unity-ml-agents/0.3/TFSharpPlugin.unitypackage),[百度盘链接](https://pan.baidu.com/s/1s0mJN8lvuxTcYbs2kL2FqA))
您可以通过 Unity 包的形式下载TensorflowSharp 插件([AWS S3链接](https://s3.amazonaws.com/unity-ml-agents/0.3/TFSharpPlugin.unitypackage),[百度盘链接](https://pan.baidu.com/s/1s0mJN8lvuxTcYbs2kL2FqA))
## 帮助

138
unity-environment/Assets/ML-Agents/Examples/Basic/Scene.unity


--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
serializedVersion: 8
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3

m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0

m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 1
m_LightmapEditorSettings:
serializedVersion: 10
serializedVersion: 9
m_AtlasSize: 1024
m_TextureWidth: 1024
m_TextureHeight: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1

m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ShowResolutionOverlay: 1
m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 1
--- !u!196 &4

debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!114 &37048259
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 943466ab374444748a364f9d6c3e2fe2, type: 3}
m_Name: (Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)
m_EditorClassIdentifier:
broadcast: 1
brain: {fileID: 0}
--- !u!1 &282272644
GameObject:
m_ObjectHideFlags: 0

m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_Materials:
- {fileID: 2100000, guid: 260483cdfc6b14e26823a02f23bd8baa, type: 2}
m_StaticBatchInfo:

vectorObservationSpaceType: 0
brainType: 0
CoreBrains:
- {fileID: 1986421907}
- {fileID: 37048259}
- {fileID: 2070181396}
- {fileID: 1399890765}
instanceID: 78800
- {fileID: 1458832067}
- {fileID: 1183791066}
- {fileID: 1066285776}
- {fileID: 977008778}
instanceID: 21298
--- !u!114 &977008778
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8b23992c8eb17439887f5e944bf04a40, type: 3}
m_Name: (Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)
m_EditorClassIdentifier:
broadcast: 1
graphModel: {fileID: 4900000, guid: 8786b6500d406497c959f24c2a8b59ac, type: 3}
graphScope:
graphPlaceholders: []
BatchSizePlaceholderName: batch_size
VectorObservationPlacholderName: vector_observation
RecurrentInPlaceholderName: recurrent_in
RecurrentOutPlaceholderName: recurrent_out
VisualObservationPlaceholderName: []
ActionPlaceholderName: action
PreviousActionPlaceholderName: prev_action
brain: {fileID: 846768605}
--- !u!1 &984725368
GameObject:
m_ObjectHideFlags: 0

m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_Materials:
- {fileID: 2100000, guid: 624b24bbec31f44babfb57ef2dfbc537, type: 2}
m_StaticBatchInfo:

m_Father: {fileID: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1066285776
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 35813a1be64e144f887d7d5f15b963fa, type: 3}
m_Name: (Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)
m_EditorClassIdentifier:
brain: {fileID: 846768605}
--- !u!1 &1178588871
GameObject:
m_ObjectHideFlags: 0

m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_Materials:
- {fileID: 2100000, guid: 624b24bbec31f44babfb57ef2dfbc537, type: 2}
m_StaticBatchInfo:

m_Father: {fileID: 0}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1399890765
--- !u!114 &1183791066
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}

m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8b23992c8eb17439887f5e944bf04a40, type: 3}
m_Name: (Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)
m_Script: {fileID: 11500000, guid: 943466ab374444748a364f9d6c3e2fe2, type: 3}
m_Name: (Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)
graphModel: {fileID: 4900000, guid: 07e40c2d0871b4e989b41d1b8519fb93, type: 3}
graphScope:
graphPlaceholders: []
BatchSizePlaceholderName: batch_size
VectorObservationPlacholderName: vector_observation
RecurrentInPlaceholderName: recurrent_in
RecurrentOutPlaceholderName: recurrent_out
VisualObservationPlaceholderName: []
ActionPlaceholderName: action
PreviousActionPlaceholderName: prev_action
brain: {fileID: 0}
--- !u!114 &1458832067
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 41e9bda8f3cf1492fa74926a530f6f70, type: 3}
m_Name: (Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)
m_EditorClassIdentifier:
broadcast: 1
continuousPlayerActions: []
discretePlayerActions:
- key: 97
value: 0
- key: 100
value: 1
defaultAction: -1
brain: {fileID: 846768605}
--- !u!1 &1574236047
GameObject:

m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1986421907
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 41e9bda8f3cf1492fa74926a530f6f70, type: 3}
m_Name: (Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)
m_EditorClassIdentifier:
broadcast: 1
continuousPlayerActions: []
discretePlayerActions:
- key: 97
value: 0
- key: 100
value: 1
defaultAction: -1
brain: {fileID: 846768605}
--- !u!114 &2070181396
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 35813a1be64e144f887d7d5f15b963fa, type: 3}
m_Name: (Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)(Clone)
m_EditorClassIdentifier:
brain: {fileID: 846768605}

42
unity-environment/Assets/ML-Agents/Examples/Basic/TFModels/Basic.bytes


?
state Placeholder*
L
vector_observation Placeholder*
dtype0*
shape: ���������
D

dtype0
?
ReshapeReshapestate Reshape/shape*
L
ReshapeReshapevector_observation Reshape/shape*
T0*
Tshape0
?

DstT0
F
OneHotEncoding/one_hot/depthConst*
value B:*
value B:*
dtype0
L
OneHotEncoding/one_hot/on_valueConst*

axis ���������*
T0*
TI0
�
dtype0*i
value`B^"P�>�H�>Uý=�Խ�, ?7��>.F��W�>�A�>9�Ӿ�ƪ>����7�=��>�|R�=��F��;[����=]��>E/��
dtype0*�
value� B� "� F� �/R�>Im?\��>�Zֽ��E�:㍾�6����ܾ�(�>O���>���(?��=v�>�,'>\�%?Q��ڧ��Ƶɾ[� ��0�>��F?:�s>��A?Y��>1Rv�A=)���Ͼ��b?Y|��96�c[�>�e>��>� �a0.?�z�p��X�8�“��]�v?��w>!;?e^?v�-?���ȹ�C���y�>�
`�w��XJ�>�5�=�Y4?r{$��>�і�9ା��������X?��H?��??��>K�O?�o��1�Rk���0�>T�߾�b �%��>n?i��>��(�2�?��߾x� �难𬾡�??��'?��-?�k>8�+?���}߾��ӾCJ?nþ签�R[6?�=?�?E @�.��>*�3�����00������2�>��>��>��?��,?.3-�);������~5?Rw��pR3����>�5?]�(?X�M�]��=�̅�r0B���7�����@?�U�>O?�M?�[?����:���V*����>�D���R-�t�;s�2>�T�>�z��Pt?�S8�������(����B,�>��}>Z)>P�Ž`w������s��D�� �>&&�����rz��d%1>�������fِ>X��=���;����s��4�=���>���Ϋ6���ֽ�J�hr=�d=>��n=�[*�lfս�f��ৗ����<Ȩ�> s7��bt�(O>�-�>�z�X�,>�!��E��H07>� ��(��`�i>�ͯ�T�>x(7=��?��?�>�.>�M����ؼ0��<�W]��:"��+�>PEy>ʀ�� �\�s�þ��þr��>@���`�������d����`�>�o�>0(T=����]H��mє���L>os�xMR���+=^�v����>�+��X������{Z�����=��8ꭾ��;�t:�=h*w>�{�=�9����> d���#�0��<uI>Ow>(�>�>˽0.">
�¾,?1��J�=���
�������j���:��>���>���� 4<B�j��K{�L�;>��@�ȒS>� ܽ�����>��6>���=����܏���P��H�
>��0�������=���=��1��=�>3��ws���t>���>��Z�d�Q>�)���p >F�¾TQ�li~�\6<>�*�=��G>ݤ=�L"'>P�>o럾%�>2����#2�� >p���t�>���>h�B=�>W�f�B�>��N��?�WW����=L���f�>�}�>pb�=�Z>�������>�۽
e�>��#�Hv�~g�>��>"Ӏ>�=k�4�d>$׈�>{�>?�=�9B>d<�=r��>�E=�T��>F+�>�脾�8C��擽0�'�8�� ���@�g���9�>J>٬0��ľv_�>6�Z�2��>_]b��.������KB��7���>���=�mܽ�mF>x#*�@;z�VxW�g�����'>������=a}>� ���s��v�>ܝ> )>P�>��>��l=��>��J�͌��4M~>��>X�ž�򏽰7�=po>D��=5�|�: ��T�>���<�{��T�u>����<]νRI��/��>�_�>tR>�����!��&��>X��>
U
dense/kernel/readIdentity dense/kernel*
T0*

transpose_a(*
transpose_b(*
T0
'
dense/EluElu dense/MatMul*
/
dense/SigmoidSigmoid dense/MatMul*
T0
6
dense/MulMul dense/MatMul dense/Sigmoid*
value�B�"�팼��?l=S����L�=��=)������=�J���� �sm�=ےս��>�>aQw��DܽJ��=݇����=Ū>�Ұ�Dn��Wv�=�>u���rlѽ">�O�=Q��&q���۵=��{=/�⽑S�=�S佦�̽���=r�ǽ.dz=6>V���
value�B�"����>q���� ��.?�����?"�t� ?�(���?IM ��$?|:�>�RܾÈ�>5�ؾ>K?���g��}"?=.&?6E!�3�?}��%h���E�>C?���> p��?��? ��hP��H �>5??b���g?��Yx ?���
[
dense_1/kernel/readIdentitydense_1/kernel*
T0*!

dense_2/MatMulMatMul dense/Eludense_1/kernel/read*
dense_2/MatMulMatMul dense/Muldense_1/kernel/read*
transpose_a(*
transpose_b(*
T0

dtype0

multinomial/Multinomial Multinomialdense_2/MatMul#multinomial/Multinomial/num_samples*
seed��*
seed20*
seed��2*
seed21*
T0
4
actionIdentitymultinomial/Multinomial*

dtype0*i
value`B^"PUi�>�I'��9��ؾx1��k��-r����E����>l����=�1f���u��x�R�t`��A������=x��XH>�X?
value`B^"P8i��-�*��,ս!'�>>�?��<;�Ӿ�zc>�<E���A�>�};�;��e}?�T�>�c=2I�>��̾U(><��
[
dense_2/kernel/readIdentitydense_2/kernel*
T0*!

dense_2/biasConst*
dtype0*
valueB*�>
valueB*��>
U
dense_2/bias/readIdentity dense_2/bias*
T0*

dense_3/MatMulMatMul dense/Eludense_2/kernel/read*
dense_3/MatMulMatMul dense/Muldense_2/kernel/read*
transpose_a(*
transpose_b(*
T0

4
unity-environment/Assets/ML-Agents/Examples/Basic/TFModels/Basic.bytes.meta


fileFormatVersion: 2
guid: 07e40c2d0871b4e989b41d1b8519fb93
guid: 8786b6500d406497c959f24c2a8b59ac
timeCreated: 1523662030
licenseType: Free
TextScriptImporter:
externalObjects: {}
userData:

48
unity-environment/Assets/ML-Agents/Scripts/CoreBrainInternal.cs


foreach (Agent agent in agentList)
{
List<float> state_list = agentInfo[agent].stackedVectorObservation;
for (int j = 0; j < brain.brainParameters.vectorObservationSize * brain.brainParameters.numStackedVectorObservations; j++)
for (int j = 0; j < stateLength * brain.brainParameters.numStackedVectorObservations; j++)
{
inputState[i, j] = state_list[j];
}

#endif
}
/// Contains logic to convert the agent's cameras into observation list
/// (as list of float arrays)
public static float[,,,] BatchVisualObservations(List<Texture2D> textures, bool BlackAndWhite)
/// <summary>
/// Converts a list of Texture2D into a Tensor.
/// </summary>
/// <returns>
/// A 4 dimensional float Tensor of dimension
/// [batch_size, height, width, channel].
/// Where batch_size is the number of input textures,
/// height corresponds to the height of the texture,
/// width corresponds to the width of the texture,
/// channel corresponds to the number of channels extracted from the
/// input textures (based on the input blackAndWhite flag
/// (3 if the flag is false, 1 otherwise).
/// The values of the Tensor are between 0 and 1.
/// </returns>
/// <param name="textures">
/// The list of textures to be put into the tensor.
/// Note that the textures must have same width and height.
/// </param>
/// <param name="blackAndWhite">
/// If set to <c>true</c> the textures
/// will be converted to grayscale before being stored in the tensor.
/// </param>
public static float[,,,] BatchVisualObservations(
List<Texture2D> textures, bool blackAndWhite)
if (BlackAndWhite)
if (blackAndWhite)
pixels = 1;
else
pixels = 3;

for (int h = 0; h < height; h++)
{
Color32 currentPixel = cc[h * width + w];
if (!BlackAndWhite)
if (!blackAndWhite)
result[b, textures[b].height - h - 1, w, 0] = currentPixel.r;
result[b, textures[b].height - h - 1, w, 1] = currentPixel.g;
result[b, textures[b].height - h - 1, w, 2] = currentPixel.b;
// For Color32, the r, g and b values are between
// 0 and 255.
result[b, textures[b].height - h - 1, w, 0] =
currentPixel.r / 255.0f;
result[b, textures[b].height - h - 1, w, 1] =
currentPixel.g / 255.0f;
result[b, textures[b].height - h - 1, w, 2] =
currentPixel.b / 255.0f;
result[b, textures[b].height - h - 1, w, 0] = (currentPixel.r + currentPixel.g + currentPixel.b) / 3;
result[b, textures[b].height - h - 1, w, 0] =
(currentPixel.r + currentPixel.g + currentPixel.b)
/ 3;
}
}
}

正在加载...
取消
保存