Start OpenVINO* Python Application at Boot Time using System Service on Raspbian*

Documentation

Install & Setup

000055416

10/09/2019

Introduction

This guide provides users with steps for creating a system service to initialize OpenVINO™ toolkit environment variables and run the benchmark_app.py Python application for Raspbian*. This process may apply to other Linux* distributions but this guide was written to work for Raspbian*.

The steps below assume you have OpenVINO™ toolkit installed and that your installation has been verified. If you have not yet done so, please visit the following links:

System Requirements

  • Raspbian* Buster, 32-bit
  • Raspbian* Stretch, 32-bit

Steps to Create System Service File

  1. Install tools for benchmark_app.py and download necessary files:

    sudo pip install progress
    cd ~/
    wget --no-check-certificate https://download.01.org/opencv/2019/open_model_zoo/R1/models_bin/face-detection-adas-0001/FP16/face-detection-adas-0001.bin
    wget --no-check-certificate https://download.01.org/opencv/2019/open_model_zoo/R1/models_bin/face-detection-adas-0001/FP16/face-detection-adas-0001.xml
    wget https://pixabay.com/images/download/human-740259_640.jpg

  2. Create bash script to initialize OpenVINO environment variables and execute python script:

    vi ~/openvino-benchmark-app-script

    #!/bin/bash
    source /opt/intel/openvino/bin/setupvars.sh
    /usr/bin/python3 /opt/intel/openvino/deployment_tools/inference_engine/samples/python_samples/benchmark_app/benchmark_app.py -i /home/pi/human-740259_640.jpg -m /home/pi/face-detection-adas-0001.xml -d MYRIAD

  3. Change bash script file permissions and ownership:

    chmod u+x ~/openvino-benchmark-app-script

  4. Create service file under /etc/systemd/system with contents as shown below:

    sudo vi /etc/systemd/system/openvino-benchmark-app.service

    [Unit]
    Description=Init OpenVINO env and run python benchmark_app
    After=network.target

    [Service]
    ExecStart=/home/pi/openvino-benchmark-app-script
    WorkingDirectory=/home/pi
    StandardOutput=inherit
    StandardError=inherit
    Restart=on-failure
    User=pi

    [Install]
    WantedBy=multi-user.target

  5. Enable system service to start at boot and start system service:

    sudo systemctl enable openvino-benchmark-app.service
    sudo systemctl start openvino-benchmark-app.service

  6. To check system service status:

    sudo systemctl status openvino-benchmark-app.service

  7. Or to disable service during boot time, first stop service and then disable service:

    sudo systemctl stop openvino-benchmark-app.service
    sudo systemctl disable openvino-benchmark-app.service

For more information about system service for Linux*, please take a look at the manual page for systemd.

man systemd