LoginSignup
3
1

More than 3 years have passed since last update.

Install Ubuntu 19.10 aarch64 on RaspberryPi4 and build and install OpenVINO for aarch64 (arm64) [Native Build ver.]

Posted at

1.Introduction

This article describes the procedure for introducing 64bit Ubuntu 19.10 to RaspberryPi4. And, this article describes how to build and install OpenVINO (dldt) and OpenCV aarch64.

2.Environment

  • RaspberryPi4
  • Ubuntu 19.10 aarch64
  • OpenCV 4.2.0-dev
  • dldt 2019

3.Procedure

3−1.Install Ubuntu 19.10 aarch64 on RaspberryPi4

Install Ubuntu 19.10 aarch64 on RaspberryPi4 by referring to the following article.
How to install Ubuntu 19.10 aarch64 (64bit) on RaspberryPi4

3−2.Build and install OpenVINO (dldt) on RaspberryPi4

Follow the steps below to build the latest OpenCV and build and install OpenVINO (dldt). The reason is that the latest modules of OpenCV and OpenVINO have no officially published pre-built binaries for aarch64 (arm64), and we need to build and install everything on our own. An error occurs during the build of dldt due to the difference in compiler version, but please be assured that it describes how to avoid the error.

Preparing_and_building_OpenCV
$ cd ~
$ wget https://github.com/Kitware/CMake/releases/download/v3.14.4/cmake-3.14.4.tar.gz
$ tar xvzf cmake-3.14.4.tar.gz
$ cd ~/cmake-3.14.4
$ ./bootstrap
$ sudo make –j4
$ sudo make install

$ sudo apt install -y git libgtk2.0-dev pkg-config libavcodec-dev libpython3-dev \
                      libavformat-dev libswscale-dev python3-pip libusb-1.0-0-dev
$ sudo pip3 install pip --upgrade
$ sudo pip3 install numpy cython

$ git clone --depth 1 https://github.com/opencv/opencv.git
$ cd opencv && mkdir build && cd build
$ sudo cmake –DCMAKE_BUILD_TYPE=Release –DCMAKE_INSTALL_PREFIX=/usr/local ..
$ sudo make –j4

Screenshot 2020-01-03 21:23:03.png

Install_OpenCV
$ sudo make install

Screenshot 2020-01-03 21:24:29.png

Preparation_for_dldt_build
$ cd ~
$ git clone -b 2019 https://github.com/opencv/dldt.git
$ cd ~/dldt/inference-engine
$ git submodule init
$ git submodule update --recursive
$ sh ./install_dependencies.sh
Setting_OpenCV_binary_path
$ export OpenCV_DIR=/usr/local/lib
dldt_cmake
$ cd ~/dldt/inference-engine
$ mkdir build && cd build

$ sudo cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DENABLE_MKL_DNN=OFF \
    -DENABLE_CLDNN=OFF \
    -DENABLE_GNA=OFF \
    -DENABLE_SSE42=OFF \
    -DTHREADING=SEQ \
    -DENABLE_PYTHON=ON \
    -DPYTHON_EXECUTABLE=/usr/bin/python3.7 \
    -DPYTHON_LIBRARY=/usr/lib/aarch64-linux-gnu/libpython3.7m.so \
    -DPYTHON_INCLUDE_DIR=/usr/include/python3.7 ..
