Labels - Interactml/iml-unreal GitHub Wiki

What are Labels?

A Label is the type of an Expected Output (associated with Parameters by the Example Recorder node when recording examples) or an Output (produced by the Machine Learning Robot node when running a model). These are the values associated with each set of parameter values and used by the model to indicate the set of parameters it recognises.

See Machine Learning for more on the function of Outputs 👉

Label Forms

A Label can take one of two forms:

  1. A simple numeric value (floating point number).
  2. A composite structured value (multiple values of a variety of types).

The Example Recorder and Machine Learning Robot nodes have properties to configure which of these forms are used for their input/output pins.

See Blueprint Nodes and Recording Examples#expected output or Running Models#output type for more on node configuration. 👉

Composite Labels

Composite label types are defined by creating and setting up a Label asset and selecting that in the node properties.

Label Asset Icon
Label
Definition of a composite Label,
the type of an Expected Output or Output

See Asset Types for more information on asset types 👉

Defining Label Types

Double-click on a Label Type asset to open the custom editing window.

💡 This is actually based on the built-in 🔗Blueprint Structure asset type and uses the same editing UI.

Here is an example showing three variables:

  1. Number - An integer value
  2. Coordinate - A 2D Vector (floating point) value
  3. Text - A text value

New label variables can be added/removed/edited here using the standard 🔗Unreal Blueprint Structure editing panel.

⚠️ It is important to mention that editing a Label Type will invalidate any recorded examples or trained models that are using this as an Expected Output or Ouput value. This will also invalidate Blueprint graphs using it and you will need to update/refresh/rebuild the graph around those nodes and their structure use.

Supported Types

Label definitions are based on Unreal structure definitions, but, InteractML labels can only support variables with the following data types:

  • Integer - All integer type (signed, unsigned, int, short, char, long)
  • Real - All floating point types (float, double)
  • Structures - Any structured types that contain compatible variable types, including more structures. (This means types like Colour and 2D Vectors are supported.)
  • Text - Both the Unreal Text and String types are supported
  • Bool - Mapped to 0 for false and 1 for true

⚠️ Use of unsupported types will result in "Unable to capture unsupported type" warnings in the Log Output window.

Working with Composite Labels

Labels (like Structure types) in Blueprints are represented as a single pin/wire type but they can be expanded out to their component elements in a variety of ways.

Making Label Values

When recording examples you will need to construct label values to feed into the Example Recorder node so they can be associated with the input parameters. This can either be done using the provided Make node:

  1. Drag away the input pin
  2. Select the provided Make*** entry in the popup
  3. Connect to the inputs of the new Make node

Alternately you can split the input pin directly on the Example Recorder Node:

  1. Right click on the Expected Output pin
  2. Select the "Split Struct Pin" option
  3. Connect directly to the individual structure pins on the node

Using Label Values

When you are running a model and need to use the composite label Output pin you can access the individual elements in a similar way. Either use the provided Break node:

  1. Drag away the output pin
  2. Select the provided Break*** entry in the popup
  3. Connect to the outputs of the new Break node

Alternately you can split the input pin directly on the Machine Learning Robot Node:

  1. Right click on the Output pin
  2. Select the "Split Struct Pin" option
  3. Connect directly to the individual structure pins on the node

Label Tables

When recording examples it can get quite complicated to provide a composite input type that has many variables within it, not to mention switching between different Output values. To help with this you can define a table of values to use as Expected Outputs and just reference rows in that table.

Creating Label Tables

Such a table is defined by creating a Label Table asset type (based on the existing Unreal DataTable asset type and view).

Lable Table Asset Icon
Label Table
List of Expected Output labels
each with explicit values assigned

Create a Label Table in your project using the InteractML section of the Content Browser context menu. When you do this you are prompted for the Label Type you want your table to be built for.

See Asset Types for more information on asset types 👉

See 🔗Data Driven Gameplay Elements for more on the Unreal DataTable asset type 👉

Label Table Entries

Opening the Label Table asset (double-click on it) brings up the standard Unreal data-table editor. Here is an example showing several rows for the example Label Type used previously.

From here you can:

  • Add/remove/re-arrange rows
  • Edit the variable values for each row
  • Import tables from CSV files

💡 Each row in a data-table has a name to uniquely identify it. This is required but actually really useful when presenting Expected Output selection to the user. Each row may not be easy to describe if it's just numerical values (for example) so having a name helps.

Using Label Tables

When recording examples you can look-up rows of the Label Table to provide the Expected Output for an Example Recorder node.

Here an index (perhaps from some selection UI) is used to lookup a table row (by name) and feed the Expected Output to be associated with the current Live Parameters. Each trigger of the Record input will associate the values in the table row with the parameters and store them in the Training Set.

💡 The values are recorded as a snapshot and so won't be affected by changes to the source Label Table entries if you edit them later. However, this may end up confusing matters because the values you obtain out of the model running them won't match the expected values in the table.

See Recording Examples for more on this 👉

Advanced Table Use

The ability to have structures of structures within a label type is very powerful. Combine this with Regression models which interpolate their output values and you open up all sorts of possibilities.

See the RegressionDemo_LightShow demo in the Demo Project for examples of this in action 👉


👈 Training Set | 🏠 Home | Your Data 👉

⚠️ **GitHub.com Fallback** ⚠️