浏览代码

Merge branch 'manual_capture_2' of github.com:Unity-Technologies/com.unity.perception into manual_capture_2

/manual_capture
Mohsen Kamalzadeh 4 年前
当前提交
d81888fd
共有 9 个文件被更改,包括 230 次插入25 次删除
  1. 21
      TestProjects/PerceptionHDRP/Packages/packages-lock.json
  2. 63
      TestProjects/PerceptionURP/Assets/Scenes/SampleScene.unity
  3. 21
      TestProjects/PerceptionURP/Packages/packages-lock.json
  4. 1
      com.unity.perception/CHANGELOG.md
  5. 19
      com.unity.perception/Editor/GroundTruth/PerceptionCameraEditor.cs
  6. 24
      com.unity.perception/Editor/Randomization/Editors/RunInUnitySimulationWindow.cs
  7. 4
      com.unity.perception/Runtime/GroundTruth/SimulationState.cs
  8. 99
      com.unity.perception/Editor/Randomization/Editors/PerceptionEditorAnalytics.cs
  9. 3
      com.unity.perception/Editor/Randomization/Editors/PerceptionEditorAnalytics.cs.meta

21
TestProjects/PerceptionHDRP/Packages/packages-lock.json


{
"dependencies": {
"com.unity.burst": {
"version": "1.3.0-preview.5",
"depth": 2,
"version": "1.3.9",
"depth": 1,
"com.unity.mathematics": "1.1.0"
"com.unity.mathematics": "1.2.1"
},
"url": "https://packages.unity.com"
},

"url": "https://packages.unity.com"
},
"com.unity.mathematics": {
"version": "1.1.0",
"version": "1.2.1",
"depth": 2,
"source": "registry",
"dependencies": {},

"dependencies": {
"com.unity.nuget.newtonsoft-json": "1.1.2",
"com.unity.render-pipelines.core": "7.1.6",
"com.unity.burst": "1.3.9",
"com.unity.simulation.capture": "0.0.10-preview.13",
"com.unity.simulation.core": "0.0.10-preview.19"
"com.unity.simulation.capture": "0.0.10-preview.14",
"com.unity.simulation.core": "0.0.10-preview.20"
}
},
"com.unity.platforms": {

"url": "https://packages.unity.com"
},
"com.unity.simulation.capture": {
"version": "0.0.10-preview.13",
"depth": 0,
"version": "0.0.10-preview.14",
"depth": 1,
"source": "registry",
"dependencies": {
"com.unity.simulation.core": "0.0.10-preview.19"

"url": "https://packages.unity.com"
},
"com.unity.simulation.core": {
"version": "0.0.10-preview.19",
"depth": 0,
"version": "0.0.10-preview.20",
"depth": 1,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.com"

63
TestProjects/PerceptionURP/Assets/Scenes/SampleScene.unity


m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 0
m_UseShadowmask: 1
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2

debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &85886256
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 85886258}
- component: {fileID: 85886257}
m_Layer: 0
m_Name: Scenario
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &85886257
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 85886256}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d50076aff0af4515b4422166496fdd5e, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Randomizers: []
quitOnComplete: 1
serializedConstantsFileName: constants
constants:
totalIterations: 100
instanceCount: 1
instanceIndex: 0
framesPerIteration: 1
references:
version: 1
--- !u!4 &85886258
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 85886256}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 107.21, y: 72.77, z: -144.12}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &411238276
GameObject:
m_ObjectHideFlags: 0

m_EditorClassIdentifier:
labels:
- Crate
useAutoLabeling: 0
autoLabelingSchemeType:
--- !u!65 &411238278
BoxCollider:
m_ObjectHideFlags: 0

m_EditorClassIdentifier:
labels:
- Cube
useAutoLabeling: 0
autoLabelingSchemeType:
--- !u!65 &934158984
BoxCollider:
m_ObjectHideFlags: 0

