浏览代码

Merge branch 'master' into tutorial_updates_nov2020rel

/main
GitHub 4 年前
当前提交
12e2f513
共有 60 个文件被更改,包括 919 次插入222 次删除
  1. 30
      .yamato/environments.yml
  2. 35
      .yamato/upm-ci-full.yml
  3. 8
      .yamato/upm-ci-testprojects.yml
  4. 8
      com.unity.perception/CHANGELOG.md
  5. 5
      com.unity.perception/Documentation~/Randomization/Scenarios.md
  6. 29
      com.unity.perception/Editor/AssetPreparation/AssetPreparationTools.cs
  7. 14
      com.unity.perception/Editor/Randomization/Editors.meta
  8. 17
      com.unity.perception/Editor/Randomization/Editors/ScenarioBaseEditor.cs.meta
  9. 14
      com.unity.perception/Editor/Randomization/PropertyDrawers.meta
  10. 17
      com.unity.perception/Editor/Randomization/PropertyDrawers/ColorHsvaDrawer.cs.meta
  11. 17
      com.unity.perception/Editor/Randomization/PropertyDrawers/ParameterDrawer.cs.meta
  12. 12
      com.unity.perception/Editor/Randomization/StaticData.cs.meta
  13. 9
      com.unity.perception/Editor/Randomization/Uss.meta
  14. 9
      com.unity.perception/Editor/Randomization/Uxml.meta
  15. 16
      com.unity.perception/Editor/Randomization/Uxml/Parameter/ParameterDrawer.uxml.meta
  16. 14
      com.unity.perception/Editor/Randomization/VisualElements.meta
  17. 9
      com.unity.perception/Editor/Randomization/VisualElements/Parameter.meta
  18. 17
      com.unity.perception/Editor/Randomization/VisualElements/Parameter/CategoricalOptionElement.cs.meta
  19. 17
      com.unity.perception/Editor/Randomization/VisualElements/Parameter/ColorHsvaField.cs.meta
  20. 17
      com.unity.perception/Editor/Randomization/VisualElements/Parameter/DrawerParameterElement.cs.meta
  21. 17
      com.unity.perception/Editor/Randomization/VisualElements/Parameter/ParameterElement.cs.meta
  22. 9
      com.unity.perception/Editor/Randomization/VisualElements/Randomizer.meta
  23. 12
      com.unity.perception/Editor/Randomization/VisualElements/Randomizer/AddRandomizerMenu.cs.meta
  24. 12
      com.unity.perception/Editor/Randomization/VisualElements/Randomizer/RandomizerElement.cs.meta
  25. 11
      com.unity.perception/Editor/Randomization/VisualElements/Randomizer/RandomizerList.cs
  26. 12
      com.unity.perception/Editor/Randomization/VisualElements/Randomizer/RandomizerList.cs.meta
  27. 13
      com.unity.perception/Editor/Randomization/VisualElements/Randomizer/RandomizerReorderingIndicator.cs.meta
  28. 9
      com.unity.perception/Editor/Randomization/VisualElements/Sampler.meta
  29. 17
      com.unity.perception/Editor/Randomization/VisualElements/Sampler/FloatRangeElement.cs.meta
  30. 17
      com.unity.perception/Editor/Randomization/VisualElements/Sampler/RandomSeedField.cs.meta
  31. 17
      com.unity.perception/Editor/Randomization/VisualElements/Sampler/SamplerElement.cs.meta
  32. 1
      com.unity.perception/Runtime/AssemblyInfo.cs
  33. 4
      com.unity.perception/Runtime/GroundTruth/InstanceIdToColorMapping.cs
  34. 82
      com.unity.perception/Runtime/GroundTruth/Labelers/BoundingBox3DLabeler.cs
  35. 21
      com.unity.perception/Runtime/GroundTruth/SimulationState.cs
  36. 14
      com.unity.perception/Runtime/Randomization/Parameters/ParameterTypes/NumericParameters/ColorParameters.meta
  37. 14
      com.unity.perception/Runtime/Randomization/Randomizers.meta
  38. 12
      com.unity.perception/Tests/Runtime/GroundTruthTests/DatasetCaptureTests.cs
  39. 14
      com.unity.perception/Tests/Runtime/Randomization/RandomizerTests.meta
  40. 4
      com.unity.perception/package.json
  41. 83
      .yamato/upm-ci-performance.yml
  42. 8
      TestProjects/PerceptionURP/Assets/StreamingAssets.meta
  43. 8
      com.unity.perception/Tests/Performance.meta
  44. 25
      com.unity.perception/Tests/Performance/PerformanceTestAllLabelers.cs
  45. 3
      com.unity.perception/Tests/Performance/PerformanceTestAllLabelers.cs.meta
  46. 24
      com.unity.perception/Tests/Performance/PerformanceTestBoundingBoxLabeler.cs
  47. 3
      com.unity.perception/Tests/Performance/PerformanceTestBoundingBoxLabeler.cs.meta
  48. 24
      com.unity.perception/Tests/Performance/PerformanceTestObjectCountLabeler.cs
  49. 3
      com.unity.perception/Tests/Performance/PerformanceTestObjectCountLabeler.cs.meta
  50. 22
      com.unity.perception/Tests/Performance/PerformanceTestPixelCountLabeler.cs
  51. 3
      com.unity.perception/Tests/Performance/PerformanceTestPixelCountLabeler.cs.meta
  52. 22
      com.unity.perception/Tests/Performance/PerformanceTestSemanticSegmentationLabeler.cs
  53. 3
      com.unity.perception/Tests/Performance/PerformanceTestSemanticSegmentationLabeler.cs.meta
  54. 139
      com.unity.perception/Tests/Performance/PerformanceTester.cs
  55. 11
      com.unity.perception/Tests/Performance/PerformanceTester.cs.meta
  56. 101
      com.unity.perception/Tests/Performance/TestHelper.cs
  57. 3
      com.unity.perception/Tests/Performance/TestHelper.cs.meta
  58. 23
      com.unity.perception/Tests/Performance/Unity.Perception.Performance.Tests.asmdef
  59. 7
      com.unity.perception/Tests/Performance/Unity.Perception.Performance.Tests.asmdef.meta

30
.yamato/environments.yml


per_commit_editors:
- version: 2019.4.6f1
# - version: 2020.1.15f1
performance_editors:
- version: 2019.4.6f1
- version: 2020.1.3f1
# - version: 2020.1.3f1
# - version: 2020.1.15f1
# - version: 2020.2.0a21
publish_platforms:

