比较提交

...
此合并请求有变更与目标分支冲突。
/.yamato/environments.yml
/.yamato/upm-ci-testprojects.yml
/com.unity.perception/Editor/Randomization/Uxml/ScenarioBaseElement.uxml
/com.unity.perception/Editor/Randomization/Editors/RunInUnitySimulationWindow.cs
/com.unity.perception/Editor/Randomization/Editors/ScenarioBaseEditor.cs
/com.unity.perception/package.json
/com.unity.perception/Runtime/Randomization/Parameters/CategoricalParameter.cs
/com.unity.perception/Runtime/Randomization/Scenarios/Serialization/ScenarioSerializer.cs
/com.unity.perception/Runtime/Randomization/Scenarios/UnitySimulationScenario.cs
/com.unity.perception/Runtime/Randomization/Scenarios/ScenarioBase.cs
/com.unity.perception/Runtime/GroundTruth/PerceptionCamera.cs
/com.unity.perception/Runtime/GroundTruth/Labelers/CameraLabeler.cs

20 次代码提交

作者 SHA1 备注 提交日期
Mohsen Kamalzadeh ffba8c5e fix for visualization flag not being read at the correct time 3 年前
Mohsen Kamalzadeh dd054f13 Fixed categorical parameter random value rounding issue 3 年前
GitHub 10990ca3 changed from linux latest to linux stable image 4 年前
GitHub 7419ee76 changed from linux latest to linux stable image 4 年前
GitHub cb70938e changed from linux latest to linux stable image 4 年前
GitHub a3b9ff98 Upgraded capture package dependency 4 年前
sleal-unity 2cd5eebf removed hash deserialization 4 年前
sleal-unity e620ab8e added conditional hash serialization 4 年前
GitHub e9638616 Merge pull request #279 from Unity-Technologies/addressables-test-scenario-fix 4 年前
sleal-unity 81e197b1 updated run in usim window 4 年前
sleal-unity 130258c0 stapled scenario back together 4 年前
GitHub b5eb4b82 Merge pull request #277 from Unity-Technologies/addressables-test-labeling 4 年前
Mohsen Kamalzadeh 85f07b97 moved synthdet specidic label config and labeling logic out of this repo 4 年前
Mohsen Kamalzadeh 7600c8fe removed label config setup logic from fixed length scenario 4 年前
Mohsen Kamalzadeh 5aaf5f94 some changes to make runtime labeling and label config work 4 年前
sleal-unity b17a15fa moved test app param field in scenario inspector 4 年前
sleal-unity 7db21627 added new line 4 年前
sleal-unity 4beed641 added xml doc strings 4 年前
sleal-unity ec307e93 addressables updates 4 年前
sleal-unity 4df00501 refactored scenario end frame behavior 4 年前
共有 15 个文件被更改,包括 128 次插入60 次删除
  1. 2
      .yamato/upm-ci-testprojects.yml
  2. 2
      .yamato/upm-ci-performance.yml
  3. 4
      .yamato/environments.yml
  4. 2
      com.unity.perception/package.json
  5. 3
      com.unity.perception/Editor/Randomization/Uxml/ScenarioBaseElement.uxml
  6. 6
      com.unity.perception/Editor/Randomization/Editors/ScenarioBaseEditor.cs
  7. 7
      com.unity.perception/Editor/Randomization/Editors/RunInUnitySimulationWindow.cs
  8. 28
      com.unity.perception/Runtime/Randomization/Scenarios/FixedLengthScenario.cs
  9. 50
      com.unity.perception/Runtime/Randomization/Scenarios/ScenarioBase.cs
  10. 14
      com.unity.perception/Runtime/Randomization/Scenarios/UnitySimulationScenario.cs
  11. 20
      com.unity.perception/Runtime/Randomization/Scenarios/PerceptionScenario.cs
  12. 19
      com.unity.perception/Runtime/Randomization/Scenarios/Serialization/ScenarioSerializer.cs
  13. 14
      com.unity.perception/Runtime/Randomization/Parameters/CategoricalParameter.cs
  14. 4
      com.unity.perception/Runtime/GroundTruth/PerceptionCamera.cs
  15. 13
      com.unity.perception/Runtime/GroundTruth/Labelers/CameraLabeler.cs

