Documentation

  • N/A
  • 20.12
  • 04/07/2021
  • Public Content
  • Download as PDF

Pedestrian Detection

This tutorial demonstrates deploying and executing
OpenVINO™
pedestrian detection on the OpenNESS edge platform. This tutorial uses the pre-trained
OpenVINO™
model,
pedestrian-detection-adas-0002
.
This tutorial demonstrates the
OpenVINO™
application using simulated video streaming and video playback in the following activities:
  1. Launch Kubernetes* Dashboard
    – Kubernetes* Dashboard is a web-based user interface to manage cluster resources, deploy applications and troubleshoot. The steps will help you generate the access token and launch the dashboard.
  2. Deploy the OpenVINO™ Application
    – Deploy and manage the
    OpenVINO™
    edge application from the Edge Controller to the Edge Node.
  3. Simulate the IP Camera Stream
    – Use the Rainy_street.mp4 video file to simulate an IP Camera stream and send it to the
    OpenVINO™
    application on the Edge Node.
  4. Start the Application
    – Start the
    OpenVINO™
    inference application for Pedestrian Detection inside the pod.
  5. Verify Inference
    – Start a video playback to visualize the inference video.
  6. Stop the Application
    – Stop the application and delete the
    OpenVINO™
    application.
Figure: Pedestrian Detection Tutorial Activities

Step 1: Launch the Kubernetes* Dashboard

The following sections will show
<Controller_IP>
in the URLs listed. Make note of your Edge Controller’s IP address and substitute it in these instructions. For a single-node installation, the
<Controller_IP>
is the same as your device IP address. To verify this, you can get the
INTERNAL-IP
of the node(s) using the command:
kubectl get node -o wide
The Kubernetes Dashboard helps you manage the cluster and edge applications through the web-based UI.
  1. Open a terminal and login as a root user:
    su root
    If the operating system was pre-installed on your hardware, refer to your manufacturer’s documentation for the root password.
  2. Get the Kubernetes dashboard URL and token. Run the following script on the Edge Controller system and wait for a few seconds, because token generation takes time:
    /root/get_controller_token.sh
    You are required to generate a new token by running this script whenever you want to log into the Dashboard, because the Token is valid only for the active session. The Kubernetes Dashboard will time out after 10 minutes of inactivity. To disable the timeout, see Known Issues.
    You will see the Dashboard URL and token generated in the terminal:
    Figure: Output of get_controller_token.sh
  3. Use the Firefox* browser to launch and sign into the Kubernetes Dashboard using the URL generated on the terminal and the token for authentication. The Firefox* browser allows you to log in to the Dashboard without additional configuration. You may be required to configure browser settings if other browsers are used. The URL will be https://<Controller-IP>
    The Kubernetes Dashboard uses self-signed certificates. In the Firefox* browser, you might need to click on Advanced and Accept the Risk and Continue.
    Figure: Kubernetes Dashboard Sign In
  4. You will see the following screen after a successful sign-in.
    You might see a different dashboard and different services after login, compared to the image below.
    Figure: Kubernetes Dashboard Overview
  5. Verify the status of the Edge Controller that you installed in the Dashboard. Select the Cluster > Nodes tab in the Dashboard, as shown in the following image:
    If the device is installed in single-node installation, you will only see one device. In addition, you might see a different device/node name based on the configuration.
    Figure: Kubernetes Dashboard Overview - Single Node
    The green-circled checkmark beside the Edge Controller label (under the Names column of the Nodes screen) indicates that the nodes are healthy.
Troubleshooting:
  • If the status of the Edge Controller changes from
    Ready
    (appears in green in the dashboard) to
    NotReady
    (appears in gray in the dashboard) after system reboot, then run the commands shown below on the respective systems and wait for few seconds:
    swapoff -a systemctl restart kubelet

Step 2: Deploy the
OpenVINO™
Application

In this step, you deploy the
OpenVINO™
application from the Edge Controller. The application is containerized and stored in the local Harbor* registry hosted at the Edge Controller.
  1. Verify the
    OpenVINO™
    application is available in the local Harbor* registry:
    curl -X GET 'https://<Controller-IP>:30003/api/v2.0/projects/intel/repositories' -H 'accept: application/json' -k --cacert /etc/docker/certs.d/<Controller-IP>:30003/harbor.crt -u 'admin:Harbor12345' |jq | grep -w 'openvino-cons-app'
    Figure: Verify
    OpenVINO™
    Application Availability
    Verify that the
    openvino-cons-app
    is available in the list of images. Other images are also available in the local Harbor registry targeted towards different use cases.
  2. Deploy a network policy allowing ingress traffic on port 5000 (tcp and udp) from 192.168.1.0/24 network to the
    OpenVINO™
    consumer application pod as follows:
    1. Create a new file named
      network_policy.yml
      in the current working directory and add the following specification to the file:
      Make sure to maintain the indentation for the following code snippet.
      apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: openvino-policy namespace: default spec: podSelector: matchLabels: name: openvino-cons-app policyTypes: - Ingress ingress: - from: - ipBlock: cidr: 192.168.1.0/24 ports: - protocol: TCP port: 5000 - protocol: UDP port: 5000
    2. Create the network policy:
      kubectl apply -f network_policy.yml
  3. Start the
    OpenVINO™
    application. This command downloads the app named
    openvino-cons-app
    , which is around 2 GB in size and contains the
    OpenVINO™
    application, libraries and inference model.
    cd /root/converged_edge_insights/Converged_Edge_Insights_<version>/Sample_OpenVINO_Application_for_OpenNESS/edgeapps/applications/openvino/consumer/ kubectl apply -f openvino-cons-app.yaml kubectl certificate approve openvino-cons-app
  4. Open the Kubernetes dashboard. View the status, log, and the device in which the pods are deployed.
    The logs for a pod can be viewed using the following command:
    kubectl logs -f -n <namespace> <pod_name>
    Where
    <pod_name>
    is similar to:
    openvino-con-app-6744f45755-l4d6m
    Figure: Kubernetes Dashboard Overview after successful application deployment
