Class SemanticSegmentationLabeler | Perception | 0.5.0-preview.1
docs.unity3d.com
    Show / Hide Table of Contents

    Class SemanticSegmentationLabeler

    Labeler which generates a semantic segmentation image each frame. Each object is rendered to the semantic segmentation image using the color associated with it based on the given SemanticSegmentationLabelConfig. Semantic segmentation images are saved to the dataset in PNG format.

    Only one SemanticSegmentationLabeler can render at once across all cameras.

    Inheritance
    Object
    CameraLabeler
    SemanticSegmentationLabeler
    Inherited Members
    CameraLabeler.enabled
    CameraLabeler.hudPanel
    CameraLabeler.perceptionCamera
    CameraLabeler.sensorHandle
    CameraLabeler.OnUpdate()
    CameraLabeler.OnVisualize()
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: UnityEngine.Perception.GroundTruth
    Syntax
    [Serializable]
    public sealed class SemanticSegmentationLabeler : CameraLabeler

    Constructors

    SemanticSegmentationLabeler()

    Creates a new SemanticSegmentationLabeler. Be sure to assign labelConfig before adding to a PerceptionCamera.

    Declaration
    public SemanticSegmentationLabeler()

    SemanticSegmentationLabeler(SemanticSegmentationLabelConfig, RenderTexture)

    Creates a new SemanticSegmentationLabeler with the given SemanticSegmentationLabelConfig.

    Declaration
    public SemanticSegmentationLabeler(SemanticSegmentationLabelConfig labelConfig, RenderTexture targetTextureOverride = null)
    Parameters
    Type Name Description
    SemanticSegmentationLabelConfig labelConfig

    The label config associating labels with colors.

    RenderTexture targetTextureOverride

    Override the target texture of the labeler. Will be reformatted on startup.

    Fields

    annotationId

    The id to associate with semantic segmentation annotations in the dataset.

    Declaration
    [Tooltip("The id to associate with semantic segmentation annotations in the dataset.")]
    public string annotationId
    Field Value
    Type Description
    String

    labelConfig

    The SemanticSegmentationLabelConfig which maps labels to pixel values.

    Declaration
    public SemanticSegmentationLabelConfig labelConfig
    Field Value
    Type Description
    SemanticSegmentationLabelConfig

    Properties

    description

    A human-readable description of the labeler

    Declaration
    public override string description { get; protected set; }
    Property Value
    Type Description
    String
    Overrides
    CameraLabeler.description

    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
    Boolean
    Overrides
    CameraLabeler.supportsVisualization

    targetTexture

    The RenderTexture on which semantic segmentation images are drawn. Will be resized on startup to match the camera resolution.

    Declaration
    public RenderTexture targetTexture { get; }
    Property Value
    Type Description
    RenderTexture

    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
    CameraLabeler.Cleanup()

    OnBeginRendering()

    Called just before the camera renders each frame the the labeler is enabled and ShouldCaptureThisFrame is true.

    Declaration
    protected override void OnBeginRendering()
    Overrides
    CameraLabeler.OnBeginRendering()

    OnVisualizeAdditionalUI()

    In this pass, a labeler can add custom GUI controls to the scene. Important note, all labeler's additional GUIs need to use Unity's Immediate Mode GUI (IMGUI) system. This called is triggered from call. This call happens immediately after the OnVisualize() so that the visualization components are drawn below the UI elements.

    Declaration
    protected override void OnVisualizeAdditionalUI()
    Overrides
    CameraLabeler.OnVisualizeAdditionalUI()

    OnVisualizerEnabledChanged(Boolean)

    Called when the labeler's visualization capability is turned on or off.

    Declaration
    protected override void OnVisualizerEnabledChanged(bool enabled)
    Parameters
    Type Name Description
    Boolean enabled
    Overrides
    CameraLabeler.OnVisualizerEnabledChanged(Boolean)

    Setup()

    Called just before the first call to OnUpdate() or OnBeginRendering(). Implement this to initialize state.

    Declaration
    protected override void Setup()
    Overrides
    CameraLabeler.Setup()

    Events

    imageReadback

    Event which is called each frame a semantic segmentation image is read back from the GPU.

    Declaration
    public event Action<SemanticSegmentationLabeler.ImageReadbackEventArgs> imageReadback
    Event Type
    Type Description
    Action<SemanticSegmentationLabeler.ImageReadbackEventArgs>
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023