2
.yamato/upm-ci-testprojects.yml


agent:
type: Unity::VM::GPU
model: rtx2080
image: cds-ops/ubuntu-18.04-base:latest
image: cds-ops/ubuntu-18.04-base:stable
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

2
.yamato/upm-ci-performance.yml


agent:
type: Unity::VM::GPU
model: rtx2080
image: cds-ops/ubuntu-18.04-base:latest
image: cds-ops/ubuntu-18.04-base:stable
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

4
.yamato/environments.yml


standalone-platform: StandaloneOSX
- name: ubuntu
type: Unity::VM
image: package-ci/ubuntu:latest
image: package-ci/ubuntu:stable
flavor: b1.large
performance_platforms:

standalone-platform: StandaloneOSX
- name: ubuntu
type: Unity::VM
image: package-ci/ubuntu:latest
image: package-ci/ubuntu:stable
flavor: b1.large
performance_suites:

2
com.unity.perception/package.json


"com.unity.collections": "0.9.0-preview.6",
"com.unity.nuget.newtonsoft-json": "1.1.2",
"com.unity.render-pipelines.core": "7.1.6",
"com.unity.simulation.capture": "0.0.10-preview.20",
"com.unity.simulation.capture": "0.0.10-preview.22",
"com.unity.simulation.client": "0.0.10-preview.10",
"com.unity.simulation.core": "0.0.10-preview.22"
},

3
com.unity.perception/Editor/Randomization/Uxml/ScenarioBaseElement.uxml


<VisualElement>
<Style src="../Uss/Styles.uss"/>
<VisualElement name="inspector-properties" style="margin-bottom: 4px;"/>
<VisualElement class="scenario__dark-viewport" >
<VisualElement name="scenario-properties-container" class="scenario__dark-viewport" >
<editor:ObjectField name="test-app-param" label="Test App Param" binding-path="testAppParam"/>
<VisualElement name="constants-container">
<Foldout style="padding-left: 16px" text="Constants" name="constants-list" tooltip="A list of parameters for this scenario that will be JSON serialized in the configuration file."/>
<editor:PropertyField name="configuration-file-name" label="Constants File Name" binding-path="serializedConstantsFileName"/>

6
com.unity.perception/Editor/Randomization/Editors/ScenarioBaseEditor.cs


using System.IO;
using UnityEditor.UIElements;
using UnityEngine;
using UnityEngine.Perception.Randomization.Scenarios;
using UnityEngine.UIElements;

CreatePropertyFields();
CheckIfConstantsExist();
var appParamField = m_Root.Q<ObjectField>("test-app-param");
appParamField.objectType = typeof(TextAsset);
var generateConfigButton = m_Root.Q<Button>("generate-json-config");
generateConfigButton.clicked += () =>

case "constants":
m_HasConstantsField = true;
UIElementsEditorUtilities.CreatePropertyFields(iterator.Copy(), m_ConstantsListVisualContainer);
break;
case nameof(ScenarioBase.testAppParam):
break;
default:
{

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


Label m_PrevExecutionIdLabel;
RunParameters m_RunParameters;
const string m_SupportedGPUString = "NVIDIA";
const string k_SupportedGPUString = "NVIDIA";
[MenuItem("Window/Run in Unity Simulation")]
static void ShowWindow()

: m_RunParameters.currentScenario.SerializeToJson());
var constants = configuration["constants"];
if (constants == null)
{
constants = new JObject();
configuration["constants"] = constants;
}
constants["totalIterations"] = m_RunParameters.totalIterations;
constants["instanceCount"] = m_RunParameters.instanceCount;

28
com.unity.perception/Runtime/Randomization/Scenarios/FixedLengthScenario.cs