m_EditorClassIdentifier:
labels:
- Box
useAutoLabeling: 0
autoLabelingSchemeType:
--- !u!65 &1640252280
BoxCollider:
m_ObjectHideFlags: 0

m_EditorClassIdentifier:
labels:
- Terrain
useAutoLabeling: 0
autoLabelingSchemeType:

21
TestProjects/PerceptionURP/Packages/packages-lock.json


{
"dependencies": {
"com.unity.burst": {
"version": "1.3.0-preview.5",
"depth": 2,
"version": "1.3.9",
"depth": 1,
"com.unity.mathematics": "1.1.0"
"com.unity.mathematics": "1.2.1"
},
"url": "https://packages.unity.com"
},

"url": "https://packages.unity.com"
},
"com.unity.mathematics": {
"version": "1.1.0",
"version": "1.2.1",
"depth": 2,
"source": "registry",
"dependencies": {},

"dependencies": {
"com.unity.nuget.newtonsoft-json": "1.1.2",
"com.unity.render-pipelines.core": "7.1.6",
"com.unity.burst": "1.3.9",
"com.unity.simulation.capture": "0.0.10-preview.13",
"com.unity.simulation.core": "0.0.10-preview.19"
"com.unity.simulation.capture": "0.0.10-preview.14",
"com.unity.simulation.core": "0.0.10-preview.20"
}
},
"com.unity.platforms": {

"url": "https://packages.unity.com"
},
"com.unity.simulation.capture": {
"version": "0.0.10-preview.13",
"depth": 0,
"version": "0.0.10-preview.14",
"depth": 1,
"source": "registry",
"dependencies": {
"com.unity.simulation.core": "0.0.10-preview.19"

"url": "https://packages.unity.com"
},
"com.unity.simulation.core": {
"version": "0.0.10-preview.19",
"depth": 0,
"version": "0.0.10-preview.20",
"depth": 1,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.com"

1
com.unity.perception/CHANGELOG.md


### Added
Added support for labeling Terrain objects. Trees and details are not labeled but will occlude other objects.
Added analytics for Unity Simulation runs
Added instance segmentation labeler.

19
com.unity.perception/Editor/GroundTruth/PerceptionCameraEditor.cs


m_LabelersList.DoLayoutList();
}
var dir = PlayerPrefs.GetString(SimulationState.latestOutputDirectoryKey, string.Empty);
if (dir != string.Empty)
{
EditorGUILayout.LabelField("Latest Output Folder");
GUILayout.BeginVertical("TextArea");
EditorGUILayout.HelpBox(dir, MessageType.None);
GUILayout.BeginHorizontal();
if (GUILayout.Button("Show Folder"))
{
EditorUtility.RevealInFinder(dir);
}
if (GUILayout.Button("Copy Path"))
{
GUIUtility.systemCopyBuffer = dir;
}
GUILayout.EndHorizontal();
GUILayout.EndVertical();
}
if (EditorSettings.asyncShaderCompilation)
{
EditorGUILayout.HelpBox("Asynchronous shader compilation may result in invalid data in beginning frames. " +

24
com.unity.perception/Editor/Randomization/Editors/RunInUnitySimulationWindow.cs


async void RunInUnitySimulation()
{
ValidateSettings();
CreateLinuxBuildAndZip();
await StartUnitySimulationRun();
var runGuid = Guid.NewGuid();
PerceptionEditorAnalytics.ReportRunInUnitySimulationStarted(
runGuid,
m_TotalIterationsField.value,
m_InstanceCountField.value,
existingBuildId: null);
try
{
ValidateSettings();
CreateLinuxBuildAndZip();
await StartUnitySimulationRun(runGuid);
}
catch (Exception e)
{
PerceptionEditorAnalytics.ReportRunInUnitySimulationFailed(runGuid, e.Message);
throw;
}
}
void ValidateSettings()

return appParamIds;
}
async Task StartUnitySimulationRun()
async Task StartUnitySimulationRun(Guid runGuid)
{
m_RunButton.SetEnabled(false);
var cancellationTokenSource = new CancellationTokenSource();

cancellationTokenSource.Dispose();
Debug.Log($"Executing run: {run.executionId}");
m_RunButton.SetEnabled(true);
PerceptionEditorAnalytics.ReportRunInUnitySimulationSucceeded(runGuid, run.executionId);
}
}
}