image: package-ci/ubuntu:latest
flavor: b1.large
performance_platforms:
- name: win
type: Unity::VM
image: package-ci/win10:stable
flavor: b1.large
extra-args: --force-d3d11
standalone-platform: StandaloneWindows64
- name: mac
type: Unity::VM::osx
image: package-ci/mac:stable
flavor: m1.mac
extra-args: --force-metal
standalone-platform: StandaloneOSX
- name: ubuntu
type: Unity::VM
image: package-ci/ubuntu:latest
flavor: b1.large
performance_suites:
- name: standalone
display_name: standalone
args: --suite=playmode --platform=
suites:
- name: standalone
display_name: standalone

35
.yamato/upm-ci-full.yml


- .yamato/upm-ci-testprojects.yml#{{project.name}}_linux_editmode_{{editor.version}}
{% endfor %}
{% endfor %}
{% for editor in complete_editors %}
{% for project in projects %}
- .yamato/upm-ci-performance.yml#{{project.name}}_windows_standalone_{{editor.version}}
- .yamato/upm-ci-performance.yml#{{project.name}}_linux_standalone_{{editor.version}}
{% endfor %}
{% endfor %}
all_tests_nightly_perf:
name: Nightly Performance Tests
agent:
type: Unity::VM
image: package-ci/win10:stable
flavor: b1.small
commands:
- dir
triggers:
recurring:
- branch: performance_testing
frequency: daily
cancel_old_ci: true
artifacts:
logs:
paths:
- "upm-ci~/test-results/**/*"
packages:
paths:
- "upm-ci~/packages/**/*"
dependencies:
{% for editor in performance_editors %}
{% for project in projects %}
- .yamato/upm-ci-performance.yml#{{project.name}}_windows_standalone_{{editor.version}}
- .yamato/upm-ci-performance.yml#{{project.name}}_linux_standalone_{{editor.version}}
{% endfor %}
{% endfor %}

8
.yamato/upm-ci-testprojects.yml


- pip install unity-downloader-cli --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple --upgrade
- unity-downloader-cli -u {{ editor.version }} -c editor -c StandaloneSupport-IL2CPP -c Linux --wait --published
{% if suite.name == "standalone" %}
- utr/utr --testproject=./TestProjects/{{project.name}} --editor-location=./.Editor --artifacts_path=test-results --stdout-filter=minimal --extra-editor-arg="--force-d3d11" {{suite.args}}StandaloneWindows64
- utr/utr --testproject=./TestProjects/{{project.name}} --editor-location=./.Editor --reruncount=2 --artifacts_path=test-results --stdout-filter=minimal --extra-editor-arg="--force-d3d11" {{suite.args}}StandaloneWindows64
- utr/utr --testproject=./TestProjects/{{project.name}} --editor-location=./.Editor --artifacts_path=test-results --stdout-filter=minimal --extra-editor-arg="--force-d3d11" {{suite.args}}
- utr/utr --testproject=./TestProjects/{{project.name}} --editor-location=./.Editor --reruncount=2 --artifacts_path=test-results --stdout-filter=minimal --extra-editor-arg="--force-d3d11" {{suite.args}}
{% endif %}
artifacts:
logs:

- git clone git@github.cds.internal.unity3d.com:unity/utr.git utr
- unity-downloader-cli -u {{ editor.version }} -c editor -c StandaloneSupport-IL2CPP -c Linux --wait --published
{% if suite.name == "standalone" %}
- DISPLAY=:0.0 utr/utr --testproject=./TestProjects/{{project.name}} --editor-location=.Editor --artifacts_path=test-results --stdout-filter=minimal --extra-editor-arg="--force-vulkan" {{suite.args}}StandaloneLinux64
- DISPLAY=:0.0 utr/utr --testproject=./TestProjects/{{project.name}} --editor-location=.Editor --reruncount=2 --artifacts_path=test-results --stdout-filter=minimal --extra-editor-arg="--force-vulkan" {{suite.args}}StandaloneLinux64
- DISPLAY=:0.0 utr/utr --testproject=./TestProjects/{{project.name}} --editor-location=.Editor --artifacts_path=test-results --stdout-filter=minimal --extra-editor-arg="--force-vulkan" {{suite.args}}
- DISPLAY=:0.0 utr/utr --testproject=./TestProjects/{{project.name}} --editor-location=.Editor --reruncount=2 --artifacts_path=test-results --stdout-filter=minimal --extra-editor-arg="--force-vulkan" {{suite.args}}
{% endif %}
artifacts:
logs:

8
com.unity.perception/CHANGELOG.md


The GenerateRandomSeedFromIndex method now correctly hashes the current scenario iteration into the random seed it generates
Corrupted .meta files have been rebuilt and replaced
The randomizer list inspector UI now updates appropriately when a user clicks undo
## [0.5.0-preview.1] - 2020-10-14
### Known Issues

Added Randomizers and RandomizerTags
Added support for generating 3D bounding box ground truth data
Added performance test framework
Added nightly performance tests
### Changed

5
com.unity.perception/Documentation~/Randomization/Scenarios.md


2. Make sure to include the [Serializable] attribute on a constant class. This will ensure that the constants can be manipulated from the Unity inspector.
3. By default, UnityEngine.Object class references cannot be serialized to JSON in a meaningful way. This includes Monobehaviors and SerializedObjects. For more information on what can and can't be serialized, take a look at the [Unity JsonUtility manual](https://docs.unity3d.com/ScriptReference/JsonUtility.html).
4. A scenario class's Serialize() and Deserialized() methods can be overriden to implement custom serialization strategies.
Follow the instructions below to generate a constants configuration file to modify your scenario constants in a built player:
1. Click the serialize constants button in the scenario's inspector window. This will generate a constants.json file and place it in the project's Assets/StreamingAssets folder.
2. Build your player. The new player will have a [ProjectName]_Data/StreamingAssets folder. A copy of the constants.json file previously constructed in the editor will be found in this folder.
3. Change the contents of the constants file. Any running player thereafter will utilize the newly authored constants values.

29
com.unity.perception/Editor/AssetPreparation/AssetPreparationTools.cs


