How to change Deep Learning Streamer pipeline#

Steps#

DL Streamer Pipeline Server supports dynamic update of pipeline parameters using REST API. Users are expected to provide the required placeholders in [WORKDIR]/edge-ai-libraries/microservices/dlstreamer-pipeline-server/configs/default/config.json to make it configurable at run-time of DL Streamer Pipeline Server container.

In case users want to update the default pipeline, they need to update the same in the configuration file loaded by DL Streamer Pipeline Server. Users can mount updated config files from host systems on to DL Streamer Pipeline Server containers by updating [WORKDIR]/edge-ai-libraries/microservices/dlstreamer-pipeline-server/docker/docker-compose.yml. To pull the image and start the container, refer to the steps mentioned here.

Refer to the below snippets:

    volumes:
      # Volume mount [WORKDIR]/edge-ai-libraries/microservices/dlstreamer-pipeline-server/configs/default/config.json to config file that DL Streamer Pipeline Server container loads."
      - "../configs/default/config.json:/home/pipeline-server/config.json"

As an example we are creating video-ingestion and resize pipeline. We need to update the pipeline key in [WORKDIR]/edge-ai-libraries/microservices/dlstreamer-pipeline-server/configs/default/config.json as shown below. It will create a DL Streamer pipeline that reads the user provided video file, decodes it, and resizes it to 1280x720.

"pipeline": "{auto_source} ! decodebin ! videoscale ! video/x-raw, width=1280,height=720 ! gvametapublish name=destination ! appsink name=appsink",

Note: If needed users can change pipeline name by updating name key in config.json. If user is updating this field, accordingly endpoint in curl request needs to be changed to <SERVER-IP>:<PORT>/pipelines/user_defined_pipelines/<NEW-NAME>. In this example, we are only changing the pipeline.

Once updated, the user needs to restart DL Streamer Pipeline Server containers to reflect this change. Run these commands from the [WORKDIR]/edge-ai-libraries/microservices/dlstreamer-pipeline-server/docker/ folder.

Note: To get you started, instruction to create sample docker compose file is available here

docker compose down

docker compose up

The above steps will restart DL Streamer Pipeline Server and load the video-ingestion and resize pipeline. Now, to start this pipeline, run below Curl request. It will start the DL Streamer pipeline that reads the classroom.avi video file with resolution of 1920x1080 and after resizing to 1280x720, it will stream over RTSP. Users can view this on any media player, e.g. vlc, ffplay, etc.

RTSP Stream will be accessible at rtsp://<SYSTEM_IP_ADDRESS>:8554/classroom-video-streaming.

curl localhost:8080/pipelines/user_defined_pipelines/pallet_defect_detection -X POST -H 'Content-Type: application/json' -d '{
                "source": {
                    "uri": "file:///home/pipeline-server/resources/videos/classroom.avi",
                    "type": "uri"
                },
                "destination": {
                   "metadata": {
                        "type": "file",
                        "path": "/tmp/results.jsonl",
                        "format": "json-lines"
                    },
                    "frame": {
                        "type": "rtsp",
                        "path": "classroom-video-streaming"
                    }
                }
}'