cmake_log
-- The C compiler identification is GNU 9.2.1
-- The CXX compiler identification is GNU 9.2.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- GEMM should be set to MKL, OPENBLAS or JIT. Default option is JIT
-- CMAKE_BUILD_TYPE: Release
-- INTEL_VTUNE_DIR is not defined
-- Could NOT find INTEL_ITT (missing: Located_ITT_INCLUDE_DIRS Located_ITT_LIBS) 
-- Detected 64 bit architecture
-- Inference Engine enabled features: 

    CI_BUILD_NUMBER: custom_2019_b0c5accaf8e0c0fac17aaef688478d7f391d05bb
    ENABLE_GNA = OFF
    ENABLE_ROCKHOPER = ON
    ENABLE_MKL_DNN = OFF
    ENABLE_CLDNN = OFF
    ENABLE_CLDNN_TESTS = OFF
    ENABLE_CLDNN_BUILD = OFF
    ENABLE_PROFILING_ITT = ON
    ENABLE_PROFILING_RAW = OFF
    GEMM = JIT
    THREADING = SEQ
    ENABLE_VPU = ON
    ENABLE_MYRIAD = ON
    ENABLE_MYRIAD_NO_BOOT = OFF
    ENABLE_TESTS = OFF
    ENABLE_GAPI_TESTS = OFF
    GAPI_TEST_PERF = OFF
    ENABLE_MYRIAD_MVNC_TESTS = OFF
    ENABLE_SAMPLES = ON
    ENABLE_SAMPLES_CORE = ON
    ENABLE_SANITIZER = OFF
    ENABLE_FUZZING = OFF
    COVERAGE = OFF
    ENABLE_STRESS_UNIT_TESTS = OFF
    VERBOSE_BUILD = OFF
    ENABLE_UNSAFE_LOCATIONS = OFF
    ENABLE_ALTERNATIVE_TEMP = ON
    ENABLE_SEGMENTATION_TESTS = ON
    ENABLE_OBJECT_DETECTION_TESTS = ON
    ENABLE_OPENCV = ON
    OS_FOLDER = OFF
    ENABLE_PLUGIN_RPATH = ON
    ENABLE_AFFINITY_GENERATOR = OFF
    ENABLE_DEBUG_SYMBOLS = OFF
    ENABLE_PYTHON = ON
    DEVELOPMENT_PLUGIN_MODE = OFF
    TREAT_WARNING_AS_ERROR = ON
    ENABLE_CPP_CCT = OFF
    ENABLE_UNICODE_PATH_SUPPORT = ON
    ENABLE_LTO = OFF
    ENABLE_CPPLINT = OFF
    ENABLE_CPPLINT_REPORT = OFF
    ENABLE_CPPCHECK = OFF

-- Found Wget: /usr/bin/wget  
-- DL_SDK_TEMP envionment not set
-- Downloading from https://download.01.org/opencv/2019/openvinotoolkit/R3/inference_engine/firmware_ma2450_759W.zip to /home/ubuntu/dldt/inference-engine/temp/download/firmware_ma2450_759W.zip ...
-- /usr/bin/wget --no-cache https://download.01.org/opencv/2019/openvinotoolkit/R3/inference_engine/firmware_ma2450_759W.zip
--2020-01-04 01:19:28--  https://download.01.org/opencv/2019/openvinotoolkit/R3/inference_engine/firmware_ma2450_759W.zip
Resolving download.01.org (download.01.org)... 104.71.155.22, 2001:f61:11:287::ae6, 2001:f61:11:282::ae6
Connecting to download.01.org (download.01.org)|104.71.155.22|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 941497 (919K) [application/zip]
Saving to: ‘/home/ubuntu/dldt/inference-engine/temp/download/firmware_ma2450_759W.zip’

     0K .......... .......... .......... .......... ..........  5% 3.63M 0s
    50K .......... .......... .......... .......... .......... 10% 8.87M 0s
   100K .......... .......... .......... .......... .......... 16% 18.7M 0s
   150K .......... .......... .......... .......... .......... 21% 9.32M 0s
   200K .......... .......... .......... .......... .......... 27% 16.0M 0s
   250K .......... .......... .......... .......... .......... 32% 9.63M 0s
   300K .......... .......... .......... .......... .......... 38% 12.5M 0s
   350K .......... .......... .......... .......... .......... 43% 16.1M 0s
   400K .......... .......... .......... .......... .......... 48% 15.7M 0s
   450K .......... .......... .......... .......... .......... 54% 18.1M 0s
   500K .......... .......... .......... .......... .......... 59% 13.7M 0s
   550K .......... .......... .......... .......... .......... 65% 15.8M 0s
   600K .......... .......... .......... .......... .......... 70% 16.3M 0s
   650K .......... .......... .......... .......... .......... 76% 12.7M 0s
   700K .......... .......... .......... .......... .......... 81% 18.2M 0s
   750K .......... .......... .......... .......... .......... 87% 14.5M 0s
   800K .......... .......... .......... .......... .......... 92% 16.2M 0s
   850K .......... .......... .......... .......... .......... 97% 15.7M 0s
   900K .......... .........                                  100% 21.0M=0.07s

2020-01-04 01:19:28 (12.1 MB/s) - ‘/home/ubuntu/dldt/inference-engine/temp/download/firmware_ma2450_759W.zip’ saved [941497/941497]