using System.IO;
using System.IO;
class AssetPreparationTools
static class AssetPreparationMenuItems
class AssetPreparationMenuFunctions : MonoBehaviour
/// <summary>
/// Function for creating prefabs from multiple models with one click. Created prefabs will be placed in the same folder as their corresponding model.
/// </summary>
[MenuItem("Assets/Perception/Create Prefabs from Selected Models")]
static void CreatePrefabsFromSelectedModels()
/// <summary>
/// Function for creating prefabs from multiple models with one click. Created prefabs will be placed in the same folder as their corresponding model.
/// </summary>
[MenuItem("Assets/Perception/Create Prefabs from Selected Models")]
static void CreatePrefabsFromSelectedModels()
foreach (var selection in Selection.gameObjects)
foreach (var selection in Selection.gameObjects)
{
var path = AssetDatabase.GetAssetPath(selection);
var tmpGameObject = Instantiate(selection);
var destinationPath = Path.GetDirectoryName(path) + "/" + selection.name + ".prefab";
PrefabUtility.SaveAsPrefabAsset(tmpGameObject, destinationPath);
DestroyImmediate(tmpGameObject);
}
var path = AssetDatabase.GetAssetPath(selection);
var tmpGameObject = Object.Instantiate(selection);
var destinationPath = Path.GetDirectoryName(path) + "/" + selection.name + ".prefab";
PrefabUtility.SaveAsPrefabAsset(tmpGameObject, destinationPath);
Object.DestroyImmediate(tmpGameObject);
}
}
}

14
com.unity.perception/Editor/Randomization/Editors.meta


fileFormatVersion: 2
<<<<<<< HEAD
fileFormatVersion: 2
timeCreated: 1600754567
=======
guid: 0b17046409af4c22bf74eec2a5965984
timeCreated: 1598135707
>>>>>>> 86d25d2... implemented parameter behaviours
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

17
com.unity.perception/Editor/Randomization/Editors/ScenarioBaseEditor.cs.meta


fileFormatVersion: 2
<<<<<<< HEAD
fileFormatVersion: 2
timeCreated: 1600754583
=======
guid: face5e97e23d402cbf6fafadb39fa0c3
timeCreated: 1596213301
>>>>>>> 86d25d2... implemented parameter behaviours
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

14
com.unity.perception/Editor/Randomization/PropertyDrawers.meta


fileFormatVersion: 2
<<<<<<< HEAD
fileFormatVersion: 2
timeCreated: 1600754588
=======
guid: d3107e026b2943c1868c9b3f8c6480d3
timeCreated: 1598135730
>>>>>>> 86d25d2... implemented parameter behaviours
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

17
com.unity.perception/Editor/Randomization/PropertyDrawers/ColorHsvaDrawer.cs.meta


fileFormatVersion: 2
<<<<<<< HEAD
fileFormatVersion: 2
timeCreated: 1600754588
=======
guid: 5e8094c28dd142a09fbbd38ca560164b
timeCreated: 1598250942
>>>>>>> 86d25d2... implemented parameter behaviours
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

17
com.unity.perception/Editor/Randomization/PropertyDrawers/ParameterDrawer.cs.meta


fileFormatVersion: 2
<<<<<<< HEAD
fileFormatVersion: 2
timeCreated: 1600754588
=======
guid: d389620d3aa3471ca1877eb59cdfb465
timeCreated: 1598135745
>>>>>>> 86d25d2... implemented parameter behaviours
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

12
com.unity.perception/Editor/Randomization/StaticData.cs.meta


fileFormatVersion: 2
fileFormatVersion: 2
timeCreated: 1595278931
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

9
com.unity.perception/Editor/Randomization/Uss.meta


fileFormatVersion: 2
fileFormatVersion: 2
timeCreated: 1590479034
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

9
com.unity.perception/Editor/Randomization/Uxml.meta


fileFormatVersion: 2
fileFormatVersion: 2
timeCreated: 1590479019
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

16
com.unity.perception/Editor/Randomization/Uxml/Parameter/ParameterDrawer.uxml.meta


fileFormatVersion: 2
<<<<<<< HEAD
fileFormatVersion: 2
timeCreated: 1600754588
=======
guid: 6a4bb3efae29429292ccdfa63e661872
timeCreated: 1598240583
>>>>>>> 86d25d2... implemented parameter behaviours
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}

14
com.unity.perception/Editor/Randomization/VisualElements.meta


fileFormatVersion: 2
<<<<<<< HEAD
fileFormatVersion: 2
timeCreated: 1600754567
=======
guid: 7f8f95a1bb144a96b9310164f5560387
timeCreated: 1598135666
>>>>>>> 86d25d2... implemented parameter behaviours
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

9
com.unity.perception/Editor/Randomization/VisualElements/Parameter.meta


fileFormatVersion: 2
fileFormatVersion: 2
timeCreated: 1601669088
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

17
com.unity.perception/Editor/Randomization/VisualElements/Parameter/CategoricalOptionElement.cs.meta


fileFormatVersion: 2
<<<<<<< HEAD
fileFormatVersion: 2
timeCreated: 1600754567
=======
guid: 3066f77d411047baafb6cc454adc6e37
timeCreated: 1595535184
>>>>>>> 86d25d2... implemented parameter behaviours
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

17
com.unity.perception/Editor/Randomization/VisualElements/Parameter/ColorHsvaField.cs.meta


fileFormatVersion: 2
<<<<<<< HEAD
fileFormatVersion: 2
timeCreated: 1600754567
=======
guid: 103b163a2467415ab86b0df8175b12a6
timeCreated: 1598254290
>>>>>>> 86d25d2... implemented parameter behaviours
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

17
com.unity.perception/Editor/Randomization/VisualElements/Parameter/DrawerParameterElement.cs.meta


fileFormatVersion: 2
<<<<<<< HEAD
fileFormatVersion: 2
timeCreated: 1600754567
=======
guid: e2eb905ca8c14b5cbe43e48418948be0
timeCreated: 1598255728
>>>>>>> 86d25d2... implemented parameter behaviours
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

17
com.unity.perception/Editor/Randomization/VisualElements/Parameter/ParameterElement.cs.meta


fileFormatVersion: 2
<<<<<<< HEAD
fileFormatVersion: 2
timeCreated: 1600754567
=======
guid: ea72d77c64d1447aa195e2068f02cf74
timeCreated: 1595279847
>>>>>>> 86d25d2... implemented parameter behaviours
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

9
com.unity.perception/Editor/Randomization/VisualElements/Randomizer.meta


fileFormatVersion: 2
fileFormatVersion: 2
timeCreated: 1601054944
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

12
com.unity.perception/Editor/Randomization/VisualElements/Randomizer/AddRandomizerMenu.cs.meta


fileFormatVersion: 2
fileFormatVersion: 2
timeCreated: 1600836688
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

12
com.unity.perception/Editor/Randomization/VisualElements/Randomizer/RandomizerElement.cs.meta


fileFormatVersion: 2
fileFormatVersion: 2
timeCreated: 1600290125
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
com.unity.perception/Editor/Randomization/VisualElements/Randomizer/RandomizerList.cs


