浏览代码

Merge branch 'master' into manual_capture_2

/manual_capture
GitHub 4 年前
当前提交
89b0bc75
共有 25 个文件被更改,包括 160 次插入74 次删除
  1. 1
      .gitignore
  2. 4
      TestProjects/PerceptionHDRP/Assets/Terrain Data.asset
  3. 10
      TestProjects/PerceptionHDRP/Packages/manifest.json
  4. 26
      TestProjects/PerceptionHDRP/Packages/packages-lock.json
  5. 4
      TestProjects/PerceptionHDRP/ProjectSettings/PackageManagerSettings.asset
  6. 4
      TestProjects/PerceptionHDRP/ProjectSettings/ProjectVersion.txt
  7. 8
      TestProjects/PerceptionURP/Packages/manifest.json
  8. 26
      TestProjects/PerceptionURP/Packages/packages-lock.json
  9. 4
      TestProjects/PerceptionURP/ProjectSettings/PackageManagerSettings.asset
  10. 11
      TestProjects/PerceptionURP/ProjectSettings/ProjectSettings.asset
  11. 4
      TestProjects/PerceptionURP/ProjectSettings/ProjectVersion.txt
  12. 2
      TestProjects/PerceptionURP/ProjectSettings/QualitySettings.asset
  13. 4
      TestProjects/PerceptionURP/ProjectSettings/UnityConnectSettings.asset
  14. 6
      com.unity.perception/CHANGELOG.md
  15. 27
      com.unity.perception/Documentation~/Randomization/Parameters.md
  16. 6
      com.unity.perception/Runtime/GroundTruth/Labelers/SemanticSegmentationLabeler.cs
  17. 4
      com.unity.perception/Runtime/GroundTruth/SemanticSegmentationCrossPipelinePass.cs
  18. 18
      com.unity.perception/Runtime/Randomization/Scenarios/ScenarioBase.cs
  19. 12
      com.unity.perception/Tests/Runtime/GroundTruthTests/PerceptionCameraIntegrationTests.cs
  20. 6
      com.unity.perception/package.json
  21. 3
      com.unity.perception/Editor/Utilities.meta
  22. 3
      com.unity.perception/Editor/Utilities/ParameterUIElementsEditor.cs.meta
  23. 33
      com.unity.perception/Editor/Utilities/ParameterUIElementsEditor.cs
  24. 8
      TestProjects/PerceptionURP/Assets/StreamingAssets.meta

1
.gitignore