-- extracting...
         src='/home/ubuntu/dldt/inference-engine/temp/download/firmware_ma2450_759W.zip'
         dst='/home/ubuntu/dldt/inference-engine/temp/vpu/firmware/ma2450'
unpacked_dir= /home/ubuntu/dldt/inference-engine/temp/vpu/firmware/ma2450
-- extracting... [tar xfz]
-- Downloading from https://download.01.org/opencv/2019/openvinotoolkit/R3/inference_engine/firmware_mv0262_mdk_R9.8.zip to /home/ubuntu/dldt/inference-engine/temp/download/firmware_mv0262_mdk_R9.8.zip ...
-- /usr/bin/wget --no-cache https://download.01.org/opencv/2019/openvinotoolkit/R3/inference_engine/firmware_mv0262_mdk_R9.8.zip
--2020-01-04 01:19:29--  https://download.01.org/opencv/2019/openvinotoolkit/R3/inference_engine/firmware_mv0262_mdk_R9.8.zip
Resolving download.01.org (download.01.org)... 104.71.155.22, 2001:f61:11:287::ae6, 2001:f61:11:282::ae6
Connecting to download.01.org (download.01.org)|104.71.155.22|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 923074 (901K) [application/zip]
Saving to: ‘/home/ubuntu/dldt/inference-engine/temp/download/firmware_mv0262_mdk_R9.8.zip’

     0K .......... .......... .......... .......... ..........  5% 4.16M 0s
    50K .......... .......... .......... .......... .......... 11% 12.0M 0s
   100K .......... .......... .......... .......... .......... 16% 18.7M 0s
   150K .......... .......... .......... .......... .......... 22% 13.5M 0s
   200K .......... .......... .......... .......... .......... 27% 16.0M 0s
   250K .......... .......... .......... .......... .......... 33% 14.2M 0s
   300K .......... .......... .......... .......... .......... 38% 15.0M 0s
   350K .......... .......... .......... .......... .......... 44% 14.2M 0s
   400K .......... .......... .......... .......... .......... 49% 16.2M 0s
   450K .......... .......... .......... .......... .......... 55% 15.7M 0s
   500K .......... .......... .......... .......... .......... 61% 16.3M 0s
   550K .......... .......... .......... .......... .......... 66% 15.9M 0s
   600K .......... .......... .......... .......... .......... 72% 16.2M 0s
   650K .......... .......... .......... .......... .......... 77% 13.9M 0s
   700K .......... .......... .......... .......... .......... 83% 16.3M 0s
   750K .......... .......... .......... .......... .......... 88% 14.9M 0s
   800K .......... .......... .......... .......... .......... 94% 16.2M 0s
   850K .......... .......... .......... .......... .......... 99% 16.7M 0s
   900K .                                                     100% 2746G=0.07s

2020-01-04 01:19:29 (13.3 MB/s) - ‘/home/ubuntu/dldt/inference-engine/temp/download/firmware_mv0262_mdk_R9.8.zip’ saved [923074/923074]

-- extracting...
         src='/home/ubuntu/dldt/inference-engine/temp/download/firmware_mv0262_mdk_R9.8.zip'
         dst='/home/ubuntu/dldt/inference-engine/temp/vpu/firmware/mv0262'