ToolbarMenu m_AddRandomizerMenu;
public HashSet<Type> randomizerTypeSet = new HashSet<Type>();
int m_PreviousListSize;
ScenarioBase scenario => (ScenarioBase)m_Property.serializedObject.targetObject;
VisualElement inspectorContainer

collapseAllButton.clicked += () => CollapseRandomizers(true);
RefreshList();
Undo.undoRedoPerformed += () =>
{
m_Property.serializedObject.Update();
RefreshList();
};
}
void RefreshList()

randomizerTypeSet.Clear();
foreach (var randomizer in scenario.randomizers)
randomizerTypeSet.Add(randomizer.GetType());
m_PreviousListSize = m_Property.arraySize;
Undo.RegisterCompleteObjectUndo(m_Property.serializedObject.targetObject, "Add Randomizer");
var newRandomizer = scenario.CreateRandomizer(randomizerType);
newRandomizer.RandomizeParameterSeeds();
m_Property.serializedObject.Update();

public void RemoveRandomizer(RandomizerElement element)
{
Undo.RegisterCompleteObjectUndo(m_Property.serializedObject.targetObject, "Remove Randomizer");
scenario.RemoveRandomizer(element.randomizerType);
m_Property.serializedObject.Update();
RefreshList();

{
if (currentIndex == nextIndex)
return;
Undo.RegisterCompleteObjectUndo(m_Property.serializedObject.targetObject, "Reorder Randomizer");
scenario.ReorderRandomizer(currentIndex, nextIndex);
m_Property.serializedObject.Update();
RefreshList();

12
com.unity.perception/Editor/Randomization/VisualElements/Randomizer/RandomizerList.cs.meta


fileFormatVersion: 2
fileFormatVersion: 2
timeCreated: 1600366159
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

13
com.unity.perception/Editor/Randomization/VisualElements/Randomizer/RandomizerReorderingIndicator.cs.meta


<<<<<<< HEAD
fileFormatVersion: 2
<<<<<<< HEAD
guid: 61021c66c33e40e98de0702ae0aa4449
timeCreated: 1600754567
=======
guid: 7c1e08b02e5a4c55875f34baf32f8e76
timeCreated: 1596143672
>>>>>>> 86d25d2... implemented parameter behaviours
=======
guid: 7c1e08b02e5a4c55875f34baf32f8e76
guid: e43353090a445024ab8110b73630525a
MonoImporter:
externalObjects: {}
serializedVersion: 2

userData:
assetBundleName:
assetBundleVariant:
>>>>>>> 750f255... working on new workflow

9
com.unity.perception/Editor/Randomization/VisualElements/Sampler.meta


fileFormatVersion: 2
fileFormatVersion: 2
timeCreated: 1601669132
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

17
com.unity.perception/Editor/Randomization/VisualElements/Sampler/FloatRangeElement.cs.meta


fileFormatVersion: 2
<<<<<<< HEAD
fileFormatVersion: 2
timeCreated: 1600754567
=======
guid: e37f169c618d471d8ed9614a41096437
timeCreated: 1595281335
>>>>>>> 86d25d2... implemented parameter behaviours
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

17
com.unity.perception/Editor/Randomization/VisualElements/Sampler/RandomSeedField.cs.meta


fileFormatVersion: 2
<<<<<<< HEAD
fileFormatVersion: 2
timeCreated: 1600754567
=======
guid: b4fa54f5ed5d4d67a278fa8b42dc55cb
timeCreated: 1596171029
>>>>>>> 86d25d2... implemented parameter behaviours
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

17
com.unity.perception/Editor/Randomization/VisualElements/Sampler/SamplerElement.cs.meta


fileFormatVersion: 2
<<<<<<< HEAD
fileFormatVersion: 2
timeCreated: 1600754567
=======
guid: b367f8f2cb8e465ca2d60ccbd5414a14
timeCreated: 1595277943
>>>>>>> 86d25d2... implemented parameter behaviours
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

1
com.unity.perception/Runtime/AssemblyInfo.cs


[assembly: InternalsVisibleTo("Unity.Perception.Runtime.Tests")]
[assembly: InternalsVisibleTo("Unity.Perception.Runtime")]
[assembly: InternalsVisibleTo("Unity.Perception.TestProject")]
[assembly: InternalsVisibleTo("Unity.Perception.Performance.Tests")]

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


/// Retrieve the ID associated with the passed in color. If the passed in color is black this service will return 0.
/// </summary>
/// <param name="color">The color to map to an ID.</param>
/// <returns>This value will be updated with the ID for the passed in color.</returns>
/// <returns>The ID for the passed in color.</returns>
/// <<exception cref="InvalidOperationException">Thrown if the passed in color cannot be mapped to an ID in the alpha 255 range<see cref="maxId"/></exception>
/// <exception cref="InvalidOperationException">Thrown if the passed in color cannot be mapped to an ID in the alpha 255 range<see cref="maxId"/></exception>
public static uint GetInstanceIdFromColor(Color32 color)
{
var id = GetIdForColor(GetPackedColorFromColor(color));

82
com.unity.perception/Runtime/GroundTruth/Labelers/BoundingBox3DLabeler.cs


public class BoundingBox3DLabeler : CameraLabeler
{
EntityQuery m_EntityQuery;
///<inheritdoc/>
public override string description
{

/// <summary>
/// Each 3D bounding box data record maps a tuple of (instance, label) to translation, size and rotation that draws a 3D bounding box,
/// as well as velocity and acceleration (optional) of the 3D bounding box. All location data is given with respect to the sensor coordinate system.
///
/// bounding_box_3d
/// label_id (int): Integer identifier of the label
/// label_name (str): String identifier of the label
/// instance_id (str): UUID of the instance.
/// translation (float, float, float): 3d bounding box's center location in meters as center_x, center_y, center_z with respect to global coordinate system.
/// size (float, float, float): 3d bounding box size in meters as width, length, height.
/// rotation (float, float, float, float): 3d bounding box orientation as quaternion: w, x, y, z.
/// velocity (float, float, float) [optional]: 3d bounding box velocity in meters per second as v_x, v_y, v_z.
/// acceleration (float, float, float) [optional]: 3d bounding box acceleration in meters per second^2 as a_x, a_y, a_z.
/// </summary>
/// <remarks>
/// Currently not supporting exporting velocity and acceleration. Both values will be null.

public struct BoxData
{
/// <summary>
/// Integer identifier of the label
/// </summary>
/// <summary>
/// String identifier of the label
/// </summary>
/// <summary>
/// UUID of the instance
/// </summary>
/// <summary>
/// 3d bounding box's center location in meters as center_x, center_y, center_z with respect to global coordinate system
/// </summary>
/// <summary>
/// 3d bounding box size in meters as width, length, height
/// </summary>
/// <summary>
/// 3d bounding box orientation as quaternion: w, x, y, z
/// </summary>
/// <summary>
/// [optional]: 3d bounding box velocity in meters per second as v_x, v_y, v_z
/// </summary>
/// <summary>
/// [optional]: 3d bounding box acceleration in meters per second^2 as a_x, a_y, a_z
/// </summary>
int m_CurrentFrame;
/// <inheritdoc/>

"Bounding box for each labeled object visible to the sensor", id: new Guid(annotationId));
perceptionCamera.RenderedObjectInfosCalculated += OnRenderObjectInfosCalculated;
m_AsyncAnnotations = new Dictionary<int, AsyncAnnotation>();
m_BoundingBoxValues = new Dictionary<int, Dictionary<uint, BoxData>>();
m_ToReport = new List<BoxData>();

right = rotation * right;
up = rotation * up;
forward = rotation * forward;
corners[3] = corners[0] + doubleRight;
corners[3] = corners[0] + doubleRight;
for (var i = 0; i < 4; i++)
{
corners[i + 4] = corners[i] + doubleForward;

protected override void OnBeginRendering()
{
m_CurrentFrame = Time.frameCount;
foreach (var entity in entities)
{
ProcessEntity(entityManager.GetComponentObject<Labeling>(entity));

if (!m_BoundingBoxValues.TryGetValue(frameCount, out var boxes))
return;
m_AsyncAnnotations.Remove(frameCount);
m_BoundingBoxValues.Remove(frameCount);

for (var i = 0; i < renderedObjectInfos.Length; i++)
{
var objectInfo = renderedObjectInfos[i];

m_ToReport.Add(box);
}
}
BoundingBoxComputed?.Invoke(frameCount, m_ToReport);
asyncAnnotation.ReportValues(m_ToReport);
}

if (idLabelConfig.TryGetLabelEntryFromInstanceId(labeledEntity.instanceId, out var labelEntry))
{
var entityGameObject = labeledEntity.gameObject;
var labelTransform = entityGameObject.transform;
var cameraTransform = perceptionCamera.transform;
var combinedBounds = new Bounds(Vector3.zero, Vector3.zero);

// they are axis-aligned with respect to the current component's coordinate space. This, in theory
// could still provide non-ideal fitting bounds (if the model is made strangely, but garbage in; garbage out)
var meshBounds = mesh.mesh.bounds;
// Apply the transformations on this object until we reach the labeled transform
while (currentTransform != labelTransform)
{

// need to calculate all 8 corners of the bounds and combine them with the current combined
// bounds
var corners = GetBoxCorners(transformedBounds, transformedRotation);
// If this is the first time, create a new bounds struct
if (areBoundsUnset)
{

combinedBounds.Encapsulate(c2);
}
}
// Convert the combined bounds into world space
combinedBounds.center = labelTransform.TransformPoint(combinedBounds.center);
combinedBounds.extents = Vector3.Scale(combinedBounds.extents, labelTransform.localScale);

cameraCenter = Vector3.Scale(cameraTransform.localScale, cameraCenter);
m_BoundingBoxValues[m_CurrentFrame][labeledEntity.instanceId] = converted;
}
}

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


string m_OutputDirectoryPath;
JsonSerializer m_AnnotationSerializer;
public bool IsRunning { get; private set; }
public string OutputDirectory

m_AnnotationSerializer = JsonSerializer.CreateDefault();
m_AnnotationSerializer.Converters.Add(new Vector3Converter());
m_AnnotationSerializer.Converters.Add(new QuaternionConverter());
m_OutputDirectoryName = outputDirectory;
IsRunning = true;
}

{
var q = Quaternion.identity;
reader.Read(); // open [ token
q.x = (float)reader.ReadAsDecimal();
q.x = (float)reader.ReadAsDecimal();
q.y = (float)reader.ReadAsDecimal();
q.z = (float)reader.ReadAsDecimal();
q.w = (float)reader.ReadAsDecimal();

}
[SuppressMessage("ReSharper", "PossibleInvalidOperationException")]
public class Vector3Converter : JsonConverter<Vector3>
{

return outVector;
}
}
var jArray = values == null ? null : JArray.FromObject(values, m_AnnotationSerializer);
JArray jArray = null;
if (values != null)
{
jArray = new JArray();
foreach (var value in values)
{
if (value != null)
jArray.Add(new JRaw(DatasetJsonUtility.ToJToken(value)));
}
}
ReportAsyncAnnotationResult<T>(asyncAnnotation, filename, jArray);
}

14
com.unity.perception/Runtime/Randomization/Parameters/ParameterTypes/NumericParameters/ColorParameters.meta


fileFormatVersion: 2
<<<<<<< HEAD
fileFormatVersion: 2
timeCreated: 1600754588
=======
guid: ce91e289cdaa4ccc849a0c287aefd34d
timeCreated: 1598326361
>>>>>>> 50f2c39... Added xml documentation
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

14
com.unity.perception/Runtime/Randomization/Randomizers.meta


fileFormatVersion: 2
<<<<<<< HEAD
fileFormatVersion: 2
timeCreated: 1600754588
=======
guid: ae6aad06c0e14f67aa7a9ad9004a1828
timeCreated: 1600274594
>>>>>>> c653d18... Implemented randomizer class. Ran into SerializeReference issue 1193322.
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

12
com.unity.perception/Tests/Runtime/GroundTruthTests/DatasetCaptureTests.cs


""annotation_definition"": <guid>,
""values"": [
{{
""a"": ""a string"",
""b"": 10
}},
""a"": ""a string"",
""b"": 10
}},
""a"": ""a second string"",
""b"": 20
}}
""a"": ""a second string"",
""b"": 20
}}
]
}}
]";

