浏览代码

vis obs perf repro

/repro-vis-obs-perf
Chris Elion 4 年前
当前提交
1038d4de
共有 12 个文件被更改,包括 2263 次插入0 次删除
  1. 1
      Project/Packages/manifest.json
  2. 10
      Project/ProjectSettings/ProjectSettings.asset
  3. 8
      Project/Assets/ML-Agents/Examples/CamTest.meta
  4. 1001
      Project/Assets/ML-Agents/Examples/CamTest/CamTest.onnx
  5. 15
      Project/Assets/ML-Agents/Examples/CamTest/CamTest.onnx.meta
  6. 1001
      Project/Assets/ML-Agents/Examples/CamTest/CamTest.unity
  7. 7
      Project/Assets/ML-Agents/Examples/CamTest/CamTest.unity.meta
  8. 115
      Project/Assets/ML-Agents/Examples/CamTest/CamTestAgent.prefab
  9. 7
      Project/Assets/ML-Agents/Examples/CamTest/CamTestAgent.prefab.meta
  10. 87
      Project/Assets/ML-Agents/Examples/CamTest/TestDecisionRequester.cs
  11. 11
      Project/Assets/ML-Agents/Examples/CamTest/TestDecisionRequester.cs.meta

1
Project/Packages/manifest.json


"dependencies": {
"com.unity.ads": "2.0.8",
"com.unity.analytics": "3.2.3",
"com.unity.barracuda": "1.3.1-preview",
"com.unity.collab-proxy": "1.2.15",
"com.unity.ml-agents": "file:../../com.unity.ml-agents",
"com.unity.ml-agents.extensions": "file:../../com.unity.ml-agents.extensions",

10
Project/ProjectSettings/ProjectSettings.asset


switchNVNShaderPoolsGranularity: 33554432
switchNVNDefaultPoolsGranularity: 16777216
switchNVNOtherPoolsGranularity: 16777216
switchNVNMaxPublicTextureIDCount: 0
switchNVNMaxPublicSamplerIDCount: 0
vulkanEnableSetSRGBWrite: 0
m_SupportedAspectRatios:
4:3: 1

metalEditorSupport: 1
metalAPIValidation: 1
iOSRenderExtraFrameOnPause: 1
iosCopyPluginsCodeInsteadOfSymlink: 0
appleDeveloperTeamID:
iOSManualSigningProvisioningProfileID:
tvOSManualSigningProvisioningProfileID:

switchTitleNames_12:
switchTitleNames_13:
switchTitleNames_14:
switchTitleNames_15:
switchPublisherNames_0:
switchPublisherNames_1:
switchPublisherNames_2:

switchPublisherNames_12:
switchPublisherNames_13:
switchPublisherNames_14:
switchPublisherNames_15:
switchIcons_0: {fileID: 0}
switchIcons_1: {fileID: 0}
switchIcons_2: {fileID: 0}

switchIcons_12: {fileID: 0}
switchIcons_13: {fileID: 0}
switchIcons_14: {fileID: 0}
switchIcons_15: {fileID: 0}
switchSmallIcons_0: {fileID: 0}
switchSmallIcons_1: {fileID: 0}
switchSmallIcons_2: {fileID: 0}

switchSmallIcons_12: {fileID: 0}
switchSmallIcons_13: {fileID: 0}
switchSmallIcons_14: {fileID: 0}
switchSmallIcons_15: {fileID: 0}
switchManualHTML:
switchAccessibleURLs:
switchLegalInformation:

ps4ShareFilePath:
ps4ShareOverlayImagePath:
ps4PrivacyGuardImagePath:
ps4ExtraSceSysFile:
ps4NPtitleDatPath:
ps4RemotePlayKeyAssignment: -1
ps4RemotePlayKeyMappingDir:

ps4disableAutoHideSplash: 0
ps4videoRecordingFeaturesUsed: 0
ps4contentSearchFeaturesUsed: 0
ps4CompatibilityPS5: 0
ps4GPU800MHz: 1
ps4attribEyeToEyeDistanceSettingVR: 0
ps4IncludedModules: []
monoEnv:

8
Project/Assets/ML-Agents/Examples/CamTest.meta


fileFormatVersion: 2
guid: f6a0bb0d122954d2e88e2d97563afd76
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

1001
Project/Assets/ML-Agents/Examples/CamTest/CamTest.onnx
文件差异内容过多而无法显示
查看文件

15
Project/Assets/ML-Agents/Examples/CamTest/CamTest.onnx.meta


fileFormatVersion: 2
guid: c77af5fc4b2154a66ab6a02e05e178f5
ScriptedImporter:
fileIDToRecycleName:
11400000: main obj
11400002: model data
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 683b6cb6d0a474744822c888b46772c9, type: 3}
optimizeModel: 1
forceArbitraryBatchSize: 1
treatErrorsAsWarnings: 0
importMode: 1

1001
Project/Assets/ML-Agents/Examples/CamTest/CamTest.unity
文件差异内容过多而无法显示
查看文件

7
Project/Assets/ML-Agents/Examples/CamTest/CamTest.unity.meta


fileFormatVersion: 2
guid: 10a5cc455accc4fc9be1f3f32b636be8
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

