Skip to main content
Skip table of contents

Graphs

A graph is a flow-based program that describes how synthetic data output, including images and other artifacts, will be generated.. The graph contains a set of functional capabilities represented as nodes. Nodes are connected by links to form the program.

Graphs are persisted as text files in YAML format. A graph file can be created by hand in a text editor or it can be created visually in the Rendered.ai web interface. Graph files can be uploaded to and downloaded from the web interface.

A graph is made up of nodes, values and links. Nodes are discrete functions that take input, process it, and produce output. Nodes have input ports and output ports. Input ports are either directly assigned a fixed data value or they can get their data value from other nodes. The flow of data between nodes is indicated by connecting an output port of a source node to an input port of a destination node.

The following figure shows an example of a graph in visual form:

Graph Files

Graph files can be built by hand in a text editor or they can be auto-generated from the Rendered.ai web interface.

Here is an example of a graph with a single node as shown in the graph editor:

The purpose of this node is to add an instance of a military tank to the synthetic data scene. The class of the node is “Tank” and it has an output port called “object_generator”. Note the node also has a name attribute but this is not displayed in the graphical user interface.

Here is the same graph persisted in YAML text file format.

YAML
version: 2
nodes:
  Tank_0:
    nodeClass: Tank
nodeLocations:
  Tank_0:
    x: -0.8408950169881209
    y: 28.892507553100586

The graph file contains three top level elements

  • “version” - This element defines the graph file language version number. In this example, the version is 2 which is the currently supported version.

  • “nodes” - This element is a dictionary that defines the nodes, links, and values that make up the graph. Each entry in the dictionary defines a node in the graph. The dictionary key is the the node name. The node class, any input values, and any input links are attributes of the node. In this example, there is a single node with the name “Tank_0” and it has a node class of “Tank”. This node has no input links or input values.

  • “nodeLocations” - This element is a dictionary that defines the screen coordinates of nodes as displayed in the graph editor. The dictionary key is the node name. Each entry has two attributes - the x and y coordinates. This element is optional but if you download a graph from the GUI then it is automatically generated using the current screen coordinates. In this example, the node named “Tank_0” has an x coordinate of -0.8408950169881209 and a y coordinate of 28.892507553100586.

Most graphs contain multiple nodes connected by links. Here is an example of a graph with two connected nodes:

The purpose of this graph is to add a tank to the scene and to also add snow to that tank. The snow will cover 50% of the tank.

Nodes can have input ports and output ports. In the graph editor, input ports are shown on the left side of the node and output ports are shown on the right side of the node. Connections between ports are shown as a line from the source node output port to the destination node input port. The line includes a caret symbol indicating the direction that data flows across the link.

In the example above, the Tank node has an output port called “object_generator” which is connected to an input port on the SnowModifier node which is also called “object_generator”. The SnowModifier node has a fixed value of “50” assigned to the input port “coverage”. The “object_generator” output port on the SnowModifier node is not connected to anything.

Here the same graph in YAML format:

YAML
version: 2
nodes:
  Tank_0:
    nodeClass: Tank
  SnowModifier_1:
    nodeClass: SnowModifier
    values:
      coverage: "50"
    links:
      object_generator:
        - sourceNode: Tank_0
          outputPort: object_generator

This is similar to the previous example but here the SnowModifier node also includes elements for input values and input links. These are defined as follows:

  • “values” - This element is a dictionary that specifies the fixed values that are assigned to input ports on the node, one entry per input port. The dictionary key is the input port name and the value is value assigned to that port. Fixed values can be any standard JSON scalar (integer, float, string, etc.), a list, or a dictionary. In the above example, the “coverage” input port has a fixed value of “50”.

  • “links” - This element is a dictionary that specifies the links coming into the node. Links are specified in the destination node definition with one entry per input port. The dictionary key is the input port name. Since an input port can have more than one incoming connection, link definitions are a list. The list entry for a link is a dictionary with two entries - the source node name and output port name that the link is originating from. In the above example, the SnowModifier_1 node has one incoming link connecting to its “object_generator” input port. The sourceNode for this link is node “Tank_0” and the outputPort on that node is “object_generator”.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.