浏览代码
Performance testing (#85)
Performance testing (#85)
* Initial commit of performance tests * Trying to get performance testing working on yamato * Trying to get performance testing working on yamato * Updated tmp test for yamato * Test tmp yamato performance script * Test tmp yamato performance script * Try to report our results from yamato * Test performance with yamato report results to observer * Test tmp yamato performance script multiple setups - report results * Testing hourly test * testing recurring jobs * testing recurring trigger * testing recurring yamato * Some more advances on performance tests * Getting rid of some changes * More fixes so we can get through yamato lint * More yamato parse fixes * Changed to nightly tests for perf testing * Performance tests for perception * Fix yamato script * Fix yamato script to only run performance tests * Added category tag * Updated changelog * Fixed test name * Updated yml to request .../main
GitHub
4 年前
当前提交
c3788540
共有 24 个文件被更改,包括 582 次插入 和 0 次删除
-
27.yamato/environments.yml
-
35.yamato/upm-ci-full.yml
-
4com.unity.perception/CHANGELOG.md
-
1com.unity.perception/Runtime/AssemblyInfo.cs
-
83.yamato/upm-ci-performance.yml
-
8TestProjects/PerceptionURP/Assets/StreamingAssets.meta
-
8com.unity.perception/Tests/Performance.meta
-
25com.unity.perception/Tests/Performance/PerformanceTestAllLabelers.cs
-
3com.unity.perception/Tests/Performance/PerformanceTestAllLabelers.cs.meta
-
24com.unity.perception/Tests/Performance/PerformanceTestBoundingBoxLabeler.cs
-
3com.unity.perception/Tests/Performance/PerformanceTestBoundingBoxLabeler.cs.meta
-
24com.unity.perception/Tests/Performance/PerformanceTestObjectCountLabeler.cs
-
3com.unity.perception/Tests/Performance/PerformanceTestObjectCountLabeler.cs.meta
-
22com.unity.perception/Tests/Performance/PerformanceTestPixelCountLabeler.cs
-
3com.unity.perception/Tests/Performance/PerformanceTestPixelCountLabeler.cs.meta
-
22com.unity.perception/Tests/Performance/PerformanceTestSemanticSegmentationLabeler.cs
-
3com.unity.perception/Tests/Performance/PerformanceTestSemanticSegmentationLabeler.cs.meta
-
139com.unity.perception/Tests/Performance/PerformanceTester.cs
-
11com.unity.perception/Tests/Performance/PerformanceTester.cs.meta
-
101com.unity.perception/Tests/Performance/TestHelper.cs
-
3com.unity.perception/Tests/Performance/TestHelper.cs.meta
-
23com.unity.perception/Tests/Performance/Unity.Perception.Performance.Tests.asmdef
-
7com.unity.perception/Tests/Performance/Unity.Perception.Performance.Tests.asmdef.meta
|
|||
{% 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 %} |
|
|||
fileFormatVersion: 2 |
|||
guid: 01c33d1bbfad749909de900dc92115a0 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: e8af2c3f2ebad4dd69b451a052801fb3 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
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 |
|||
) { } |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 24f31177933144a3ba6bfecddb8c7cad |
|||
timeCreated: 1601485739 |
|
|||
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) { } |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: b559db416e1d40a79648f59a285c7632 |
|||
timeCreated: 1601485668 |
|
|||
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) |
|||
{ |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: f15f1494b25a4bf387453aff1ffc54fe |
|||
timeCreated: 1601479869 |
|
|||
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) { } |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: f535325a3cb34cbea2057b59b6a0b003 |
|||
timeCreated: 1601485694 |
|
|||
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) { } |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: c1f3e7fedce043bd860c715bc7550158 |
|||
timeCreated: 1601485725 |
|
|||
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); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 73cdca6d48c834fb3ae5322e62b7c9c0 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
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; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 0a0806dd5ccf43b58adde994734ebfd6 |
|||
timeCreated: 1600780689 |
|
|||
{ |
|||
"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 |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 7b61d417f5df545b6b4cfc327638a440 |
|||
AssemblyDefinitionImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue