浏览代码

current code on label bug

/Labelbug1101
Wesley Mareovich Smith 4 年前
当前提交
0ae9e239
共有 12 个文件被更改,包括 66 次插入25 次删除
  1. 14
      TestProjects/PerceptionURP/Packages/packages-lock.json
  2. 4
      TestProjects/PerceptionURP/ProjectSettings/ProjectVersion.txt
  3. 2
      TestProjects/PerceptionURP/ProjectSettings/QualitySettings.asset
  4. 2
      com.unity.perception/Runtime/GroundTruth/Labelers/BoundingBox3DLabeler.cs
  5. 2
      com.unity.perception/Runtime/GroundTruth/Labelers/BoundingBoxLabeler.cs
  6. 6
      com.unity.perception/Runtime/GroundTruth/Labelers/InstanceSegmentationLabeler.cs
  7. 2
      com.unity.perception/Runtime/GroundTruth/Labelers/ObjectCountLabeler.cs
  8. 8
      com.unity.perception/Runtime/GroundTruth/Labeling/IdLabelConfig.cs
  9. 6
      com.unity.perception/Runtime/GroundTruth/Labeling/LabelEntryMatchCache.cs
  10. 42
      com.unity.perception/Runtime/GroundTruth/PerceptionCamera_InstanceSegmentation.cs
  11. 1
      com.unity.perception/Runtime/GroundTruth/RenderedObjectInfoGenerator.cs
  12. 2
      com.unity.perception/Runtime/Randomization/Randomizers/RandomizerExamples/Randomizers/ForegroundObjectPlacementRandomizer.cs

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


"com.unity.burst": "1.3.9",
"com.unity.entities": "0.8.0-preview.8",
"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.simulation.capture": "0.0.10-preview.19",
"com.unity.simulation.core": "0.0.10-preview.22"
}
},
"com.unity.platforms": {

"url": "https://packages.unity.com"
},
"com.unity.simulation.capture": {
"version": "0.0.10-preview.16",
"depth": 0,
"version": "0.0.10-preview.19",
"depth": 1,
"com.unity.simulation.core": "0.0.10-preview.21"
"com.unity.simulation.core": "0.0.10-preview.22"
},
"url": "https://packages.unity.com"
},

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

4
TestProjects/PerceptionURP/ProjectSettings/ProjectVersion.txt


m_EditorVersion: 2019.4.16f1
m_EditorVersionWithRevision: 2019.4.16f1 (e05b6e02d63e)
m_EditorVersion: 2019.4.17f1
m_EditorVersionWithRevision: 2019.4.17f1 (667c8606c536)

2
TestProjects/PerceptionURP/ProjectSettings/QualitySettings.asset


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

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


entities.Dispose();
}
void OnRenderObjectInfosCalculated(int frameCount, NativeArray<RenderedObjectInfo> renderedObjectInfos)
void OnRenderObjectInfosCalculated(int frameCount, NativeArray<RenderedObjectInfo> renderedObjectInfos/*, List<IdLabelEntry> labelCache*/)
{
if (!m_AsyncAnnotations.TryGetValue(frameCount, out var asyncAnnotation))
return;

2
com.unity.perception/Runtime/GroundTruth/Labelers/BoundingBoxLabeler.cs


m_AsyncAnnotations[Time.frameCount] = perceptionCamera.SensorHandle.ReportAnnotationAsync(m_BoundingBoxAnnotationDefinition);
}
void OnRenderedObjectInfosCalculated(int frameCount, NativeArray<RenderedObjectInfo> renderedObjectInfos)
void OnRenderedObjectInfosCalculated(int frameCount, NativeArray<RenderedObjectInfo> renderedObjectInfos/*, List<IdLabelEntry> labelCache*/)
{
if (!m_AsyncAnnotations.TryGetValue(frameCount, out var asyncAnnotation))
return;

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


using System;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;

this.idLabelConfig = labelConfig;
}
void OnRenderedObjectInfosCalculated(int frame, NativeArray<RenderedObjectInfo> renderedObjectInfos)
void OnRenderedObjectInfosCalculated(int frame, NativeArray<RenderedObjectInfo> renderedObjectInfos/*, List<IdLabelEntry> labelCache*/)
{
if (!m_AsyncAnnotations.TryGetValue(frame, out var annotation))
return;

}
}
void OnImageCaptured(int frameCount, NativeArray<Color32> data, RenderTexture renderTexture)
void OnImageCaptured(int frameCount, NativeArray<Color32> data, RenderTexture renderTexture/*, List<IdLabelEntry> labelCache*/)
{
if (!m_AsyncAnnotations.ContainsKey(frameCount))
return;

2
com.unity.perception/Runtime/GroundTruth/Labelers/ObjectCountLabeler.cs


using System;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Unity.Collections;

8
com.unity.perception/Runtime/GroundTruth/Labeling/IdLabelConfig.cs


using System;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using JetBrains.Annotations;

m_LabelEntryMatchCache = new LabelEntryMatchCache(this);
return m_LabelEntryMatchCache.TryGetLabelEntryFromInstanceId(instanceId, out labelEntry, out index);
}
public static void GetIdLabelCache(out List<IdLabelEntry> cache)
{
cache = new List<IdLabelEntry>();// m_LabelEntries;
}
/// <inheritdoc/>