14
com.unity.perception/Tests/Runtime/Randomization/RandomizerTests.meta


fileFormatVersion: 2
<<<<<<< HEAD
fileFormatVersion: 2
timeCreated: 1600754588
=======
guid: f9e02c502b7845229d26d377a0d871f1
timeCreated: 1600744200
>>>>>>> cb407fb... added randomizer tests
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

4
com.unity.perception/package.json


"com.unity.burst": "1.3.9",
"com.unity.entities": "0.8.0-preview.8",
"com.unity.simulation.client": "0.0.10-preview.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"
},
"description": "Tools for generating large-scale data sets for perception-based machine learning training and validation",
"displayName": "Perception",

83
.yamato/upm-ci-performance.yml


{% metadata_file .yamato/environments.yml %}
---
{% for editor in complete_editors %}
{% for suite in performance_suites %}
{% for project in projects %}
{{project.name}}_linux_{{suite.name}}_{{editor.version}}:
name : {{project.name}} {{ suite.display_name }} performance tests ({{ editor.version }}, Linux)
agent:
type: Unity::VM::GPU
model: rtx2080
image: cds-ops/ubuntu-18.04-base:latest
flavor: b1.large
variables:
PATH: /root/.local/bin:/home/bokken/bin:/home/bokken/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/sbin:/home/bokken/.npm-global/bin
commands:
- git submodule update --init --recursive
- pip install unity-downloader-cli --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple --upgrade --user
- git clone git@github.cds.internal.unity3d.com:unity/utr.git utr
- unity-downloader-cli -u {{ editor.version }} -c editor -c StandaloneSupport-IL2CPP -c Linux --wait --published
{% if suite.name == "standalone" %}
- DISPLAY=:0.0 utr/utr --testproject=./TestProjects/{{project.name}} --editor-location=.Editor --artifacts_path=test-results --stdout-filter=minimal --extra-editor-arg="--force-vulkan" {{suite.args}}StandaloneLinux64 --category="Performance" --report-performance-data --performance-project-id=com.unity.perception --zero-tests-are-ok=1
{% else %}
- DISPLAY=:0.0 utr/utr --testproject=./TestProjects/{{project.name}} --editor-location=.Editor --artifacts_path=test-results --stdout-filter=minimal --extra-editor-arg="--force-vulkan" {{suite.args}} --category="Performance" --report-performance-data --performance-project-id=com.unity.perception --zero-tests-are-ok=1
{% endif %}
artifacts:
logs:
paths:
- "test-results/**/*"
{% endfor %}
{% endfor %}
{% endfor %}
{% for editor in complete_editors %}
{% for suite in performance_suites %}
{% for project in projects %}
{{project.name}}_windows_{{suite.name}}_{{editor.version}}:
name : {{project.name}} {{ suite.display_name }} performance tests ({{ editor.version }}, Windows)
agent:
type: Unity::VM::GPU
model: rtx2080
image: package-ci/win10:stable
flavor: b1.large
commands:
- git submodule update --init --recursive
- git clone git@github.cds.internal.unity3d.com:unity/utr.git utr
- pip install unity-downloader-cli --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple --upgrade
- unity-downloader-cli -u {{ editor.version }} -c editor -c StandaloneSupport-IL2CPP -c Linux --wait --published
{% if suite.name == "standalone" %}
- utr/utr --testproject=./TestProjects/{{project.name}} --editor-location=./.Editor --artifacts_path=test-results --stdout-filter=minimal --extra-editor-arg="--force-d3d11" {{suite.args}}StandaloneWindows64 --category="Performance" --report-performance-data --performance-project-id=com.unity.perception --zero-tests-are-ok=1
{% else %}
- utr/utr --testproject=./TestProjects/{{project.name}} --editor-location=./.Editor --artifacts_path=test-results --stdout-filter=minimal --extra-editor-arg="--force-d3d11" {{suite.args}} --category="Performance" --report-performance-data --performance-project-id=com.unity.perception --zero-tests-are-ok=1
{% endif %}
artifacts:
logs:
paths:
- "test-results/**/*"
{% endfor %}
{% endfor %}
{% endfor %}
# Not including OSX because the only OSX platform on Bokken with a GPU is a Mac Mini, of which there are only a few and setting up Yamato jobs is very complicated.
# {% for variant in package_variants %}
# {% for editor in complete_editors %}
# code_coverage_win_{{editor.version}}:
# name: Code Coverage Report - Windows
# agent:
# type: Unity::VM
# image: package-ci/win10:stable
# flavor: b1.large
# commands:
# - npm install upm-ci-utils@stable -g --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm
# - upm-ci package test --unity-version {{editor.version}} --enable-code-coverage --code-coverage-options 'enableCyclomaticComplexity;generateHtmlReport'
# artifacts:
# logs:
# paths:
# - "upm-ci~/test-results/**/*"
# dependencies:
# - .yamato/upm-ci-full.yml#pack_{{ variant.name }}
# {% endfor %}
# {% endfor %}