/.download
**/Build/**
**/Builds/**
/utr

4
TestProjects/PerceptionHDRP/Assets/Terrain Data.asset
文件差异内容过多而无法显示
查看文件

10
TestProjects/PerceptionHDRP/Packages/manifest.json


{
"dependencies": {
"com.unity.collab-proxy": "1.2.16",
"com.unity.ext.nunit": "1.0.0",
"com.unity.ext.nunit": "1.0.5",
"com.unity.ide.vscode": "1.2.1",
"com.unity.ide.vscode": "1.2.3",
"com.unity.simulation.capture": "0.0.10-preview.13",
"com.unity.simulation.core": "0.0.10-preview.19",
"com.unity.test-framework": "1.1.16",
"com.unity.simulation.capture": "0.0.10-preview.16",
"com.unity.simulation.core": "0.0.10-preview.21",
"com.unity.test-framework": "1.1.19",
"com.unity.testtools.codecoverage": "0.2.2-preview",
"com.unity.textmeshpro": "2.0.1",
"com.unity.ugui": "1.0.0",

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


"url": "https://packages.unity.com"
},
"com.unity.ext.nunit": {
"version": "1.0.0",
"version": "1.0.5",
"depth": 0,
"source": "registry",
"dependencies": {},

"url": "https://packages.unity.com"
},
"com.unity.ide.vscode": {
"version": "1.2.1",
"version": "1.2.3",
"depth": 0,
"source": "registry",
"dependencies": {},

"com.unity.render-pipelines.core": "7.1.6",
"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.14",
"com.unity.simulation.core": "0.0.10-preview.20"
"com.unity.simulation.client": "0.0.10-preview.10",
"com.unity.simulation.capture": "0.0.10-preview.16",
"com.unity.simulation.core": "0.0.10-preview.21"
}
},
"com.unity.platforms": {

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

"version": "0.0.10-preview.20",
"depth": 1,
"version": "0.0.10-preview.21",
"depth": 0,
"version": "1.1.16",
"version": "1.1.19",
"com.unity.ext.nunit": "1.0.0",
"com.unity.ext.nunit": "1.0.5",
"com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0"
},

4
TestProjects/PerceptionHDRP/ProjectSettings/PackageManagerSettings.asset


m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 0}
m_Script: {fileID: 13960, guid: 0000000000000000e000000000000000, type: 0}
m_EditorClassIdentifier: UnityEditor:UnityEditor.PackageManager.UI:PackageManagerProjectSettings
m_EditorClassIdentifier:
m_ScopedRegistriesSettingsExpanded: 1
oneTimeWarningShown: 0
m_Registries:

4
TestProjects/PerceptionHDRP/ProjectSettings/ProjectVersion.txt


m_EditorVersion: 2019.4.12f1
m_EditorVersionWithRevision: 2019.4.12f1 (225e826a680e)
m_EditorVersion: 2019.4.16f1
m_EditorVersionWithRevision: 2019.4.16f1 (e05b6e02d63e)

8
TestProjects/PerceptionURP/Packages/manifest.json


"dependencies": {
"com.unity.collab-proxy": "1.2.16",
"com.unity.ide.rider": "1.1.4",
"com.unity.ide.vscode": "1.2.1",
"com.unity.ide.vscode": "1.2.3",
"com.unity.simulation.capture": "0.0.10-preview.13",
"com.unity.simulation.core": "0.0.10-preview.19",
"com.unity.test-framework": "1.1.16",
"com.unity.simulation.capture": "0.0.10-preview.16",
"com.unity.simulation.core": "0.0.10-preview.21",
"com.unity.test-framework": "1.1.19",
"com.unity.textmeshpro": "2.0.1",
"com.unity.timeline": "1.2.12",
"com.unity.ugui": "1.0.0",

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


"url": "https://packages.unity.com"
},
"com.unity.ext.nunit": {
"version": "1.0.0",
"version": "1.0.5",
"depth": 1,
"source": "registry",
"dependencies": {},

"url": "https://packages.unity.com"
},
"com.unity.ide.vscode": {
"version": "1.2.1",
"version": "1.2.3",
"depth": 0,
"source": "registry",
"dependencies": {},

"com.unity.render-pipelines.core": "7.1.6",
"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.14",
"com.unity.simulation.core": "0.0.10-preview.20"
"com.unity.simulation.client": "0.0.10-preview.10",
"com.unity.simulation.capture": "0.0.10-preview.16",
"com.unity.simulation.core": "0.0.10-preview.21"
}
},
"com.unity.platforms": {

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

"version": "0.0.10-preview.20",
"depth": 1,
"version": "0.0.10-preview.21",
"depth": 0,
"version": "1.1.16",
"version": "1.1.19",
"com.unity.ext.nunit": "1.0.0",
"com.unity.ext.nunit": "1.0.5",
"com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0"
},

4
TestProjects/PerceptionURP/ProjectSettings/PackageManagerSettings.asset


m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 0}
m_Script: {fileID: 13960, guid: 0000000000000000e000000000000000, type: 0}
m_EditorClassIdentifier: UnityEditor:UnityEditor.PackageManager.UI:PackageManagerProjectSettings
m_EditorClassIdentifier:
m_ScopedRegistriesSettingsExpanded: 1
oneTimeWarningShown: 0
m_Registries:

11
TestProjects/PerceptionURP/ProjectSettings/ProjectSettings.asset


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

webGLWasmStreaming: 0
scriptingDefineSymbols: {}
platformArchitecture: {}
scriptingBackend: {}
scriptingBackend:
Standalone: 0
il2cppCompilerConfiguration: {}
managedStrippingLevel: {}
incrementalIl2cppBuild: {}

XboxOneCapability: []
XboxOneGameRating: {}
XboxOneIsContentPackage: 0
XboxOneEnhancedXboxCompatibilityMode: 0
XboxOneEnableGPUVariability: 1
XboxOneSockets: {}
XboxOneSplashScreen: {fileID: 0}

m_VersionCode: 1
m_VersionName:
apiCompatibilityLevel: 6
cloudProjectId:
cloudProjectId: 7f560aa0-0da3-47a1-88e7-3884d7922bdd
projectName:
organizationId:
projectName: New Unity Project
organizationId: jonhunity
cloudEnabled: 0
enableNativePlatformBackendsForNewInputSystem: 0
disableOldInputManagerSupport: 0

4
TestProjects/PerceptionURP/ProjectSettings/ProjectVersion.txt


m_EditorVersion: 2019.4.12f1
m_EditorVersionWithRevision: 2019.4.12f1 (225e826a680e)
m_EditorVersion: 2019.4.16f1
m_EditorVersionWithRevision: 2019.4.16f1 (e05b6e02d63e)

2
TestProjects/PerceptionURP/ProjectSettings/QualitySettings.asset


skinWeights: 2
textureQuality: 0
anisotropicTextures: 1
antiAliasing: 2
antiAliasing: 0
softParticles: 0
softVegetation: 1
realtimeReflectionProbes: 1

4
TestProjects/PerceptionURP/ProjectSettings/UnityConnectSettings.asset


UnityConnectSettings:
m_ObjectHideFlags: 0
serializedVersion: 1
m_Enabled: 0
m_Enabled: 1
m_TestMode: 0
m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events
m_EventUrl: https://cdp.cloud.unity3d.com/v1/events

m_EventUrl: https://perf-events.cloud.unity3d.com
m_Enabled: 0
m_Enabled: 1
m_LogBufferSize: 10
m_CaptureEditorExceptions: 1
UnityPurchasingSettings:

6
com.unity.perception/CHANGELOG.md


Added AnimationCurveSampler, which returns random values according to a range and probability distribution denoted by a user provided AnimationCurve.
Added ParameterUIElementsEditor class to allow custom ScriptableObjects and MonoBehaviours to render Parameter and Sampler typed public fields correctly in their inspector windows.
### Changed

ScenarioBase.Serialize() now not only serializes scenario constants, but also all sampler member fields on randomizers attached to the scenario
Semantic Segmentation Labeler now places data in folders with randomized filenames
### Deprecated

Randomizer.OnCreate() is no longer called in edit-mode when adding a randomizer to a scenario
Fixed a bug where removing all randomizers from a scenario caused the randomizer container UI element to overflow over the end of Scenario component UI
Semantic Segmentation Labeler now produces output in the proper form for distributed data generation on Unity Simulation by placing output in randomized directory names
## [0.6.0-preview.1] - 2020-12-03

27
com.unity.perception/Documentation~/Randomization/Parameters.md


1. `CategoricalParameter`
2. `NumericParameter`
## Using Parameters outside of Randomizers (ie: in MonoBehaviours and ScriptableObjects)
After adding a public Parameter field to a MonoBehaviour or ScriptableObject, you may have noticed that the Parameter's UI doesn't look the same as it does when added to a Randomizer. This is because the Inspector UI for most Perception randomization components is authored using Unity's relatively new UI Elements framework, though by default, Unity uses the old IMGUI framework to render default inspector editors.
Say you have the following CustomMonoBehaviour that has a public GameObjectParameter field:
```
using UnityEngine;
using UnityEngine.Experimental.Perception.Randomization.Parameters;
public class CustomMonoBehaviour : MonoBehaviour
{
public GameObjectParameter prefabs;
}
```
To force Unity to use UI Elements to render your CustomMonoBehaviour's inspector window, create a custom editor for your MonoBehaviour by deriving the ParameterUIElementsEditor class like so:
```
using UnityEditor;
using UnityEngine.Experimental.Perception.Editor;
[CustomEditor(typeof(CustomMonoBehaviour))]
public class TestClusterEditor : DefaultUIElementsEditor { }
```
### Categorical Parameters
Categorical parameters choose a value from a list of options that have no intrinsic ordering. For example, a material paramater randomly chooses from a list of material options, but the list of material options itself can be rearranged into any particular order without affecting the distribution of materials selected.

### Numeric Parameters
Numeric parameters use samplers to generate randomized structs. Take a look at the [ColorHsvaParameter]() class included in the perception package for an example on how to implement a numeric parameter.
Numeric parameters use samplers to generate randomized structs. Take a look at the [ColorHsvaParameter]() class included in the perception package for an example on how to implement a numeric parameter.

6
com.unity.perception/Runtime/GroundTruth/Labelers/SemanticSegmentationLabeler.cs


const string k_SemanticSegmentationDirectory = "SemanticSegmentation";
const string k_SegmentationFilePrefix = "segmentation_";
internal string m_SemanticSegmentationDirectory;
/// <summary>
/// The id to associate with semantic segmentation annotations in the dataset.

targetTexture.Create();
targetTexture.name = "Labeling";
m_SemanticSegmentationDirectory = k_SemanticSegmentationDirectory + Guid.NewGuid();
#if HDRP_PRESENT
var gameObject = perceptionCamera.gameObject;

if (!m_AsyncAnnotations.TryGetValue(frameCount, out var annotation))
return;
var datasetRelativePath = $"{k_SemanticSegmentationDirectory}/{k_SegmentationFilePrefix}{frameCount}.png";
var localPath = $"{Manager.Instance.GetDirectoryFor(k_SemanticSegmentationDirectory)}/{k_SegmentationFilePrefix}{frameCount}.png";
var datasetRelativePath = $"{m_SemanticSegmentationDirectory}/{k_SegmentationFilePrefix}{frameCount}.png";
var localPath = $"{Manager.Instance.GetDirectoryFor(m_SemanticSegmentationDirectory)}/{k_SegmentationFilePrefix}{frameCount}.png";
annotation.ReportFile(datasetRelativePath);

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


protected override void ExecutePass(ScriptableRenderContext renderContext, CommandBuffer cmd, Camera camera, CullingResults cullingResult)
{
if (s_LastFrameExecuted == Time.frameCount)
{
Debug.LogError("Semantic segmentation was run twice in the same frame. Multiple semantic segmentations are not currently supported.");
}
return;
s_LastFrameExecuted = Time.frameCount;
var renderList = CreateRendererListDesc(camera, cullingResult, "FirstPass", 0, m_OverrideMaterial, -1);

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


{
static ScenarioBase s_ActiveScenario;
const string k_ScenarioIterationMetricDefinitionId = "DB1B258E-D1D0-41B6-8751-16F601A2E230";
MetricDefinition m_IterationMetricDefinition;
IEnumerable<Randomizer> activeRandomizers
{

// Don't skip the first frame if executing on Unity Simulation
if (Configuration.Instance.IsSimulationRunningInCloud())
m_SkipFrame = false;
m_IterationMetricDefinition = DatasetCapture.RegisterMetricDefinition("scenario_iteration", "Iteration information for dataset sequences",
Guid.Parse(k_ScenarioIterationMetricDefinitionId));
}
void OnEnable()

Debug.Log($"No configuration file found at {defaultConfigFilePath}. " +
"Proceeding with built in scenario constants and randomizer settings.");
#endif
}
struct IterationMetricData
{
public int iteration;
}
void Update()

{
DatasetCapture.StartNewSequence();
SamplerState.randomState = SamplerUtility.IterateSeed((uint)currentIteration, genericConstants.randomSeed);
DatasetCapture.ReportMetric(m_IterationMetricDefinition, new[]
{
new IterationMetricData()
{
iteration = currentIteration
}
});
foreach (var randomizer in activeRandomizers)
randomizer.IterationStart();
}

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


[UnityTest]
public IEnumerator EnableSemanticSegmentation_GeneratesCorrectDataset([Values(true, false)] bool enabled)
{
SemanticSegmentationLabeler semanticSegmentationLabeler = null;
pc.AddLabeler(new SemanticSegmentationLabeler(CreateSemanticSegmentationLabelConfig()));
semanticSegmentationLabeler = new SemanticSegmentationLabeler(CreateSemanticSegmentationLabelConfig());
pc.AddLabeler(semanticSegmentationLabeler);
}, enabled);
string expectedImageFilename = $"segmentation_{Time.frameCount}.png";

{
var capturesPath = Path.Combine(DatasetCapture.OutputDirectory, "captures_000.json");
var capturesJson = File.ReadAllText(capturesPath);
var imagePath = $"SemanticSegmentation/{expectedImageFilename}";
var imagePath = $"{semanticSegmentationLabeler.m_SemanticSegmentationDirectory}/{expectedImageFilename}";
StringAssert.Contains(imagePath, capturesJson);
}
else

[UnityTest]
public IEnumerator Disabled_GeneratesCorrectDataset()
{
SemanticSegmentationLabeler semanticSegmentationLabeler = null;
pc.AddLabeler(new SemanticSegmentationLabeler(CreateSemanticSegmentationLabelConfig()));
semanticSegmentationLabeler = new SemanticSegmentationLabeler(CreateSemanticSegmentationLabelConfig());
pc.AddLabeler(semanticSegmentationLabeler);
});
string expectedImageFilename = $"segmentation_{Time.frameCount}.png";

var capturesPath = Path.Combine(DatasetCapture.OutputDirectory, "captures_000.json");
var capturesJson = File.ReadAllText(capturesPath);
var imagePath = $"SemanticSegmentation/{expectedImageFilename}";
var imagePath = $"{semanticSegmentationLabeler.m_SemanticSegmentationDirectory}/{expectedImageFilename}";
StringAssert.Contains(imagePath, capturesJson);
}

6
com.unity.perception/package.json


"com.unity.render-pipelines.core": "7.1.6",
"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.14",
"com.unity.simulation.core": "0.0.10-preview.20"
"com.unity.simulation.client": "0.0.10-preview.10",
"com.unity.simulation.capture": "0.0.10-preview.16",
"com.unity.simulation.core": "0.0.10-preview.21"
},
"description": "Tools for generating large-scale data sets for perception-based machine learning training and validation",
"displayName": "Perception",

3
com.unity.perception/Editor/Utilities.meta


fileFormatVersion: 2
guid: 7c33b05b860544a5a026b97302d0358e
timeCreated: 1611791860

3
com.unity.perception/Editor/Utilities/ParameterUIElementsEditor.cs.meta


fileFormatVersion: 2
guid: ec638a81755645739ca5834e2e44fc13
timeCreated: 1611791890

33
com.unity.perception/Editor/Utilities/ParameterUIElementsEditor.cs


using UnityEditor.UIElements;
using UnityEngine.UIElements;
namespace UnityEngine.Experimental.Perception.Editor
{
/// <summary>
/// Derive this class to force the Unity Editor to render the default inspector using UIElements for an Object that includes a Parameter field.
/// to allow parameter UIs to render properly
/// </summary>
public abstract class ParameterUIElementsEditor : UnityEditor.Editor
{
public override VisualElement CreateInspectorGUI()
{
var rootElement = new VisualElement();
CreatePropertyFields(rootElement);
return rootElement;
}
void CreatePropertyFields(VisualElement rootElement)
{
var iterator = serializedObject.GetIterator();
iterator.NextVisible(true);
do
{
if (iterator.name == "m_Script")
continue;
var propertyField = new PropertyField(iterator.Copy());
propertyField.Bind(serializedObject);
rootElement.Add(propertyField);
} while (iterator.NextVisible(false));
}
}
}

8
TestProjects/PerceptionURP/Assets/StreamingAssets.meta


fileFormatVersion: 2
guid: 01c33d1bbfad749909de900dc92115a0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存