6
com.unity.perception/Runtime/GroundTruth/Labeling/LabelEntryMatchCache.cs


using System;
using System.Collections.Generic;
using Unity.Collections;
using Unity.Entities;

{
World.DefaultGameObjectInjectionWorld?.GetExistingSystem<GroundTruthLabelSetupSystem>()?.Deactivate(this);
m_InstanceIdToLabelEntryIndexLookup.Dispose();
}
public static implicit operator LabelEntryMatchCache(List<IdLabelEntry> v)
{
throw new NotImplementedException();
}
}
}

42
com.unity.perception/Runtime/GroundTruth/PerceptionCamera_InstanceSegmentation.cs


using System;
using System;
using Unity.Simulation;
using UnityEngine;
using UnityEngine.Experimental.Rendering;

/// Invoked when instance segmentation images are read back from the graphics system. The first parameter is the
/// Time.frameCount at which the objects were rendered. May be invoked many frames after the objects were rendered.
/// </summary>
public event Action<int, NativeArray<Color32>, RenderTexture> InstanceSegmentationImageReadback;
public event Action<int, NativeArray<Color32>, RenderTexture/*, List<IdLabelEntry>*/> InstanceSegmentationImageReadback;
public event Action<int, NativeArray<RenderedObjectInfo>> RenderedObjectInfosCalculated;
public event Action<int, NativeArray<RenderedObjectInfo>/*, List<IdLabelEntry>*/> RenderedObjectInfosCalculated;
RenderedObjectInfoGenerator m_RenderedObjectInfoGenerator;
RenderTexture m_InstanceSegmentationTexture;

m_InstanceSegmentationReader = new RenderTextureReader<Color32>(m_InstanceSegmentationTexture, myCamera, (frameCount, data, tex) =>
{
InstanceSegmentationImageReadback?.Invoke(frameCount, data, tex);
if (RenderedObjectInfosCalculated != null)
CaptureInstanceSegmentation(data);
});
}
void CaptureInstanceSegmentation(NativeArray<Color32> data)
{
//var myCache = new List<IdLabelEntry>();
IdLabelConfig.GetIdLabelCache(out var myCache);
var frameCount = Time.frameCount;
var width = m_InstanceSegmentationTexture.width;
CaptureRenderTexture.Capture(m_InstanceSegmentationTexture, request =>
{
var colorData = new NativeArray<Color32>(data, Allocator.Temp);
InstanceSegmentationImageReadback?.Invoke(frameCount, colorData, m_InstanceSegmentationTexture/*, myCache*/);
if(RenderedObjectInfosCalculated != null)
m_RenderedObjectInfoGenerator.Compute(data, tex.width, BoundingBoxOrigin.TopLeft, out var renderedObjectInfos, Allocator.Temp);
RenderedObjectInfosCalculated?.Invoke(frameCount, renderedObjectInfos);
m_RenderedObjectInfoGenerator.Compute(colorData, width,
BoundingBoxOrigin.TopLeft, /*myCache,*/ out var renderedObjectInfos, Allocator.Temp);
RenderedObjectInfosCalculated?.Invoke(frameCount, renderedObjectInfos/*, myCache*/);
myCache.Clear();
colorData.Dispose();
if (request.error)
{
return AsyncRequest.Result.Error;
}
return AsyncRequest.Result.Completed;
});
}

1
com.unity.perception/Runtime/GroundTruth/RenderedObjectInfoGenerator.cs


using System;
using System.Collections.Generic;
using Unity.Burst;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;

2
com.unity.perception/Runtime/Randomization/Randomizers/RandomizerExamples/Randomizers/ForegroundObjectPlacementRandomizer.cs


using System;
using System;
using System.Linq;
using UnityEngine.Perception.Randomization.Parameters;
using UnityEngine.Perception.Randomization.Randomizers.Utilities;

正在加载...
取消
保存