unpacked_dir= /home/ubuntu/dldt/inference-engine/temp/vpu/firmware/mv0262
-- extracting... [tar xfz]
-- Downloading from https://download.01.org/opencv/2019/openvinotoolkit/R3/inference_engine/firmware_ma2x8x_mdk_R9.8.zip to /home/ubuntu/dldt/inference-engine/temp/download/firmware_ma2x8x_mdk_R9.8.zip ...
-- /usr/bin/wget --no-cache https://download.01.org/opencv/2019/openvinotoolkit/R3/inference_engine/firmware_ma2x8x_mdk_R9.8.zip
--2020-01-04 01:19:33--  https://download.01.org/opencv/2019/openvinotoolkit/R3/inference_engine/firmware_ma2x8x_mdk_R9.8.zip
Resolving download.01.org (download.01.org)... 104.71.155.22, 2001:f61:11:287::ae6, 2001:f61:11:282::ae6
Connecting to download.01.org (download.01.org)|104.71.155.22|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1037898 (1014K) [application/zip]
Saving to: ‘/home/ubuntu/dldt/inference-engine/temp/download/firmware_ma2x8x_mdk_R9.8.zip’

     0K .......... .......... .......... .......... ..........  4% 3.92M 0s
    50K .......... .......... .......... .......... ..........  9% 8.12M 0s
   100K .......... .......... .......... .......... .......... 14% 18.3M 0s
   150K .......... .......... .......... .......... .......... 19% 15.1M 0s
   200K .......... .......... .......... .......... .......... 24% 16.0M 0s
   250K .......... .......... .......... .......... .......... 29% 16.1M 0s
   300K .......... .......... .......... .......... .......... 34% 12.5M 0s
   350K .......... .......... .......... .......... .......... 39% 15.9M 0s
   400K .......... .......... .......... .......... .......... 44% 16.2M 0s
   450K .......... .......... .......... .......... .......... 49% 15.7M 0s
   500K .......... .......... .......... .......... .......... 54% 16.4M 0s
   550K .......... .......... .......... .......... .......... 59% 15.8M 0s
   600K .......... .......... .......... .......... .......... 64% 15.8M 0s
   650K .......... .......... .......... .......... .......... 69% 14.0M 0s
   700K .......... .......... .......... .......... .......... 73% 16.1M 0s
   750K .......... .......... .......... .......... .......... 78% 15.0M 0s
   800K .......... .......... .......... .......... .......... 83% 15.7M 0s
   850K .......... .......... .......... .......... .......... 88% 16.3M 0s
   900K .......... .......... .......... .......... .......... 93% 16.1M 0s
   950K .......... .......... .......... .......... .......... 98% 16.2M 0s
  1000K .......... ...                                        100% 14.9M=0.08s

2020-01-04 01:19:33 (13.1 MB/s) - ‘/home/ubuntu/dldt/inference-engine/temp/download/firmware_ma2x8x_mdk_R9.8.zip’ saved [1037898/1037898]

-- extracting...
         src='/home/ubuntu/dldt/inference-engine/temp/download/firmware_ma2x8x_mdk_R9.8.zip'
         dst='/home/ubuntu/dldt/inference-engine/temp/vpu/firmware/ma2x8x'
unpacked_dir= /home/ubuntu/dldt/inference-engine/temp/vpu/firmware/ma2x8x
-- extracting... [tar xfz]
-- PROJECT ............................... InferenceEngine
-- CMAKE_BINARY_DIR ...................... /home/ubuntu/dldt/inference-engine/build
-- IE_MAIN_SOURCE_DIR .................... /home/ubuntu/dldt/inference-engine
-- CMAKE_GENERATOR ....................... Unix Makefiles
-- CMAKE_C_COMPILER_ID ................... GNU
-- CMAKE_BUILD_TYPE ...................... Release
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Performing Test HAS_MAYBE_UNINITIALIZED
-- Performing Test HAS_MAYBE_UNINITIALIZED - Success
-- Looking for C++ include unistd.h
-- Looking for C++ include unistd.h - found
-- Looking for C++ include stdint.h
-- Looking for C++ include stdint.h - found
-- Looking for C++ include sys/types.h
-- Looking for C++ include sys/types.h - found
-- Looking for C++ include fnmatch.h
-- Looking for C++ include fnmatch.h - found
-- Looking for C++ include stddef.h
-- Looking for C++ include stddef.h - found
-- Check size of uint32_t
-- Check size of uint32_t - done
-- Looking for strtoll
-- Looking for strtoll - found
-- Found PythonInterp: /usr/bin/python3.7 (found version "3.7.5") 
-- Found Cython: /usr/local/bin/cython  
-- Found PythonLibs: /usr/lib/aarch64-linux-gnu/libpython3.7m.so (found version "3.7.5") 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ubuntu/dldt/inference-engine/build
Compile_dldt
$ sudo make -j4
Build_Error
/home/ubuntu/dldt/inference-engine/thirdparty/ade/sources/ade/source/execution_engine.cpp:141:21: error: redundant move in return statement [-Werror=redundant-move]
  141 |     return std::move(ret);
      |            ~~~~~~~~~^~~~~
/home/ubuntu/dldt/inference-engine/thirdparty/ade/sources/ade/source/execution_engine.cpp:141:21: note: remove ‘std::move’ call
Edit_the_program_file_where_the_error_occurred
$ nano /home/ubuntu/dldt/inference-engine/thirdparty/ade/sources/ade/source/execution_engine.cpp

Modify as follows.

execution_engine.cpp
           ret->addExec(std::move(bexec));
        }
    }

    //return std::move(ret);
    return ret;
}
resume_dldt_build
$ sudo make -j4

After build completion.
Screenshot 2020-01-04 02:08:18.png
Screenshot 2020-01-04 02:29:28.png

$ export PYTHONPATH=${HOME}/dldt/inference-engine/bin/aarch64/Release/lib/python_api/python3.7:${PYTHONPATH}
$ echo export PYTHONPATH=${HOME}/dldt/inference-engine/bin/aarch64/Release/lib/python_api/python3.7:${PYTHONPATH} >> ~/.bashrc

3−3.Verifying Installation

$ cd ~/dldt/inference-engine/bin/aarch64/Release
$ ./benchmark_app --help

[Step 1/11] Parsing and validating input arguments
[ INFO ] Parsing input parameters

benchmark_app [OPTION]
Options:

    -h, --help                Print a usage message
    -i "<path>"               Optional. Path to a folder with images and/or binaries or to specific image or binary file.
    -m "<path>"               Required. Path to an .xml file with a trained model.
    -d "<device>"             Optional. Specify a target device to infer on (the list of available devices is shown below). Default value is CPU. Use "-d HETERO:<comma-separated_devices_list>" format to specify HETERO plugin. Use "-d MULTI:<comma-separated_devices_list>" format to specify MULTI plugin. The application looks for a suitable plugin for the specified device.
    -l "<absolute_path>"      Required for CPU custom layers. Absolute path to a shared library with the kernels implementations.
          Or
    -c "<absolute_path>"      Required for GPU custom kernels. Absolute path to an .xml file with the kernels description.
    -api "<sync/async>"       Optional. Enable Sync/Async API. Default value is "async".
    -niter "<integer>"        Optional. Number of iterations. If not specified, the number of iterations is calculated depending on a device.
    -nireq "<integer>"        Optional. Number of infer requests. Default value is determined automatically for device.
    -b "<integer>"            Optional. Batch size value. If not specified, the batch size value is determined from Intermediate Representation.
    -stream_output            Optional. Print progress as a plain text. When specified, an interactive progress bar is replaced with a multiline output.
    -t                        Optional. Time in seconds to execute topology.
    -progress                 Optional. Show progress bar (can affect performance measurement). Default values is "false".

  device-specific performance options:
    -nstreams "<integer>"     Optional. Number of streams to use for inference on the CPU or/and GPU in throughput mode (for HETERO and MULTI device cases use format <dev1>:<nstreams1>,<dev2>:<nstreams2> or just <nstreams>). Default value is determined automatically for a device.Please note that although the automatic selection usually provides a reasonable performance, it still may be non - optimal for some cases, especially for very small networks. See sample's README for more details.
    -nthreads "<integer>"     Optional. Number of threads to use for inference on the CPU (including HETERO and MULTI cases).
    -pin "YES"/"NO"           Optional. Enable ("YES" is default value) or disable ("NO") CPU threads pinning for CPU-involved inference.

  Statistics dumping options:
    -report_type "<type>"     Optional. Enable collecting statistics report. "no_counters" report contains configuration options specified, resulting FPS and latency. "average_counters" report extends "no_counters" report and additionally includes average PM counters values for each layer from the network. "detailed_counters" report extends "average_counters" report and additionally includes per-layer PM counters and latency for each executed infer request.
    -report_folder            Optional. Path to a folder where statistics report is stored.
    -exec_graph_path          Optional. Path to a file where to store executable graph information serialized.
    -pc                       Optional. Report performance counters.

4.Reference articles

  1. https://software.intel.com/en-us/articles/ARM64-sbc-and-NCS2
  2. https://software.intel.com/en-us/articles/ARM-sbc-and-NCS2
  3. https://github.com/opencv/open_model_zoo.git
  4. http://docs.openvinotoolkit.org/2019_R2/_intel_models_index.html
  5. http://docs.openvinotoolkit.org/2019_R2/_intel_models_pedestrian_detection_adas_binary_0001_description_pedestrian_detection_adas_binary_0001.html
3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1