NVIDIA GXF Installation and Examples

From RidgeRun Developer Wiki


The Graph Composer suite of tools is purposefully designed to empower users, in effortlessly crafting and launching high-performance AI applications. Utilizing an intuitive GUI and requiring minimal or no C/C++ coding, these tools adhere to the fundamental concept of a graph based on GXF_Specification. The suite offers a comprehensive ecosystem that spans from extension development to graph deployment, making it particularly accessible for users without extensive technical backgrounds. It simplifies the process, allowing users to develop graphs without deep knowledge of the underlying framework (such as GStreamer).


Installation

To utilize the Graph Composer, you'll require the following:

  • An x86 host machine.
  • A device enabled with Deepstream.

If your host machine can run Deepstream, a separate device may not be necessary.

You can follow the guide here to install the required debians.

Building a Graph

Sync Extensions

First and foremost, it is imperative that the gxf server remains operational on the target machine.

gxf_server

Furthermore, the composer must be appropriately configured to utilize the server, even if it is running on a remote machine. To achieve this configuration, follow these steps:

1. Navigate to the Edit menu.

2. Access the Preferences window.

3. Modify the port number in the server tab and, if necessary, adjust the IP port.

Next, proceed with the following steps:

1. Open the Registry menu from the top menubar.

2. Click on Sync Repo.

3. From the drop-down list, select ngc-public.

4. Click on Sync.

Upon completion of these steps, you will gain access to NVIDIA's nodes for utilization within the graph.

Building a Graph

Creating a simple graph can be done as shown in the following graph:

All elements can be seamlessly dragged and dropped from the repository list on the left and connected through the graphical user interface (GUI).

A more complex graph with DeepStream, which reads from a file runs an inference and displays it on the screen may resemble the following:

In this instance, the following elements are employed:

  • Source plugin component for input
  • Mux plugin component, as the infer plugin component necessitates a mux before it
  • Video inference plugin component with the peoplenet model
  • OSD (On-Screen Display) plugin component to draw bounding boxes
  • Render plugin component to display the output

Once content with the configuration, save it in YAML format, which can later be loaded into as shown in the next section.

Running the Graph

From the Composer

To execute the graph, ensure that the gxf_server is running, and the composer is directed to the correct IP and Port, as detailed in the preceding section.

Upon execution, you will be prompted for the appropriate platform configuration file (aarch64 or x86_64), which can be found in /opt/graph-composer/config/ on the machine where the composer is installed. Select the appropriate configuration.

Click on "Run."

You should be able to see the following result in the Jetson's display:

From Command Line

The execute_graph.sh script, bundled with the graph composer, facilitates graph execution and provides additional functionality.

To execute a graph locally, use the following command:

/opt/nvidia/graph-composer/execute_graph.sh <graph-file> -d <graph-target>

For example, on a dGPU host, run:

/opt/nvidia/graph-composer/execute_graph.sh <graph-file> -d /opt/nvidia/graph-composer/config/target_x86_64.yaml

To execute on a remote Jetson target, run:

/opt/nvidia/graph-composer/execute_graph.sh <graph-file> -d /opt/nvidia/graph-composer/config/target_aarch64.yaml -t <username@host> --target-env-vars "DISPLAY=:0"


After some initial graph composer-specific output and GStreamer output, the graph will start outputting the person counting into the terminal:

$ /opt/nvidia/graph-composer/execute_graph.sh deepstream-test1.yaml -d /opt/nvidia/graph-composer/config/target_aarch64.yaml --target-env-vars "DISPLAY=:0"
...
Running...
Source 0: Frame Number = 0 Total objects = 7 [ Car:3 Person:4 ]
Source 0: Frame Number = 1 Total objects = 7 [ Car:3 Person:4 ]
Source 0: Frame Number = 2 Total objects = 7 [ Car:3 Person:4 ]
Source 0: Frame Number = 3 Total objects = 8 [ Car:4 Person:4 ]
Source 0: Frame Number = 4 Total objects = 10 [ Car:4 Person:6 ]
Source 0: Frame Number = 5 Total objects = 9 [ Car:4 Person:5 ]
Source 0: Frame Number = 6 Total objects = 5 [ Car:3 Person:2 ]
Source 0: Frame Number = 7 Total objects = 7 [ Car:4 Person:3 ]
Source 0: Frame Number = 8 Total objects = 7 [ Car:3 Person:4 ]

Develop a new extension of a GstElement

To proceed with the following steps, ensure that the DeepStream 6.3 SDK and the Reference Graphs package are installed. Alternatively, you can use the DeepStream 6.3 development container image.

Create a text file containing the list of GStreamer elements for which the extensions are to be generated. Each line should specify the name of one element. Ensure that the listed elements are already installed on the system. Here is an example:

timeoverlay
filesrc
filesink

Generating Extension Source Code

To generate the extension source code, execute the following command:

python3 /opt/nvidia/deepstream/deepstream/tools/graph_extension_generator/generate_extensions.py <element_list.txt> <output-directory>

Navigating to the Output Directory

Change to the output directory using the following command:

cd <output-directory>

Building and Registering the Extension for x86_64

Run the following command to build and register the extension for x86_64:

bazel build ...

Building and Registering the Extension for Jetson

To build and register the extension for Jetson, use the following command:

bazel build ... --config=jetson

References

https://docs.nvidia.com/metropolis/deepstream/dev-guide/graphtools-docs/docs/text/GraphComposer_intro.html