Class LabelEntryMatchCache
Cache of instance id -> label entry index for a LabelConfig. This is not well optimized and is the source of a known memory leak for apps that create new instances frequently.
Inherited Members
Namespace: UnityEngine.Perception.GroundTruth
Syntax
public class LabelEntryMatchCache : IGroundTruthGenerator, IDisposable
Methods
Dispose()
Declaration
public void Dispose()
Implements
TryGetLabelEntryFromInstanceId(UInt32, out IdLabelEntry, out Int32)
Retrieves the label entry for the given instance id.
Declaration
public bool TryGetLabelEntryFromInstanceId(uint instanceId, out IdLabelEntry labelEntry, out int index)
Parameters
| Type | Name | Description |
|---|---|---|
| UInt32 | instanceId | The instance id to look up |
| IdLabelEntry | labelEntry | The IdLabelEntry of the match if found. Otherwise returns .
|
| Int32 | index | The index of the matched IdLabelEntry in the IdLabelConfig if found. Otherwise returns -1. |
Returns
| Type | Description |
|---|---|
| Boolean | True if a the instance id was found in the cache. |
Explicit Interface Implementations
IGroundTruthGenerator.ClearMaterialProperties(MaterialPropertyBlock, Renderer, Labeling, UInt32)
Disables ground truth generation for a Labeling component or its associated MaterialPropertyBlock. This function is called by LabelManager when a Labeling component is disabled.
Declaration
void IGroundTruthGenerator.ClearMaterialProperties(MaterialPropertyBlock mpb, Renderer renderer, Labeling labeling, uint instanceId)
Parameters
| Type | Name | Description |
|---|---|---|
| MaterialPropertyBlock | mpb | The MaterialPropertyBlock for the given MeshRenderer. Can be used to set properties for custom rendering. |
| Renderer | renderer | The Renderer under the given LabelManager. |
| Labeling | labeling | The LabelManager component for which ground-truth generation should stop. |
| UInt32 | instanceId | The instanceId assigned to the given LabelManager instance. |
Implements
IGroundTruthGenerator.SetupMaterialProperties(MaterialPropertyBlock, Renderer, Labeling, UInt32)
Enables ground truth generation for a Labeling component or its associated MaterialPropertyBlock. This function is called by LabelManager when a Labeling component is registered, created, or enabled.
Declaration
void IGroundTruthGenerator.SetupMaterialProperties(MaterialPropertyBlock mpb, Renderer renderer, Labeling labeling, uint instanceId)
Parameters
| Type | Name | Description |
|---|---|---|
| MaterialPropertyBlock | mpb | The MaterialPropertyBlock for the given MeshRenderer. Can be used to set properties for custom rendering. |
| Renderer | renderer | The Renderer under the given LabelManager. |
| Labeling | labeling | The LabelManager component that was registered, created, or enabled |
| UInt32 | instanceId | The instanceId assigned to the given LabelManager instance. |