4
com.unity.perception/Runtime/GroundTruth/SimulationState.cs


float m_LastTimeScale;
readonly string m_OutputDirectoryName;
string m_OutputDirectoryPath;
public const string latestOutputDirectoryKey = "latestOutputDirectory";
JsonSerializer m_AnnotationSerializer;
public bool IsRunning { get; private set; }

m_AnnotationSerializer.Converters.Add(new Vector3Converter());
m_AnnotationSerializer.Converters.Add(new QuaternionConverter());
m_OutputDirectoryName = outputDirectory;
PlayerPrefs.SetString(latestOutputDirectoryKey, Manager.Instance.GetDirectoryFor("",""));
IsRunning = true;
}

99
com.unity.perception/Editor/Randomization/Editors/PerceptionEditorAnalytics.cs


using System;
using JetBrains.Annotations;
using UnityEditor;
using UnityEngine.Analytics;
namespace UnityEngine.Perception.Randomization.Editor
{
static class PerceptionEditorAnalytics
{
static int k_MaxItems = 100;
static int k_MaxEventsPerHour = 100;
const string k_VendorKey = "unity.perception";
const string k_RunInUnitySimulationName = "runinunitysimulation";
static bool s_IsRegistered = false;
static bool TryRegisterEvents()
{
if (s_IsRegistered)
return true;
bool success = true;
success &= EditorAnalytics.RegisterEventWithLimit(k_RunInUnitySimulationName, k_MaxEventsPerHour, k_MaxItems,
k_VendorKey) == AnalyticsResult.Ok;
s_IsRegistered = success;
return success;
}
enum RunStatus
{
Started,
Failed,
Succeeded
}
struct RunInUnitySimulationData
{
[UsedImplicitly]
public string runId;
[UsedImplicitly]
public int totalIterations;
[UsedImplicitly]
public int instanceCount;
[UsedImplicitly]
public string existingBuildId;
[UsedImplicitly]
public string errorMessage;
[UsedImplicitly]
public string runExecutionId;
[UsedImplicitly]
public string runStatus;
}
public static void ReportRunInUnitySimulationStarted(Guid runId, int totalIterations, int instanceCount, string existingBuildId)
{
if (!TryRegisterEvents())
return;
var data = new RunInUnitySimulationData()
{
runId = runId.ToString(),
totalIterations = totalIterations,
instanceCount = instanceCount,
existingBuildId = existingBuildId,
runStatus = RunStatus.Started.ToString()
};
EditorAnalytics.SendEventWithLimit(k_RunInUnitySimulationName, data);
}
public static void ReportRunInUnitySimulationFailed(Guid runId, string errorMessage)
{
if (!TryRegisterEvents())
return;
var data = new RunInUnitySimulationData()
{
runId = runId.ToString(),
errorMessage = errorMessage,
runStatus = RunStatus.Failed.ToString()
};
EditorAnalytics.SendEventWithLimit(k_RunInUnitySimulationName, data);
}
public static void ReportRunInUnitySimulationSucceeded(Guid runId, string runExecutionId)
{
if (!TryRegisterEvents())
return;
var data = new RunInUnitySimulationData()
{
runId = runId.ToString(),
runExecutionId = runExecutionId,
runStatus = RunStatus.Succeeded.ToString()
};
EditorAnalytics.SendEventWithLimit(k_RunInUnitySimulationName, data);
}
}
}

3
com.unity.perception/Editor/Randomization/Editors/PerceptionEditorAnalytics.cs.meta


fileFormatVersion: 2
guid: 3216e9e700a34acc8ac808ffccb8297c
timeCreated: 1607709612
正在加载...
取消
保存