8
TestProjects/PerceptionURP/Assets/StreamingAssets.meta


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

8
com.unity.perception/Tests/Performance.meta


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

25
com.unity.perception/Tests/Performance/PerformanceTestAllLabelers.cs


using NUnit.Framework;
namespace PerformanceTests
{
[TestFixture(640, 480, false, false)]
[TestFixture(640, 480, true, false)]
[TestFixture(640, 480, true, true)]
[TestFixture(1024, 768, false, false)]
[TestFixture(1024, 768, true, false)]
[TestFixture(1024, 768, true, true)]
[TestFixture(1920, 1080, false, false)]
[TestFixture(1920, 1080, true, false)]
[TestFixture(1920, 1080, true, true)]
[Category("Performance")]
public class PerformanceTestAllLabelers : PerformanceTester
{
public PerformanceTestAllLabelers(int resx, int resy, bool capData, bool vizOn)
: base(resx, resy, capData, vizOn,
PerformanceTestBoundingBoxLabeler.Label,
PerformanceTestObjectCountLabeler.Label,
PerformanceTestPixelCountLabeler.Label,
PerformanceTestSemanticSegmentationLabeler.Label
) { }
}
}

3
com.unity.perception/Tests/Performance/PerformanceTestAllLabelers.cs.meta


fileFormatVersion: 2
guid: 24f31177933144a3ba6bfecddb8c7cad
timeCreated: 1601485739

24
com.unity.perception/Tests/Performance/PerformanceTestBoundingBoxLabeler.cs


using NUnit.Framework;
using NUnit.Framework.Constraints;
using UnityEngine.UIElements;
namespace PerformanceTests
{
[TestFixture(640, 480, false, false)]
[TestFixture(640, 480, true, false)]
[TestFixture(640, 480, true, true)]
[TestFixture(1024, 768, false, false)]
[TestFixture(1024, 768, true, false)]
[TestFixture(1024, 768, true, true)]
[TestFixture(1920, 1080, false, false)]
[TestFixture(1920, 1080, true, false)]
[TestFixture(1920, 1080, true, true)]
[Category("Performance")]
public class PerformanceTestBoundingBoxLabeler : PerformanceTester
{
public const string Label = "BoundingBoxLabeler";
public PerformanceTestBoundingBoxLabeler(int resx, int resy, bool capData, bool vizOn)
: base(resx, resy, capData, vizOn, Label) { }
}
}