using System;
using System.Collections.Generic;
using UnityEngine.Perception.GroundTruth;
using UnityEngine.Perception.Randomization.Parameters;
using UnityEngine.Perception.Randomization.Samplers;
namespace UnityEngine.Perception.Randomization.Scenarios
{

[AddComponentMenu("Perception/Scenarios/Fixed Length Scenario")]
public class FixedLengthScenario: UnitySimulationScenario<FixedLengthScenario.Constants>
{
protected PerceptionCamera m_PerceptionCamera;
/// <summary>
/// Constants describing the execution of this scenario
/// </summary>

/// Returns whether the current scenario iteration has completed
/// </summary>
protected override bool isIterationComplete => currentIterationFrame >= constants.framesPerIteration;
/// <inheritdoc/>
protected override void OnAwake()
{
base.OnAwake();
m_PerceptionCamera = FindObjectOfType<PerceptionCamera>();
if (m_PerceptionCamera != null && m_PerceptionCamera.captureTriggerMode != CaptureTriggerMode.Manual)
{
Debug.LogError("The perception camera must be set to manual capture mode", m_PerceptionCamera);
m_PerceptionCamera.enabled = false;
enabled = false;
}
}
/// <inheritdoc/>
protected override void OnUpdate()
{
if (m_PerceptionCamera && currentIterationFrame == constants.framesPerIteration - 1)
{
m_PerceptionCamera.RequestCapture();
}
}
}
}

50
com.unity.perception/Runtime/Randomization/Scenarios/ScenarioBase.cs


}
/// <summary>
/// A list of the addressable bundle catalog URLs to load before the scenario starts
/// </summary>
protected List<string> m_CatalogUrls = new List<string>();
/// <summary>
/// Maps bundle primary keys (the name of the bundle file) to the bundle's URL. Enables the addressable asset
/// system to use signed URLs for remote asset bundles.
/// </summary>
protected Dictionary<string, string> m_BundleToUrlMap = new Dictionary<string, string>();
#if UNITY_EDITOR
/// <summary>
/// A reference to a test app-param json file to enable app-param testing in the editor
/// </summary>
public TextAsset testAppParam;
#endif
/// <summary>
/// The current activity state of the scenario
/// </summary>
public State state { get; private set; } = State.Initializing;

/// The scenario will begin on the frame this property first returns true
/// </summary>
/// <returns>Whether the scenario should start this frame</returns>
protected abstract bool isScenarioReadyToStart { get; }
protected virtual bool isScenarioReadyToStart => true;
/// <summary>
/// Returns whether the current scenario iteration has completed

/// </summary>
protected virtual void OnConfigurationImport()
{
#if !UNITY_EDITOR
#if UNITY_EDITOR
if (testAppParam != null)
{
DeserializeFromFile(AssetDatabase.GetAssetPath(testAppParam));
}
#else
DeserializeFromCommandLine();
#endif
}

void Awake()
{
activeScenario = this;
OnAwake();
OnConfigurationImport();
OnAwake();
}
/// <summary>

case State.Initializing:
if (isScenarioReadyToStart)
{
OnConfigurationImport();
state = State.Playing;
OnStart();
foreach (var randomizer in m_Randomizers)

if (randomizer is T typedRandomizer)
return typedRandomizer;
throw new ScenarioException($"A Randomizer of type {typeof(T).Name} was not added to this scenario");
}
/// <summary>
/// Maps a bundle primary key to a specific URL
/// </summary>
/// <param name="bundle">The bundle's primary key (file name)</param>
/// <param name="url">The bundle's URL</param>
internal void AddBundleUrl(string bundle, string url)
{
m_BundleToUrlMap.Add(bundle, url);
}
/// <summary>
/// Specifies a catalog URL to load before starting the simulation
/// </summary>
/// <param name="url"></param>
internal void AddCatalogUrl(string url)
{
m_CatalogUrls.Add(url);
}
void ValidateParameters()

14
com.unity.perception/Runtime/Randomization/Scenarios/UnitySimulationScenario.cs


