Service Usage Instructions

Display Microservice 0.1.0

Display Microservice will attach, decode and display on screen a BEV (Bird Eye View) RTSP stream, as well as the camera RTSP streams that generate the BEV. The service support any number of camera streams, but the Camera Microservice will also limit this amount.

By default the service will start the display pipeline with the camera streams available on the Camera service, as well as the BEV stream from the Media service. The BEV stream is always displayed, but you can select the specific camera streams to display, for this you need to give the service the configuration that contains the camera stream identifiers (used on the camera service configuration). This can be done parsing a JSON file when starting the service, or through the server with the configuration request. In eather case, the configuration is defined in a JSON format as follows:

{
    "inputs": {
        "cameras": [
            "cam0",
            "cam1"
    ],
    "heatmap": true
}

This configuration allows to include any number of cameras using this format. The identifies cam0, cam1, camN need to match the same names used on the Camera service to identify each camera.

Configuration entries:

  • cameras: The list of the camera names used on the Camera service to be displayed.

  • heatmap: Define whether a heatmap representing the engagement is shown or not on top of the BEV.

Running the service

Pre requisites

Before running the service, ensure that Deepstream and the Python bindings for Deepstream are installed. You can find installation instructions at the following links:

Note: The Docker container for the Display Microservice already includes these dependencies, so they do not need to be installed separately if you’re running the service using Docker.

Installation and Usage

The project is configured (via setup.py) to install the service with the name display. So to install it run:

pip install .

Then you will have the service with the following options:

usage: display [-h] [--port PORT] [--host HOST] [--config_file CONFIG_FILE]

options:
  -h, --help            show this help message and exit
  --port PORT           Port for server
  --host HOST           Server ip address
  --config_file CONFIG_FILE
                        JSON file with streams and heatmap configuration

To start the service in address 127.0.0.1 and port 5052 just run:

display

If you want to serve in a different port or address, use the –port and –host options.

Display Microservice Docker

Before starting with docker support make sure you have nvidia runtime in your system. Follow these instructions to have docker up and running in your Jetson Board.

Build the container

We can build this microservice container using the Dockerfile in the docker directory. This includes a base NVIDA image and the dependencies to run the display microservice application.

First, we need to prepare the context directory for this build, please create a directory and include all the needed repositories (listed below). The Dockerfile will look for all the source code in the context directory and copy them to the container.

display-context/
├── display
└── rrms-utils

Then build the Docker image running the following command from the folder containing the Dockerfile and context directory:

sudo docker build \
--network=host \
-f Dockerfile \
-t ridgerun/display-service:latest \
display-context/

Change display-context to your context’s path and the tag (-t) to the name you want to give to your image.

Launch the container

Before starting the container it is needed to allow the container to access the X server, enabling it to open the display window. For this use the command:

DISPLAY=:1 xhost +local:docker

Note: The DISPLAY variable may vary depending on your setup. In some cases, it could be DISPLAY=:0 instead of DISPLAY=:1. You can verify the correct value by running the following command on your board:

echo $DISPLAY

Now the container can be launched by running the following command:

sudo docker run \
-e DISPLAY=:1 \
--runtime nvidia \
-it \
--network host \
-v /tmp/argus_socket:/tmp/argus_socket \
--name display-service \
ridgerun/display-service:latest

You can modify the name you want to give to your container with the option –name.

Here we are creating a container called display-service that will start the display-service application in the default address and port, and with no initial configuration. The service will start and display the BEV and all the cameras available from the camera service. We need to make a API request to change this initial configuration or use an initial configuration file.

To start the service with an initial configuration file, or a different address or port has to be used, you can do it by running:

sudo docker run \
-e DISPLAY=:1 \
--runtime nvidia \
-it \
--network host \
-v /tmp/argus_socket:/tmp/argus_socket \
-v <configuration file path on host>:/init_config.json \
--name display-service \
ridgerun/display-service:latest \
--config_file /init_config.json --host=<host to be used> --port=<port to be used>