3
com.unity.perception/Tests/Performance/PerformanceTestBoundingBoxLabeler.cs.meta


fileFormatVersion: 2
guid: b559db416e1d40a79648f59a285c7632
timeCreated: 1601485668

24
com.unity.perception/Tests/Performance/PerformanceTestObjectCountLabeler.cs


using NUnit.Framework;
namespace PerformanceTests
{
[TestFixture(640, 480, false, false)]
[TestFixture(640, 480, true, false)]
[TestFixture(640, 480, true, true)]
[TestFixture(1024, 768, false, false)]
[TestFixture(1024, 768, true, false)]
[TestFixture(1024, 768, true, true)]
[TestFixture(1920, 1080, false, false)]
[TestFixture(1920, 1080, true, false)]
[TestFixture(1920, 1080, true, true)]
[Category("Performance")]
public class PerformanceTestObjectCountLabeler : PerformanceTester
{
public const string Label = "ObjectCountLabeler";
public PerformanceTestObjectCountLabeler(int resx, int resy, bool capData, bool vizOn)
: base(resx, resy, capData, vizOn, Label)
{
}
}
}

3
com.unity.perception/Tests/Performance/PerformanceTestObjectCountLabeler.cs.meta


fileFormatVersion: 2
guid: f15f1494b25a4bf387453aff1ffc54fe
timeCreated: 1601479869

22
com.unity.perception/Tests/Performance/PerformanceTestPixelCountLabeler.cs


using NUnit.Framework;
namespace PerformanceTests
{
[TestFixture(640, 480, false, false)]
[TestFixture(640, 480, true, false)]
[TestFixture(640, 480, true, true)]
[TestFixture(1024, 768, false, false)]
[TestFixture(1024, 768, true, false)]
[TestFixture(1024, 768, true, true)]
[TestFixture(1920, 1080, false, false)]
[TestFixture(1920, 1080, true, false)]
[TestFixture(1920, 1080, true, true)]
[Category("Performance")]
public class PerformanceTestPixelCountLabeler : PerformanceTester
{
public const string Label = "PixelCountLabeler";
public PerformanceTestPixelCountLabeler(int resx, int resy, bool capData, bool vizOn)
: base(resx, resy, capData, vizOn, Label) { }
}
}

3
com.unity.perception/Tests/Performance/PerformanceTestPixelCountLabeler.cs.meta


fileFormatVersion: 2
guid: f535325a3cb34cbea2057b59b6a0b003
timeCreated: 1601485694

22
com.unity.perception/Tests/Performance/PerformanceTestSemanticSegmentationLabeler.cs


using NUnit.Framework;
namespace PerformanceTests
{
[TestFixture(640, 480, false, false)]
[TestFixture(640, 480, true, false)]
[TestFixture(640, 480, true, true)]
[TestFixture(1024, 768, false, false)]
[TestFixture(1024, 768, true, false)]
[TestFixture(1024, 768, true, true)]
[TestFixture(1920, 1080, false, false)]
[TestFixture(1920, 1080, true, false)]
[TestFixture(1920, 1080, true, true)]
[Category("Performance")]
public class PerformanceTestSemanticSegmentationLabeler : PerformanceTester
{
public const string Label = "SemanticSegmentationLabeler";
public PerformanceTestSemanticSegmentationLabeler(int resx, int resy, bool capData, bool vizOn)
: base(resx, resy, capData, vizOn, Label) { }
}
}

3
com.unity.perception/Tests/Performance/PerformanceTestSemanticSegmentationLabeler.cs.meta


fileFormatVersion: 2
guid: c1f3e7fedce043bd860c715bc7550158
timeCreated: 1601485725

139
com.unity.perception/Tests/Performance/PerformanceTester.cs


using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Unity.PerformanceTesting;
using UnityEngine;
using UnityEngine.Perception.GroundTruth;
using UnityEngine.TestTools;
using UnityEngine.UIElements;
namespace PerformanceTests
{
public abstract class PerformanceTester
{
(int, int) m_Resolution;
bool m_CaptureData;
bool m_VisualizersOn;
PerceptionCamera m_Camera;
GameObject m_SceneRoot;
IdLabelConfig m_IdConfig = null;
SemanticSegmentationLabelConfig m_SsConfig = null;
string[] m_Labelers = null;
List<CameraLabeler> m_ActiveLabelers = null;
public PerformanceTester(int resx ,int resy, bool capData, bool vizOn, string labeler1)
{
this.m_Resolution = (resx, resy);
this.m_CaptureData = capData;
this.m_VisualizersOn = vizOn;
this.m_Labelers = new string[]{ labeler1 };
}
public PerformanceTester(int resx ,int resy, bool capData, bool vizOn, string labeler1, string labeler2)
{
this.m_Resolution = (resx, resy);
this.m_CaptureData = capData;
this.m_VisualizersOn = vizOn;
this.m_Labelers = new string[]{ labeler1, labeler2 };
}
public PerformanceTester(int resx ,int resy, bool capData, bool vizOn, string labeler1, string labeler2, string labeler3)
{
this.m_Resolution = (resx, resy);
this.m_CaptureData = capData;
this.m_VisualizersOn = vizOn;
this.m_Labelers = new string[]{ labeler1, labeler2, labeler3 };
}
public PerformanceTester(int resx ,int resy, bool capData, bool vizOn, string labeler1, string labeler2, string labeler3, string labeler4)
{
this.m_Resolution = (resx, resy);
this.m_CaptureData = capData;
this.m_VisualizersOn = vizOn;
this.m_Labelers = new string[]{ labeler1, labeler2, labeler3, labeler4 };
}
private static CameraLabeler CreateLabeler(string label, IdLabelConfig idConfig, SemanticSegmentationLabelConfig ssConfig)
{
switch (label) {
case PerformanceTestObjectCountLabeler.Label:
return new ObjectCountLabeler(idConfig);
case PerformanceTestBoundingBoxLabeler.Label:
return new BoundingBox2DLabeler(idConfig);
case PerformanceTestPixelCountLabeler.Label:
return new RenderedObjectInfoLabeler(idConfig);
case PerformanceTestSemanticSegmentationLabeler.Label:
return new SemanticSegmentationLabeler(ssConfig);
default:
return null;
}
}
private static List<CameraLabeler> CreateLabelers(IEnumerable<string> labelers, IdLabelConfig idConfig, SemanticSegmentationLabelConfig ssConfig)
{
return labelers.Select(l => CreateLabeler(l, idConfig, ssConfig)).Where(labeler => labeler != null).ToList();
}
[SetUp]
public void SetUpTest()
{
DatasetCapture.ResetSimulation();
Time.timeScale = 1;
if (Directory.Exists(DatasetCapture.OutputDirectory))
Directory.Delete(DatasetCapture.OutputDirectory, true);
Screen.SetResolution(m_Resolution.Item1, m_Resolution.Item2, true);
(m_Camera, m_IdConfig, m_SsConfig, m_SceneRoot) = TestHelper.CreateThreeBlockScene();
m_Camera.enabled = true;
m_Camera.showVisualizations = false;
m_ActiveLabelers = CreateLabelers(m_Labelers, m_IdConfig, m_SsConfig);
foreach (var l in m_ActiveLabelers)
{
m_Camera.AddLabeler(l);
}
if (!m_CaptureData) m_Camera.enabled = false;
if (m_CaptureData && !m_VisualizersOn) m_Camera.showVisualizations = false;
m_Camera.gameObject.SetActive(true);
}
[TearDown]
public void TearDown()
{
Object.DestroyImmediate(m_Camera.gameObject);
Object.DestroyImmediate(m_SceneRoot.gameObject);
var simState = DatasetCapture.SimulationState;
simState.End();
DatasetCapture.ResetSimulation();
Time.timeScale = 1;
if (Directory.Exists(DatasetCapture.OutputDirectory))
Directory.Delete(DatasetCapture.OutputDirectory, true);
m_ActiveLabelers = null;
m_IdConfig = null;
m_SsConfig = null;
}
[UnityTest, Performance]
public IEnumerator ExecuteTest()
{
yield return Measure.Frames()
.WarmupCount(10)
.MeasurementCount(30)
.Run();
// Allow all file writes to complete
yield return new WaitForSeconds(5);
}
}
}