where T : UnitySimulationScenarioConstants, new()
{
/// <inheritdoc/>
protected override bool isScenarioReadyToStart
{
get
{
if (!Configuration.Instance.IsSimulationRunningInCloud() && !m_SkippedFirstFrame)
{
m_SkippedFirstFrame = true;
return false;
}
return true;
}
}
/// <inheritdoc/>
protected sealed override bool isScenarioComplete => currentIteration >= constants.totalIterations;
/// <inheritdoc/>

20
com.unity.perception/Runtime/Randomization/Scenarios/PerceptionScenario.cs


/// </summary>
MetricDefinition m_IterationMetricDefinition;
/// <summary>
/// The scriptable render pipeline hook used to capture perception data skips the first frame of the simulation
/// when running locally, so this flag is used to track whether the first frame has been skipped yet.
/// </summary>
protected bool m_SkippedFirstFrame;
/// <inheritdoc/>
protected override bool isScenarioReadyToStart
{
get
{
if (!m_SkippedFirstFrame)
{
m_SkippedFirstFrame = true;
return false;
}
return true;
}
}
/// <inheritdoc/>
protected override void OnAwake()
{

19
com.unity.perception/Runtime/Randomization/Scenarios/Serialization/ScenarioSerializer.cs


public static void Deserialize(ScenarioBase scenario, string json)
{
var jsonData = JObject.Parse(json);
if (jsonData.ContainsKey("contents"))
DeserializeContents(scenario, (JObject)jsonData["contents"]);
}
static void DeserializeContents(ScenarioBase scenario, JObject contentsData)
{
var catalogs = (JArray)contentsData["catalogs"];
foreach (var catalogToken in catalogs)
{
var catalog = (JObject)catalogToken;
scenario.AddCatalogUrl(catalog["catalogUrl"].Value<string>());
var bundles = (JArray) catalog["bundles"];
foreach (var bundleToken in bundles)
{
var bundle = (JObject) bundleToken;
scenario.AddBundleUrl(bundle["name"].Value<string>(), bundle["url"].Value<string>());
}
}
}
static void DeserializeConstants(ScenarioConstants constants, JObject constantsData)

14
com.unity.perception/Runtime/Randomization/Parameters/CategoricalParameter.cs


public T Sample()
{
var randomValue = m_Sampler.Sample();
return uniform
? m_Categories[(int)(randomValue * m_Categories.Count)]
: m_Categories[BinarySearch(randomValue)];
if (uniform)
{
var index = (int)(randomValue * m_Categories.Count);
if (index == m_Categories.Count)
{
index--;
}
return m_Categories[index];
}
return m_Categories[BinarySearch(randomValue)];
}
/// <summary>

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


continue;
if (!labeler.isInitialized)
labeler.Init(this);
continue;
labeler.InternalOnUpdate();
}

continue;
if (!labeler.isInitialized)
labeler.Init(this);
continue;
action(labeler);
}

13
com.unity.perception/Runtime/GroundTruth/Labelers/CameraLabeler.cs


internal void InternalCleanup() => Cleanup();
internal void InternalVisualize() => OnVisualize();
private bool m_ShowVisualizations = false;
bool m_ShowVisualizations;
/// <summary>
/// Turns on/off the labeler's realtime visualization capability. If a labeler does not support realtime
/// visualization (<see cref="supportsVisualization"/>) or visualization is not enabled on the PerceptionCamera

{
get
{
return supportsVisualization && m_ShowVisualizations;
}
get => !supportsVisualization || !perceptionCamera || perceptionCamera.showVisualizations;
set
{
if (!supportsVisualization) return;

m_ShowVisualizations = value;
OnVisualizerEnabledChanged(m_ShowVisualizations);
}
}

if (visualizationEnabled) OnVisualize();
}
internal void Init(PerceptionCamera newPerceptionCamera)
public void Init(PerceptionCamera newPerceptionCamera)
{
try
{

isInitialized = true;
m_ShowVisualizations = supportsVisualization && perceptionCamera.showVisualizations;
}
catch (Exception)
{

正在加载...
取消
保存