Class OcclusionLabeler
This labeler reports a set of visibility metrics for each object that is visible within the frame. Each set contains 3 metrics:
- Percent Visible: The portion of an object that visible
- Percent In Frame: The portion of an object that is not occluded by the camera frame
- Visibility In Frame: The unoccluded portion of the part of an object that is in frame
Inherited Members
Namespace: UnityEngine.Perception.GroundTruth.Labelers
Assembly: Unity.Perception.Runtime.dll
Syntax
[Serializable]
[MovedFrom("UnityEngine.Perception.GroundTruth")]
public sealed class OcclusionLabeler : CameraLabeler
Remarks
The occlusion labeler operates in the following stages to generate a set of occlusion metrics for each visible object in the scene:
- Render each object one at a time to capture their in-frame unoccluded pixel count
- Render each object one at a time in a cube map while masking out the camera's field-of-view to obtain each object's out-of-frame pixel count
- Compare these two pixel count values against each object's instance segmentation pixel count to obtain the 3 occlusion metrics
Constructors
OcclusionLabeler()
Creates a new OcclusionLabeler. Be sure to assign idLabelConfig before adding to a PerceptionCamera.
Declaration
public OcclusionLabeler()
OcclusionLabeler(IdLabelConfig)
Creates a new OcclusionLabeler with an IdLabelConfig.
Declaration
public OcclusionLabeler(IdLabelConfig idLabelConfig)
Parameters
Type | Name | Description |
---|---|---|
IdLabelConfig | idLabelConfig | The IdLabelConfig which associates objects with labels. |
Fields
idLabelConfig
The IdLabelConfig which associates objects with labels.
Declaration
public IdLabelConfig idLabelConfig
Field Value
Type | Description |
---|---|
IdLabelConfig |
metricId
The string ID associated with this labeler.
Declaration
public string metricId
Field Value
Type | Description |
---|---|
string |
outOfFrameResolution
The OcclusionLabeler's cubemap capture resolution. Higher resolutions are more expensive to capture and increase the accuracy of calculated visibility metrics.
Declaration
[Tooltip("Adjust this parameter to control the cubemap resolution this labeler will use when rendering objects outside of the camera's field of view. Higher resolutions will increase accuracy at the expense of increased computational costs and slower capture frame rates.")]
[Range(32, 4096)]
public int outOfFrameResolution
Field Value
Type | Description |
---|---|
int |
Properties
description
A human-readable description of the labeler
Declaration
public override string description { get; }
Property Value
Type | Description |
---|---|
string |
Overrides
labelerId
The GUID id to associate with the data produced by this labeler.
Declaration
public override string labelerId { get; }
Property Value
Type | Description |
---|---|
string |
Overrides
supportsVisualization
Labelers should set this in their setup to define if they support realtime visualization of their data.
Declaration
protected override bool supportsVisualization { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
Methods
Cleanup()
Called when the Labeler is about to be destroyed or removed from the PerceptionCamera. Use this to clean up to state.
Declaration
protected override void Cleanup()
Overrides
OnBeginRendering(ScriptableRenderContext)
Called just before the camera renders each frame the the labeler is enabled and ShouldCaptureThisFrame is true.
Declaration
protected override void OnBeginRendering(ScriptableRenderContext scriptableRenderContext)
Parameters
Type | Name | Description |
---|---|---|
ScriptableRenderContext | scriptableRenderContext | The current context from the Scriptable Render Pipeline. |
Overrides
OnEndRendering(ScriptableRenderContext)
Called just after the camera renders each frame the the labeler is enabled and ShouldCaptureThisFrame is true.
Declaration
protected override void OnEndRendering(ScriptableRenderContext ctx)
Parameters
Type | Name | Description |
---|---|---|
ScriptableRenderContext | ctx | The current context from the Scriptable Render Pipeline. |
Overrides
Setup()
Called just before the first call to OnUpdate() or OnBeginRendering(ScriptableRenderContext). Implement this to initialize state.
Declaration
protected override void Setup()
Overrides
Events
occlusionMetricsComputed
An event that is called each frame for which occlusion metrics are calculated.
Declaration
public event Action<int, NativeArray<OcclusionMetricEntry>> occlusionMetricsComputed
Event Type
Type | Description |
---|---|
Action<int, NativeArray<OcclusionMetricEntry>> |