Deploy with Helm#

This section provides step-by-step instructions for deploying the Loitering Detection application using Helm.

The estimated time to complete this procedure is 30 minutes.

Get Started#

Complete this section to confirm that your setup is working correctly and try out workflows in the sample application.

Prerequisites#

  • System Requirements

  • K8s installation on single or multi node must be done as pre-requisite to continue the following deployment. Note: The kubernetes cluster is set up with kubeadm, kubectl and kubelet packages on single and multi nodes with v1.30.2. Refer to online tutorials (such as https://adamtheautomator.com/install-kubernetes-ubuntu) to setup kubernetes cluster on the web with host OS as Ubuntu 22.04.

  • For Helm installation, refer to the Helm website

Note: If Ubuntu Desktop is not installed on the target system, follow the instructions from Ubuntu to install Ubuntu desktop.

Step 1: Download the Helm chart#

Follow this procedure on the target system to download the package.

Note: Skip this step if you have already followed the steps as part of the Get Started guide.

Before you can deploy with Helm, you must clone the repository and download the helm chart:

# Clone the repository
git clone https://github.com/open-edge-platform/edge-ai-suites.git

# Navigate to the Metro AI Suite directory
cd edge-ai-suites/metro-ai-suite/metro-vision-ai-app-recipe/

Optional: Pull the helm chart and replace the existing helm-chart folder with it

Note: The helm chart should be downloaded when you are not using the helm chart provided in edge-ai-suites/metro-ai-suite/metro-vision-ai-app-recipe/loitering-detection/helm-chart.

#Navigate to Loitering Detection directory
cd loitering-detection

#Download helm chart with the following command
helm pull oci://registry-1.docker.io/intel/loitering-detection --version 1.4.0-rc1

#unzip the package using the following command
tar -xvf loitering-detection-1.4.0-rc1.tgz

#Replace the helm directory
rm -rf helm-chart && mv loitering-detection helm-chart

cd ..

Step 2: Configure and update the environment variables#

  1. Update the following fields in values.yaml file in the Helm chart:

        # Edit the values.yml file to add proxy configuration
        nano ./loitering-detection/helm-chart/values.yaml
    
    HOST_IP: # replace localhost with system IP example: HOST_IP: 10.100.100.100
    http_proxy: # example: http_proxy: http://proxy.example.com:891
    https_proxy: # example: http_proxy: http://proxy.example.com:891
    webrtcturnserver:
        username: # example: username: myuser
        password: # example: password: mypassword
    

    Note: To make use of GPU / NPU set the property privileged_access_required to true in the above values.yaml file.

Step 3: Deploy the application and Run multiple AI pipelines#

Follow this procedure to run the sample application. In a typical deployment, multiple cameras deliver video streams that are connected to AI pipelines to improve the classification and recognition accuracy. The following demonstrates running multiple AI pipelines and visualization in the Grafana.

  1. Deploy Helm chart

    helm install loitering-detection ./loitering-detection/helm-chart -n ld  --create-namespace
    
  2. Wait for all pods to be ready:

    kubectl wait --for=condition=ready pod --all -n ld --timeout=300s
    
  3. Start the application with the Client URL (cURL) command by replacing the <HOST_IP> with the Node IP. (Total 8 places)

curl -k https://<HOST_IP>:30443/api/pipelines/user_defined_pipelines/object_tracking_cpu -X POST -H 'Content-Type: application/json' -d '
{
    "source": {
        "uri": "file:///home/pipeline-server/videos/VIRAT_S_000101.mp4",
        "type": "uri"
    },
    "destination": {
        "metadata": {
            "type": "mqtt",
            "topic": "object_tracking_1",
            "publish_frame":false
        },
        "frame": {
            "type": "webrtc",
            "peer-id": "object_tracking_1"
        }
    },
    "parameters": {
        "detection-device": "CPU"
    }
}'

curl -k https://<HOST_IP>:30443/api/pipelines/user_defined_pipelines/object_tracking_cpu -X POST -H 'Content-Type: application/json' -d '
{
    "source": {
        "uri": "file:///home/pipeline-server/videos/VIRAT_S_000102.mp4",
        "type": "uri"
    },
    "destination": {
        "metadata": {
            "type": "mqtt",
            "topic": "object_tracking_2",
            "publish_frame":false
        },
        "frame": {
            "type": "webrtc",
            "peer-id": "object_tracking_2"
        }
    },
    "parameters": {
        "detection-device": "CPU"
    }
}'

curl -k https://<HOST_IP>:30443/api/pipelines/user_defined_pipelines/object_tracking_cpu -X POST -H 'Content-Type: application/json' -d '
{
    "source": {
        "uri": "file:///home/pipeline-server/videos/VIRAT_S_000103.mp4",
        "type": "uri"
    },
    "destination": {
        "metadata": {
            "type": "mqtt",
            "topic": "object_tracking_3",
            "publish_frame":false
        },
        "frame": {
            "type": "webrtc",
            "peer-id": "object_tracking_3"
        }
    },
    "parameters": {
        "detection-device": "CPU"
    }
}'

curl -k https://<HOST_IP>:30443/api/pipelines/user_defined_pipelines/object_tracking_cpu -X POST -H 'Content-Type: application/json' -d '
{
    "source": {
        "uri": "file:///home/pipeline-server/videos/VIRAT_S_000104.mp4",
        "type": "uri"
    },
    "destination": {
        "metadata": {
            "type": "mqtt",
            "topic": "object_tracking_4",
            "publish_frame":false
        },
        "frame": {
            "type": "webrtc",
            "peer-id": "object_tracking_4"
        }
    },
    "parameters": {
        "detection-device": "CPU"
    }
}'

Note: To run the pipeline on GPU replace object_tracking_cpu with object_tracking_gpu and change value of detection-device to GPU for all the above pipelines . Simimlarly, to run the pipeline on NPU replace object_tracking_cpu with object_tracking_npu and change value of detection-device to NPU for all the above pipelines and change .

  1. View the Grafana and WebRTC streaming on https://<HOST_IP>:30443/grafana/.

    • Log in with the following credentials:

      • Username: admin

      • Password: admin

    • Check under the Dashboards section for the default dashboard named “Video Analytics Dashboard”.

Example of Grafana and WebRTC streaming Figure 1: Grafana and WebRTC streaming

Step 4: End the demonstration#

Follow this procedure to stop the sample application and end this demonstration.

  1. Stop the sample application with the following command that uninstalls the release loitering-detection.

    helm uninstall loitering-detection -n ld
    
  2. Confirm the pods are no longer running.

    kubectl get pods -n ld
    

Error Logs#

View the container logs using the following command:

```sh
kubectl logs -f <pod_name> -n ld
```

Troubleshooting#

Refer to Troubleshooting Helm Deployments for troubleshooting.