• N/A
  • 1.0
  • 05/12/2020
  • Public Content

Video Analytics Serving

In this tutorial, you will start Video Analytics Serving and run a command that is representative of a custom user application making an inference request using the RESTful interface. By following this tutorial you will:
  • Get familiar with starting the video analytics serving container and stopping a running container.
  • Learn how to run a sample application using the curl command to set the pipeline and video file.

Run Video Analytics Serving

Video Analytics Pipeline Serving is a containerized application that manages dependencies and execution through a set of configuration files and runtime interfaces. Video analytics serving defines the Pipeline interface, a simple interface for loading and executing pipeline definitions based on type. It leverages plugins for CNN model-based video analytics utilizing the .
For more information about video analytics serving and other modules in
Edge Insights for Retail
, see How it Works.
Step 1: Run Video Analytics Serving Container
  1. Prepare the
    container with the additional configuration it needs to display a window:
    xhost local:root
  2. Success is indicated by the message
    non-network local connections being added to access control list
    , as shown:
  3. Run
    . If this is your first time running this, it runs the
    image in a container. This takes 3 - 5 minutes to download information.
    sudo docker run --rm -d --privileged \ --net=host \ -v ~/.Xauthority:/root/.Xauthority \ -v /tmp/.X11-unix/:/tmp/.X11-unix/ \ -v /tmp:/tmp \ -e DISPLAY=$DISPLAY \ video_analytics_serving_gstreamer_edgex:0.2.2
    The command instructions are:
    docker run
    Starts the
    Cleans up the container and removes the file system upon exiting.
    Detached mode.
    Provides all capabilities to the container. This is used for xhost and port mapping.
    Mount the volume from the host opering system to the container.
    xhost uses these.
    image name.
  4. View the running video analytics pipeline container:
    sudo docker ps
    specifies that all running containers should be displayed.
    You see
    as shown:
Step 2: Run the Sample Application
You have more than one way to communicate with the RESTful interface. For simplicity, this guide uses the curl command to set the pipeline and video file:
curl localhost:8080/pipelines/object_detection/2 -X POST -H 'Content-Type: application/json' -d '{ "source": { "uri": "", "type": "uri" }}'
In this command, you are sending:
  • A curl request to localhost because the ports are mounted from the host OS to the container. This network access to the container is possible with privileged mode.
  • A JSON format text that shows the source video file.
The command instructions are:
The port.
Specifies a custom request method to use when communicating with the HTTP server.
(HTTP) Sends the specified data in a POST request to the HTTP server.
-H 'Content-Type application/json'
The content type. When you send a command, it needs to be in a JSON file.
'{ "source": { "uri": "", "type": "uri" }}'
Source path to the video.
You see the GUI application running the object detection pipeline. The application has a source URL of the video file,
, which is available on Github. The video displayed shows multiple bottles available with a bounding box around each detected bottle.
The GUI closes at the end of the video file. If you close the video file before it completes, the GUI in the host OS stops, but the Docker container execution continues. Stop the Docker container to stop the GUI from rendering.
If you get an error message:
  • Make sure you ran the xhost command.
  • Make sure you ran the
Step 3: Stop the Container
You must stop the container before running another tutorial. Two video analytics serving containers running at the same time conflict with network resources.
  1. Get a list of containers:
    sudo docker ps
    You see a 12-hex digit, as shown below. This is the container ID associated with the container that is running:
  2. Copy the container ID.
  3. Stop the container by including the container ID in the command:
    sudo docker stop <container ID>
    For example:
    sudo docker stop d1cfe2eb3aba

Summary and Next Steps

In this tutorial, you learned to start the video analytics serving and run a command that is representative of a custom user application making an inference request using the RESTful interface.
Your next step is to use the Real-time Sensor Fusion for Loss Detection Reference Implementation, which allows you to deploy sensor fusion technology for loss detection at self-checkout and enables a more seamless experience.

Product and Performance Information


Performance varies by use, configuration and other factors. Learn more at