Troubleshooting:
  • If the status of openvino-cons-app deployment appears Red, then run the following command to stop the deployment and continue again with the previous step providing the correct IP address.
    kubectl delete deployment openvino-cons-app
    If the deployment does not appear to be removed from the dashboard or the status shows as terminating, run the following commands to force the termination to complete:
    swapoff -a systemctl restart kubelet

Step 3: Simulate the IP Camera Stream

In this step, you use the Edge Controller for video stream simulation. This example uses a video file to simulate an IP camera video stream.
  1. In the terminal, run the following command to install ffmpeg server, download the video file and start simulating the video file:
    cd /root/converged_edge_insights/Converged_Edge_Insights_<version>/Sample_OpenVINO_Application_for_OpenNESS/ chmod a+x simulate-video-stream.sh ./simulate-video-stream.sh
    Where
    <version>
    is the version selected before downloading the package.
  2. After download and build, the
    Rainy_Street.mp4
    file will start streaming to the
    OpenVINO™
    pod. You will see output similar to the image shown below. Let this continue in this terminal and proceed to the next step. The "
    RFC 2435…
    " message is normal and expected.
    Figure: Sample of Streaming Simulation Output

Step 4: Start the Application

In this step, you start the Pedestrian Detection
OpenVINO™
application in the pod. You must be logged in as the root user.
  1. Open a new terminal and login as a root user:
    su root
  2. Run the following commands to update the
    OpenVINO™
    Kubernetes pod to start the application and stream inference video back to the Edge Controller.
    cd /root/converged_edge_insights/Converged_Edge_Insights_<version>/Sample_OpenVINO_Application_for_OpenNESS/ chmod a+x start-application.sh ./start-application.sh
    Where
    <version>
    is the version selected before downloading the package.
  3. Let this continue in this terminal and proceed to the next step. The messages "
    RTP timestamps don’t match
    ", "
    Received packet without a start chunk; dropping frame
    ", and "
    Missing packets; dropping frame
    " are all expected outputs that do not invalidate the execution.
    Figure: Start Application and Stream Inference Video

Step 5: Verify Inference

In this step you use a command-line media player to see the rendered data. You must be logged on as the root user.
  1. Open a new terminal and login as a root user:
    su root
  2. Locally see the rendered data:
    setenforce 0 systemctl stop firewalld.service ffplay rtp://127.0.0.1:5001
    The video playback of inferenced data begins. If your bandwidth is poor, data frames (packets) might be missed and you will see latency in the video stream output visualization. This does not affect the validity of the demonstration.
    Figure: Rendered Video Output
    The rendered video shows a view from the street detecting people and creating bounding boxes around each recognized person.
In this application, we have seen that the
OpenVINO™
pod deployed in the Edge Controller is able to perform the inference on the video stream sent using IP camera simulation. The output video is streamed back from the
OpenVINO™
application to the device for playback.
This tutorial also highlights that you can deploy and manage an
OpenVINO™
application to the Edge Controller through a Kubernetes cluster.

Step 6: Stop the Application

  1. Close the video playback application by clicking the
    X
    icon on the top right of the window or by pressing
    Ctrl+C
    in the terminal from which it was launched.
  2. Stop the
    OpenVINO™
    application by pressing
    Ctrl+C
    in the terminal where it was running.
  3. Close the simulate IP Camera application using
    Ctrl+Z
    command in the terminal.
  4. To delete the
    OpenVINO™
    application from the Edge Controller and re-enable the firewall, run the following commands as root:
    kubectl delete deployment openvino-cons-app systemctl start firewalld.service
    If the deployment does not appear to be removed from the dashboard or the status shows as terminating, run the following commands to force the termination to complete:
    swapoff -a systemctl restart kubelet

Summary and Next Steps

In this tutorial, you learned how the
OpenVINO™
toolkit and OpenNESS work together to detect objects in video streams transmitted by the Edge Nodes.
Your next step is to use the Wireless Network-Ready Intelligent Traffic Management Reference Implementation to learn how to implement a solution that identifies collisions and near misses using a pre-trained Single Shot Object Detection (SSD) model.

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.