115
Project/Assets/ML-Agents/Examples/CamTest/CamTestAgent.prefab


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &5980327471525392170
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5980327471525392342}
- component: {fileID: 5980327471525392169}
- component: {fileID: 5980327471525392168}
- component: {fileID: 5980327471525392171}
- component: {fileID: 5980327471525392343}
m_Layer: 0
m_Name: CamTestAgent
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5980327471525392342
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5980327471525392170}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &5980327471525392169
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5980327471525392170}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5d1c4e0b1822b495aa52bc52839ecb30, type: 3}
m_Name:
m_EditorClassIdentifier:
m_BrainParameters:
VectorObservationSize: 0
NumStackedVectorObservations: 1
m_ActionSpec:
m_NumContinuousActions: 1
BranchSizes:
VectorActionSize: 01000000
VectorActionDescriptions: []
VectorActionSpaceType: 1
hasUpgradedBrainParametersWithActionSpec: 1
m_Model: {fileID: 11400000, guid: c77af5fc4b2154a66ab6a02e05e178f5, type: 3}
m_InferenceDevice: 2
m_BehaviorType: 0
m_BehaviorName: My Behavior
TeamId: 0
m_UseChildSensors: 1
m_UseChildActuators: 1
m_ObservableAttributeHandling: 0
--- !u!114 &5980327471525392168
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5980327471525392170}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 88b6042bc9a5d4aa58d931eae49442e5, type: 3}
m_Name:
m_EditorClassIdentifier:
agentParameters:
maxStep: 0
hasUpgradedFromAgentParameters: 1
MaxStep: 0
--- !u!114 &5980327471525392171
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5980327471525392170}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 282f342c2ab144bf38be65d4d0c4e07d, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Camera: {fileID: 0}
m_SensorName: CameraSensor
m_Width: 84
m_Height: 84
m_Grayscale: 0
m_ObservationStacks: 1
m_Compression: 1
--- !u!114 &5980327471525392343
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5980327471525392170}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3a5c9d521e5ef4759a8246a07d52221e, type: 3}
m_Name:
m_EditorClassIdentifier:
DecisionPeriod: 5
TakeActionsBetweenDecisions: 1

7
Project/Assets/ML-Agents/Examples/CamTest/CamTestAgent.prefab.meta


fileFormatVersion: 2
guid: 6b632162d3b5b4dc9a5eacac08ebc1c4
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

87
Project/Assets/ML-Agents/Examples/CamTest/TestDecisionRequester.cs


using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Unity.MLAgents;
public class TestDecisionRequester : MonoBehaviour
{
public enum SteppingMode
{
StepAllAgentsEvery5Frames = 0,
Step2AgentsEachFrame = 1
}
public SteppingMode Mode = SteppingMode.StepAllAgentsEvery5Frames;
private int StepCount = 0;
private Agent[] m_Agents;
private double[] m_RunningAverageMs = new double[2];
private int[] m_RunningCount = new int[2];
static double s_TicksToMilliseconds = 1e-4; // 100 ns per tick
private void Awake()
{
m_Agents = FindObjectsOfType<Agent>();
Academy.Instance.AutomaticSteppingEnabled = false;
}
private void FixedUpdate()
{
if (Mode == SteppingMode.StepAllAgentsEvery5Frames)
{
if ((StepCount % 5) == 0)
{
for (var i = 0; i < m_Agents.Length; i++)
{
m_Agents[i].RequestDecision();
}
}
}
else
{
for (var i = 0; i < m_Agents.Length; i++)
{
if (i % 5 == StepCount % 5)
{
m_Agents[i].RequestDecision();
}
}
}
var startTicks = DateTime.Now.Ticks;
Academy.Instance.EnvironmentStep();
var afterTicks = DateTime.Now.Ticks;
// Update
{
var elapsedMs = s_TicksToMilliseconds * (afterTicks - startTicks);
m_RunningCount[(int)Mode]++;
if (m_RunningCount[(int)Mode] == 1)
{
m_RunningAverageMs[(int)Mode] = elapsedMs;
}
else
{
m_RunningAverageMs[(int)Mode] = m_RunningAverageMs[(int)Mode] + (elapsedMs - m_RunningAverageMs[(int)Mode]) / m_RunningCount[(int)Mode];
}
}
StepCount++;
if (StepCount % 1000 == 0)
{
// Switch mode
Mode = (Mode == SteppingMode.StepAllAgentsEvery5Frames)
? SteppingMode.Step2AgentsEachFrame
: SteppingMode.StepAllAgentsEvery5Frames;
Debug.Log($"Average Academy Step:" +
$"\n\tStep2AgentsEachFrame: {m_RunningAverageMs[(int)SteppingMode.Step2AgentsEachFrame]} ms" +
$"\n\tStepAllAgentsEvery5Frames: {m_RunningAverageMs[(int)SteppingMode.StepAllAgentsEvery5Frames]} ms"
);
}
}
}

11
Project/Assets/ML-Agents/Examples/CamTest/TestDecisionRequester.cs.meta


fileFormatVersion: 2
guid: 7ab2c1d17d3484b3aac5381badc3acf6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存