Class DatasetCapture
Global manager for frame scheduling and output capture for simulations. Data capture follows the schema defined in TODO: Expose schema publicly
Inherited Members
Namespace: UnityEngine.Perception.GroundTruth
Syntax
public static class DatasetCapture
Properties
SchemaVersion
The json metadata schema version the DatasetCapture's output conforms to.
Declaration
public static string SchemaVersion { get; }
Property Value
Type | Description |
---|---|
String |
Methods
RegisterAnnotationDefinition(String, String, String, Guid)
Creates an annotation type, which can be used to produce annotations during the simulation. See ReportAnnotationFile(AnnotationDefinition, String), ReportAnnotationValues<T>(AnnotationDefinition, T[]) and ReportAnnotationAsync(AnnotationDefinition).
Declaration
public static AnnotationDefinition RegisterAnnotationDefinition(string name, string description = null, string format = "json", Guid id = default(Guid))
Parameters
Type | Name | Description |
---|---|---|
String | name | Human readable annotation spec name (e.g. sementic_segmentation, instance_segmentation, etc.) |
String | description | Description of the annotation. |
String | format | Optional format name. |
Guid | id | The ID for this annotation type. This allows annotation types to be shared across simulations and sequences. |
Returns
Type | Description |
---|---|
AnnotationDefinition | An AnnotationDefinition. If the given |
RegisterAnnotationDefinition<TSpec>(String, TSpec[], String, String, Guid)
Creates an annotation type, which can be used to produce annotations during the simulation. See ReportAnnotationFile(AnnotationDefinition, String), ReportAnnotationValues<T>(AnnotationDefinition, T[]) and ReportAnnotationAsync(AnnotationDefinition).
Declaration
public static AnnotationDefinition RegisterAnnotationDefinition<TSpec>(string name, TSpec[] specValues, string description = null, string format = "json", Guid id = default(Guid))
Parameters
Type | Name | Description |
---|---|---|
String | name | Human readable annotation spec name (e.g. sementic_segmentation, instance_segmentation, etc.) |
TSpec[] | specValues | Format-specific specification for the annotation values (ex. label-value mappings for semantic segmentation images) |
String | description | Description of the annotation. |
String | format | Optional format name. |
Guid | id | The ID for this annotation type. This allows annotation types to be shared across simulations and sequences. |
Returns
Type | Description |
---|---|
AnnotationDefinition | An AnnotationDefinition. If the given |
Type Parameters
Name | Description |
---|---|
TSpec | The type of the values for the spec array in the resulting json. |
RegisterEgo(String)
Register a new ego. Used along with RegisterSensor to organize sensors under a top-level ego container. RegisterSensor(EgoHandle, String, String, Single, Single)
Declaration
public static EgoHandle RegisterEgo(string description)
Parameters
Type | Name | Description |
---|---|---|
String | description | A human-readable description for the ego |
Returns
Type | Description |
---|---|
EgoHandle | An EgoHandle, which can be used to organize sensors under a common ego. |
RegisterMetricDefinition(String, String, Guid)
Creates a metric type, which can be used to produce metrics during the simulation. See ReportMetric<T>(MetricDefinition, T[]), ReportMetricAsync(MetricDefinition), ReportMetric<T>(MetricDefinition, T[]), ReportMetricAsync(MetricDefinition), ReportMetric<T>(MetricDefinition, T[]), ReportMetricAsync(MetricDefinition)
Declaration
public static MetricDefinition RegisterMetricDefinition(string name, string description = null, Guid id = default(Guid))
Parameters
Type | Name | Description |
---|---|---|
String | name | Human readable annotation spec name (e.g. sementic_segmentation, instance_segmentation, etc.) |
String | description | Description of the annotation. |
Guid | id | The ID for this metric. This allows metric types to be shared across simulations and sequences. |
Returns
Type | Description |
---|---|
MetricDefinition | A MetricDefinition, which can be used during this simulation to report metrics. |
RegisterMetricDefinition<TSpec>(String, TSpec[], String, Guid)
Creates a metric type, which can be used to produce metrics during the simulation. See ReportMetric<T>(MetricDefinition, T[]), ReportMetricAsync(MetricDefinition), ReportMetric<T>(MetricDefinition, T[]), ReportMetricAsync(MetricDefinition), ReportMetric<T>(MetricDefinition, T[]), ReportMetricAsync(MetricDefinition)
Declaration
public static MetricDefinition RegisterMetricDefinition<TSpec>(string name, TSpec[] specValues, string description = null, Guid id = default(Guid))
Parameters
Type | Name | Description |
---|---|---|
String | name | Human readable annotation spec name (e.g. sementic_segmentation, instance_segmentation, etc.) |
TSpec[] | specValues | Format-specific specification for the metric values. Will be converted to json automatically. |
String | description | Description of the annotation. |
Guid | id | The ID for this metric. This allows metric types to be shared across simulations and sequences. |
Returns
Type | Description |
---|---|
MetricDefinition | A MetricDefinition, which can be used during this simulation to report metrics. |
Type Parameters
Name | Description |
---|---|
TSpec | The type of the |
RegisterSensor(EgoHandle, String, String, Single, Single)
Register a new sensor under the given ego.
Declaration
public static SensorHandle RegisterSensor(EgoHandle egoHandle, string modality, string description, float period, float firstCaptureTime)
Parameters
Type | Name | Description |
---|---|---|
EgoHandle | egoHandle | The ego container for the sensor. Sensor orientation will be reported in the context of the given ego. |
String | modality | The kind of the sensor (ex. "camera", "lidar") |
String | description | A human-readable description of the sensor (ex. "front-left rgb camera") |
Single | period | The period, in seconds, on which the sensor should capture. Frames will be scheduled in the simulation such that each sensor is triggered every period seconds. |
Single | firstCaptureTime | The time, in seconds, from the start of the sequence on which this sensor should first be scheduled. |
Returns
Type | Description |
---|---|
SensorHandle | A SensorHandle, which should be used to check ShouldCaptureThisFrame each frame to determine whether to capture (or render) that frame. It is also used to report captures, annotations, and metrics on the sensor. |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown if ego is invalid. |
ReportMetric(MetricDefinition, String)
Report a metric not associated with any sensor or annotation.
Declaration
public static void ReportMetric(MetricDefinition metricDefinition, string valuesJsonArray)
Parameters
Type | Name | Description |
---|---|---|
MetricDefinition | metricDefinition | The MetricDefinition associated with this metric. RegisterMetricDefinition(String, String, Guid) |
String | valuesJsonArray | A string-based JSON array to be placed in the "values" field of the metric |
ReportMetric<T>(MetricDefinition, T[])
Report a metric not associated with any sensor or annotation.
Declaration
public static void ReportMetric<T>(MetricDefinition metricDefinition, T[] values)
Parameters
Type | Name | Description |
---|---|---|
MetricDefinition | metricDefinition | The MetricDefinition associated with this metric. RegisterMetricDefinition(String, String, Guid) |
T[] | values | An array to be converted to json and put in the "values" field of the metric |
Type Parameters
Name | Description |
---|---|
T | The type of the |
ReportMetricAsync(MetricDefinition)
Report a metric not associated with any sensor or annotation.
Declaration
public static AsyncMetric ReportMetricAsync(MetricDefinition metricDefinition)
Parameters
Type | Name | Description |
---|---|---|
MetricDefinition | metricDefinition | The metric definition of the metric being reported |
Returns
Type | Description |
---|---|
AsyncMetric | An AsyncMetric which should be used to report the metric values, potentially in a later frame |
ResetSimulation()
Stop the current simulation and start a new one. All pending data is written to disk before returning.
Declaration
public static void ResetSimulation()
StartNewSequence()
Starts a new sequence in the capture.
Declaration
public static void StartNewSequence()
Events
SimulationEnding
Called when the simulation ends. The simulation ends on playmode exit, application exit, or when ResetSimulation() is called.
Declaration
public static event Action SimulationEnding
Event Type
Type | Description |
---|---|
Action |