11
com.unity.perception/Tests/Performance/PerformanceTester.cs.meta


fileFormatVersion: 2
guid: 73cdca6d48c834fb3ae5322e62b7c9c0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

101
com.unity.perception/Tests/Performance/TestHelper.cs


using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.Perception.GroundTruth;
namespace PerformanceTests
{
static class TestHelper
{
public static (PerceptionCamera, IdLabelConfig, SemanticSegmentationLabelConfig, GameObject) CreateThreeBlockScene()
{
var labels = new List<string> { "Crate", "Cube", "Box" };
var idConfig = CreateDefaultLabelConfig();
var ssConfig = CreateDefaultSemanticSegmentationLabelConfig();
var camPos = new Vector3(198.0188f, 126.5455f, -267.4195f);
var camRot = Quaternion.Euler(20.834f, -36.337f, 0);
var camScale = new Vector3(36.24997f, 36.24997f, 36.24997f);
var cam = CreatePerceptionCamera(position: camPos, rotation: camRot, scale: camScale);
const float scale = 36.24997f;
const float y = 82.92603f;
var crate = CreateLabeledCube(labels[0], new Vector3(155.9981f, y, -149.9762f), scale: scale);
var cube = CreateLabeledCube(labels[1], new Vector3(92.92311f, y, -136.2012f), scale: scale);
var box = CreateLabeledCube(labels[2], new Vector3(96.1856f, y, -193.8386f), scale: scale);
var root = new GameObject();
crate.transform.parent = root.transform;
cube.transform.parent = root.transform;
box.transform.parent = root.transform;
return (cam, idConfig, ssConfig, root);
}
static IdLabelConfig CreateDefaultLabelConfig(List<string> labels = null)
{
var entries = new List<IdLabelEntry>();
if (labels == null)
{
entries.Add(new IdLabelEntry { id = 1, label = "label" });
}
else
{
var id = 1;
entries.AddRange(labels.Select(l => new IdLabelEntry { id = id++, label = l }));
}
var config = ScriptableObject.CreateInstance<IdLabelConfig>();
config.Init(entries);
return config;
}
static SemanticSegmentationLabelConfig CreateDefaultSemanticSegmentationLabelConfig()
{
var labelConfig = ScriptableObject.CreateInstance<SemanticSegmentationLabelConfig>();
labelConfig.Init(new List<SemanticSegmentationLabelEntry>()
{
new SemanticSegmentationLabelEntry()
{
label = "label",
color = new Color32(0, 0, 255, 255)
}
});
return labelConfig;
}
//public static GameObject CreateLabeledCube(float scale = 10, string label = "label", float x = 0, float y = 0, float z = 0, float roll = 0, float pitch = 0, float yaw = 0)
public static GameObject CreateLabeledCube(string label = "label", Vector3? position = null, Quaternion? rotation = null, float scale = 10)
{
var cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
cube.transform.SetPositionAndRotation(position ?? Vector3.zero, rotation ?? Quaternion.identity);
cube.transform.localScale = new Vector3(scale, scale, scale);
var labeling = cube.AddComponent<Labeling>();
labeling.labels.Add(label);
return cube;
}
public static PerceptionCamera CreatePerceptionCamera(Vector3? position = null, Quaternion? rotation = null, Vector3? scale = null)
{
var cameraObject = new GameObject();
cameraObject.SetActive(false);
cameraObject.transform.localPosition = position ?? Vector3.zero;
cameraObject.transform.localRotation = rotation ?? Quaternion.identity;
cameraObject.transform.localScale = scale ?? Vector3.one;
var camera = cameraObject.AddComponent<Camera>();
camera.orthographic = true;
camera.orthographicSize = 1;
var perceptionCamera = cameraObject.AddComponent<PerceptionCamera>();
perceptionCamera.captureRgbImages = false;
return perceptionCamera;
}
}
}

3
com.unity.perception/Tests/Performance/TestHelper.cs.meta


fileFormatVersion: 2
guid: 0a0806dd5ccf43b58adde994734ebfd6
timeCreated: 1600780689

23
com.unity.perception/Tests/Performance/Unity.Perception.Performance.Tests.asmdef


{
"name": "Unity.Perception.Performance.Tests",
"references": [
"Unity.PerformanceTesting",
"UnityEngine.TestRunner",
"UnityEditor.TestRunner",
"Unity.Perception.Runtime",
"Unity.Simulation.Core"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": true,
"precompiledReferences": [
"nunit.framework.dll"
],
"autoReferenced": false,
"defineConstraints": [
"UNITY_INCLUDE_TESTS"
],
"versionDefines": [],
"noEngineReferences": false
}

7
com.unity.perception/Tests/Performance/Unity.Perception.Performance.Tests.asmdef.meta


fileFormatVersion: 2
guid: 7b61d417f5df545b6b4cfc327638a440
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存