LattePanda 安装ubuntu 20.04 和 openvino

LattePanda 安装ubuntu 20.04 和 openvino 2020.4

硬件:

  • LattePanda Delta
  • M.2 SSD
  • Intel Neural Computer Stick 2
  • USB stick 8G

软件:

  • ubuntu 20.04
  • openvino

第一部分,ubuntu 20.04 系统安装

首先,下载 ubuntu 20.04 iso 文件,然后制作USB 启动盘;Mac 下可以用Disk Utility 工具,将 U盘分区抹去,选择 MS FAT 格式,GUID分区方案
usb partition
然后用 etcher刻录
etcher 界面
刻录完成后,插入 LattePanda,再接入鼠标和键盘,显示器。
启动LattePanda Delta 后,多按几次 Del 键,会进入 bios 设置界面。
将U盘设置为第一启动盘,保存退出。
出现ubuntu grub安装界面,选择安装即可,我这里选择了 oem 方式玩玩。
在这里插入图片描述

系统会显示 LattePanda 的 logo
在这里插入图片描述
选择分区方案时,我采用了自定义,以免破坏原来的windows 10 系统;ubuntu 17 开始,不再使用 swap 分区,将所有空闲空间都划分为 ext4 格式,挂载为 root 。
在这里插入图片描述
然后就是耐心等待了。
在这里插入图片描述
如果你的网络不是特别好,最好跳过所有的在线更新,等后面更改了apt源镜像后,再安装不迟。
安装完成后,拔出U盘,重启,这里无需额外bios设置,启动盘会是ubuntu,进入桌面后,因为我是OEM安装,再运行一下 oem-config ,来创建最终用户。
在这里插入图片描述
重启进入桌面后,主要硬件看起来都工作正常。
显卡 ok, 可以驱动4K 显示器。
蓝牙 ok
wifi ok , 可以连上热点。
声卡 ok,可以听到启动音乐。
在这里插入图片描述
更改apt源镜像,更新系统
在这里插入图片描述

通过 Visual Studio Code Insider,安装 PlatformIO 后,刷写 Arduino 也正常,简单跑了个 Python 程序刷新 oled 屏幕也正常。
看起来一切正常,无需我额外关注硬件驱动。

第二部分,openvino 及 intel neural computer stick2 驱动

因为在linux 下安装 openvino 许多次了,习惯性下载了最新的 2020.4 安装包,开始执行依赖安装脚本。
出错了,许多包文件找不到。

E: Unable to locate package gudev-1.0
E: Unable to locate package libusb-1.0.0-dev
E: Package 'libfluidsynth1' has no installation candidate
E: Unable to locate package libnettle6
E: Unable to locate package libopenexr22
E: Unable to locate package python3.6
E: Unable to locate package libpython3.6

于是手动修改依赖安装脚本,将出错的包名更换为 逗号后面的新包名,再删除 python3.6 的依赖。

$ vi ./install_openvino_dependencies.sh

E: Unable to locate package gudev-1.0 ,libgudev-1.0-dev
E: Unable to locate package libusb-1.0.0-dev, libusb-1.0-0-dev
E: Package 'libfluidsynth1' has no installation candidate, libfluidsynth2
E: Unable to locate package libnettle6, libnettle7
E: Unable to locate package libopenexr22, libopenexr24

这次安装成功了。

panda@Panda:~/git/l_openvino_toolkit_p_2020.4.287$ sudo -E ./install_openvino_dependencies.sh

This script installs the following OpenVINO 3rd-party dependencies:
  1. GTK+, FFmpeg and GStreamer libraries used by OpenCV
  2. libusb library required for Myriad plugin for Inference Engine
  3. build dependencies for OpenVINO samples
  4. build dependencies for GStreamer Plugins

Hit:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal InRelease
Get:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates InRelease [111 kB]
Get:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports InRelease [98.3 kB]

然后是 openvino 库安装,自检时依然抱怨不满足先决条件,查看详细信息,发现OS最高支持到 ubuntu 18.04。

Prerequisites > Missing Prerequisite
--------------------------------------------------------------------------------
Detected operating system is not supported. Supported operating systems for this
release are: 
    - CentOS* 7 (Intel(R) 64);
    - Ubuntu* 16.04 (Intel(R) 64), 18.04 (Intel(R) 64);
    - Yocto  (Intel(R) 64);

--------------------------------------------------------------------------------

   1. See next issue [ default ]
   2. Back to Prerequisite summary dialog

   h. Help
   b. Back
   q. Quit installation

忽视警告强行安装后,很多关键库文件都没有安装。

--------------------------------------------------------------------------------
Install location:
    /opt/intel


The following components will be installed:
    Model Optimizer                                                          4MB
        Model Optimizer Tool                                                 4MB

    Deep Learning Workbench                                                 10MB
        Deep Learning Workbench                                             10MB

    Open Model Zoo                                                          58MB
        Open Model Zoo                                                      58MB

    Intel(R) Media SDK                                                     128MB
        Intel(R) Media SDK                                                 128MB

   Install space required:  292MB

Installation
--------------------------------------------------------------------------------
Each component will be installed individually. If you cancel the installation,
some components might remain on your system. This installation may take several 
minutes, depending on your system and the options you selected.
--------------------------------------------------------------------------------
Installing Model Optimizer Tool component... done
--------------------------------------------------------------------------------
Installing Deep Learning Workbench component... done
--------------------------------------------------------------------------------
Installing Open Model Zoo component... done
--------------------------------------------------------------------------------
Installing Intel(R) Media SDK component... done
--------------------------------------------------------------------------------
Finalizing product configuration...
--------------------------------------------------------------------------------








First Part of Installation is Complete
--------------------------------------------------------------------------------
The first part of Intel® Distribution of OpenVINO™ toolkit 2020.4 for Linux*
has been successfully installed in 
/opt/intel/openvino_2020.4.287.

于是决定自行编译安装。

首先从 这里 https://github.com/openvinotoolkit/openvino 下载源代码。
再更新子模块

git submodule update --init --recursive

这里就不编译 opencv 了,太耗时间,用现成的 4.2 ,

sudo apt install  libopencv-dev python3-opencv
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  autoconf automake autotools-dev cpp-8 gcc-8 gcc-8-base gdal-data gfortran gfortran-8 gfortran-9 ibverbs-providers javascript-common libaec0
  libarmadillo9 libarpack2 libavcodec-dev libavformat-dev libavresample-dev libavutil-dev libblas3 libcaf-openmpi-3 libcfitsio8 libcharls2 libcoarrays-dev
  libcoarrays-openmpi-dev libdap25 libdapclient6v5 libdc1394-22-dev libepsilon1 libevent-core-2.1-7 libevent-dev libevent-extra-2.1-7
  libevent-openssl-2.1-7 libevent-pthreads-2.1-7 libexif-dev libexif-doc libfabric1 libfreexl1 libfyba0 libgcc-8-dev libgdal26 libgdcm-dev libgdcm3.0
  libgeos-3.8.0 libgeos-c1v5 libgeotiff5 libgfortran-8-dev libgfortran-9-dev libgfortran5 libgl2ps1.4 libgphoto2-dev libhdf4-0-alt libhdf5-103
  libhdf5-openmpi-103 libhwloc-dev libhwloc-plugins libhwloc15 libibverbs-dev libibverbs1 libilmbase-dev libjbig-dev libjpeg-dev libjpeg-turbo8-dev
  libjpeg8-dev libjs-jquery libkmlbase1 libkmldom1 libkmlengine1 liblapack3 liblept5 libltdl-dev liblzma-dev libminizip1 libmpx2 libnetcdf-c++4
  libnetcdf15 libnl-3-dev libnl-route-3-dev libnuma-dev libodbc1 libogdi4.1 libopencv-calib3d-dev libopencv-calib3d4.2 libopencv-contrib-dev
  libopencv-contrib4.2 libopencv-core-dev libopencv-core4.2 libopencv-dnn-dev libopencv-dnn4.2 libopencv-features2d-dev libopencv-features2d4.2
  libopencv-flann-dev libopencv-flann4.2 libopencv-highgui-dev libopencv-highgui4.2 libopencv-imgcodecs-dev libopencv-imgcodecs4.2 libopencv-imgproc-dev
  libopencv-imgproc4.2 libopencv-ml-dev libopencv-ml4.2 libopencv-objdetect-dev libopencv-objdetect4.2 libopencv-photo-dev libopencv-photo4.2
  libopencv-shape-dev libopencv-shape4.2 libopencv-stitching-dev libopencv-stitching4.2 libopencv-superres-dev libopencv-superres4.2 libopencv-ts-dev
  libopencv-video-dev libopencv-video4.2 libopencv-videoio-dev libopencv-videoio4.2 libopencv-videostab-dev libopencv-videostab4.2 libopencv-viz-dev
  libopencv-viz4.2 libopencv4.2-java libopencv4.2-jni libopenexr-dev libopenmpi-dev libopenmpi3 libpmix2 libpng-dev libpng-tools libpq5 libproj15
  libpsm-infinipath1 libpsm2-2 libqhull7 libraw1394-dev libraw1394-tools librdmacm1 libsocket++1 libspatialite7 libsuperlu5 libswresample-dev
  libswscale-dev libsz2 libtbb-dev libtbb2 libtesseract4 libtiff-dev libtiffxx5 libtool liburiparser1 libvtk6.3 libxerces-c3.2 libxnvctrl0 odbcinst
  odbcinst1debian2 opencv-data openmpi-bin openmpi-common proj-bin proj-data python3-numpy
Suggested packages:
  autoconf-archive gnu-standards autoconf-doc gcc-8-locales gcc-8-multilib gcc-8-doc gfortran-multilib gfortran-doc gfortran-8-multilib gfortran-8-doc
  gfortran-9-multilib gfortran-9-doc apache2 | lighttpd | httpd geotiff-bin gdal-bin libgeotiff-epsg libhdf4-doc libhdf4-alt-dev hdf4-tools
  libhwloc-contrib-plugins libtool-doc liblzma-doc libmyodbc odbc-postgresql tdsodbc unixodbc-bin ogdi-bin opencv-doc openmpi-doc libraw1394-doc
  libtbb-doc gcj-jdk mpi-default-bin python-numpy-doc python3-pytest python3-numpy-dbg
The following NEW packages will be installed:
  autoconf automake autotools-dev cpp-8 gcc-8 gcc-8-base gdal-data gfortran gfortran-8 gfortran-9 ibverbs-providers javascript-common libaec0
  libarmadillo9 libarpack2 libavcodec-dev libavformat-dev libavresample-dev libavutil-dev libblas3 libcaf-openmpi-3 libcfitsio8 libcharls2 libcoarrays-dev
  libcoarrays-openmpi-dev libdap25 libdapclient6v5 libdc1394-22-dev libepsilon1 libevent-core-2.1-7 libevent-dev libevent-extra-2.1-7
  libevent-openssl-2.1-7 libevent-pthreads-2.1-7 libexif-dev libexif-doc libfabric1 libfreexl1 libfyba0 libgcc-8-dev libgdal26 libgdcm-dev libgdcm3.0
  libgeos-3.8.0 libgeos-c1v5 libgeotiff5 libgfortran-8-dev libgfortran-9-dev libgfortran5 libgl2ps1.4 libgphoto2-dev libhdf4-0-alt libhdf5-103
  libhdf5-openmpi-103 libhwloc-dev libhwloc-plugins libhwloc15 libibverbs-dev libibverbs1 libilmbase-dev libjbig-dev libjpeg-dev libjpeg-turbo8-dev
  libjpeg8-dev libjs-jquery libkmlbase1 libkmldom1 libkmlengine1 liblapack3 liblept5 libltdl-dev liblzma-dev libminizip1 libmpx2 libnetcdf-c++4
  libnetcdf15 libnl-3-dev libnl-route-3-dev libnuma-dev libodbc1 libogdi4.1 libopencv-calib3d-dev libopencv-calib3d4.2 libopencv-contrib-dev
  libopencv-contrib4.2 libopencv-core-dev libopencv-core4.2 libopencv-dev libopencv-dnn-dev libopencv-dnn4.2 libopencv-features2d-dev
  libopencv-features2d4.2 libopencv-flann-dev libopencv-flann4.2 libopencv-highgui-dev libopencv-highgui4.2 libopencv-imgcodecs-dev libopencv-imgcodecs4.2
  libopencv-imgproc-dev libopencv-imgproc4.2 libopencv-ml-dev libopencv-ml4.2 libopencv-objdetect-dev libopencv-objdetect4.2 libopencv-photo-dev
  libopencv-photo4.2 libopencv-shape-dev libopencv-shape4.2 libopencv-stitching-dev libopencv-stitching4.2 libopencv-superres-dev libopencv-superres4.2
  libopencv-ts-dev libopencv-video-dev libopencv-video4.2 libopencv-videoio-dev libopencv-videoio4.2 libopencv-videostab-dev libopencv-videostab4.2
  libopencv-viz-dev libopencv-viz4.2 libopencv4.2-java libopencv4.2-jni libopenexr-dev libopenmpi-dev libopenmpi3 libpmix2 libpng-dev libpng-tools libpq5
  libproj15 libpsm-infinipath1 libpsm2-2 libqhull7 libraw1394-dev libraw1394-tools librdmacm1 libsocket++1 libspatialite7 libsuperlu5 libswresample-dev
  libswscale-dev libsz2 libtbb-dev libtbb2 libtesseract4 libtiff-dev libtiffxx5 libtool liburiparser1 libvtk6.3 libxerces-c3.2 libxnvctrl0 odbcinst
  odbcinst1debian2 opencv-data openmpi-bin openmpi-common proj-bin proj-data python3-numpy python3-opencv
0 upgraded, 162 newly installed, 0 to remove and 0 not upgraded.
Need to get 134 MB of archives.
After this operation, 563 MB of additional disk space will be used.
Do you want to continue? [Y/n] 

完成后,进入 openvino 源目录,安装依赖项

panda@Panda:~/git/openvino$ chmod +x install_dependencies.sh
panda@Panda:~/git/openvino$ ./install_dependencies.sh
The following additional packages will be installed:
  autopoint debhelper dh-autoreconf dh-strip-nondeterminism dwz g++-9-multilib gcc-9-multilib gir1.2-gtk-2.0 gir1.2-harfbuzz-0.0 icu-devtools
  intltool-debian lib32asan5 lib32atomic1 lib32gcc-9-dev lib32gcc-s1 lib32gcc1 lib32gomp1 lib32itm1 lib32quadmath0 lib32stdc++-9-dev lib32stdc++6
  lib32ubsan1 libarchive-cpio-perl libarchive-zip-perl libatk1.0-dev libboost-regex1.71-dev libboost-regex1.71.0 libboost1.71-dev libc6-dev-i386
  libc6-dev-x32 libc6-i386 libc6-x32 libcairo-script-interpreter2 libdatrie-dev libdebhelper-perl libfile-stripnondeterminism-perl libfontconfig1-dev
  libfreetype-dev libfreetype6-dev libfribidi-dev libgdk-pixbuf2.0-dev libgraphite2-dev libharfbuzz-dev libharfbuzz-gobject0 libice-dev libicu-dev
  libmail-sendmail-perl libopenblas-pthread-dev libopenblas0 libopenblas0-pthread libpixman-1-dev libsm-dev libsub-override-perl libsys-hostname-long-perl
  libthai-dev libx32asan5 libx32atomic1 libx32gcc-9-dev libx32gcc-s1 libx32gcc1 libx32gomp1 libx32itm1 libx32quadmath0 libx32stdc++-9-dev libx32stdc++6
  libx32ubsan1 libxcb-render0-dev libxcb-shm0-dev libxcomposite-dev libxcursor-dev libxdamage-dev libxext-dev libxfixes-dev libxft-dev libxi-dev
  libxinerama-dev libxml2-utils libxrandr-dev libxrender-dev pango1.0-tools po-debconf x11proto-input-dev x11proto-randr-dev x11proto-xext-dev
  x11proto-xinerama-dev
Suggested packages:
  dh-make lib32stdc++6-9-dbg libx32stdc++6-9-dbg libboost1.71-doc libboost-atomic1.71-dev libboost-chrono1.71-dev libboost-container1.71-dev
  libboost-context1.71-dev libboost-contract1.71-dev libboost-coroutine1.71-dev libboost-date-time1.71-dev libboost-exception1.71-dev
  libboost-fiber1.71-dev libboost-filesystem1.71-dev libboost-graph1.71-dev libboost-graph-parallel1.71-dev libboost-iostreams1.71-dev
  libboost-locale1.71-dev libboost-log1.71-dev libboost-math1.71-dev libboost-mpi1.71-dev libboost-mpi-python1.71-dev libboost-numpy1.71-dev
  libboost-program-options1.71-dev libboost-python1.71-dev libboost-random1.71-dev libboost-serialization1.71-dev libboost-stacktrace1.71-dev
  libboost-system1.71-dev libboost-test1.71-dev libboost-thread1.71-dev libboost-timer1.71-dev libboost-type-erasure1.71-dev libboost-wave1.71-dev
  libboost1.71-tools-dev libmpfrc++-dev libntl-dev libcairo2-doc libdatrie-doc freetype2-doc libgraphite2-utils libgtk2.0-doc libice-doc icu-doc
  imagemagick libpango1.0-doc libsm-doc libssl-doc libthai-doc libxext-doc libmail-box-perl
The following NEW packages will be installed:
  autopoint curl debhelper dh-autoreconf dh-strip-nondeterminism dwz g++-9-multilib g++-multilib gcc-9-multilib gcc-multilib gir1.2-gtk-2.0
  gir1.2-harfbuzz-0.0 icu-devtools intltool-debian lib32asan5 lib32atomic1 lib32gcc-9-dev lib32gcc-s1 lib32gcc1 lib32gomp1 lib32itm1 lib32quadmath0
  lib32stdc++-9-dev lib32stdc++6 lib32ubsan1 libarchive-cpio-perl libarchive-zip-perl libatk1.0-dev libboost-regex-dev libboost-regex1.71-dev
  libboost-regex1.71.0 libboost1.71-dev libc6-dev-i386 libc6-dev-x32 libc6-i386 libc6-x32 libcairo-script-interpreter2 libcairo2-dev libdatrie-dev
  libdebhelper-perl libfile-stripnondeterminism-perl libfontconfig1-dev libfreetype-dev libfreetype6-dev libfribidi-dev libgdk-pixbuf2.0-dev
  libgraphite2-dev libgtk2.0-dev libharfbuzz-dev libharfbuzz-gobject0 libice-dev libicu-dev libmail-sendmail-perl libopenblas-dev libopenblas-pthread-dev
  libopenblas0 libopenblas0-pthread libpango1.0-dev libpixman-1-dev libsm-dev libssl-dev libsub-override-perl libsys-hostname-long-perl libthai-dev
  libx32asan5 libx32atomic1 libx32gcc-9-dev libx32gcc-s1 libx32gcc1 libx32gomp1 libx32itm1 libx32quadmath0 libx32stdc++-9-dev libx32stdc++6 libx32ubsan1
  libxcb-render0-dev libxcb-shm0-dev libxcomposite-dev libxcursor-dev libxdamage-dev libxext-dev libxfixes-dev libxft-dev libxi-dev libxinerama-dev
  libxml2-utils libxrandr-dev libxrender-dev pango1.0-tools po-debconf x11proto-input-dev x11proto-randr-dev x11proto-xext-dev x11proto-xinerama-dev
0 upgraded, 94 newly installed, 0 to remove and 0 not upgraded.
Need to get 59.7 MB of archives.
After this operation, 489 MB of additional disk space will be used.

还需要安装 cython3

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  cython-doc
The following NEW packages will be installed:
  cython3
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,474 kB of archives.
After this operation, 7,038 kB of additional disk space will be used.

完成后,就可以准备编译了,首先修改几个文件,来对应我们的 python 3.8

  1. scripts/setupvars/setupvars.sh, 97 行开始,添加 python 3.8的判断
    if command -v python3.8 >/dev/null 2>&1; then
        python_version=3.8
        python_bitness=$(python3.8 -c 'import sys; print(64 if sys.maxsize > 2**32 else 32)')
    elif command -v python3.7 >/dev/null 2>&1; then

129行,注释对 python 2.7 的判断

#    if [ "$python_version" != "2.7" ]; then
#        # add path to OpenCV API for Python 3.x
#        export PYTHONPATH="$INTEL_OPENVINO_DIR/python/python3:$PYTHONPATH"
#    fi

  1. model-optimizer/install_prerequisites/install_prerequisites.sh 的 75 行,
    sudo -E apt -y install python3-pip python3-virtualenv libgfortran5

因为LattePanda 的cpu 不被支持,GPU又很弱,所以我关闭了 CPU 和 GPU 的编译,执行

mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_CLDNN=OFF -D OpenCV_DIR=/usr/lib/x86_64-linux-gnu/cmake/opencv4  -DENABLE_PYTHON=ON -DPYTHON_EXECUTABLE=/usr/bin/python3 -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.8.so -DPYTHON_INCLUDE_DIR=/usr/include/python3.8 -DENABLE_MKL_DNN=OFF -DENABLE_SSE42=OFF -DENABLE_PYTHON=ON -DPYTHON_EXECUTABLE=`which python3.8` -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.8.so -DPYTHON_INCLUDE_DIR=/usr/include/python3.8 -DNGRAPH_ONNX_IMPORT_ENABLE=ON  ..
-- CMAKE_BUILD_TYPE: Release
-- Detected 64 bit architecture
-- Inference Engine enabled features: 
-- 
--     CI_BUILD_NUMBER: custom_master_b162f9d5ac8168d64f47a304358c37442d433e86
--     ENABLE_TESTS = OFF
--     ENABLE_MKL_DNN = OFF
--     ENABLE_CLDNN = OFF
--     ENABLE_LTO = OFF
--     OS_FOLDER = OFF
--     TREAT_WARNING_AS_ERROR = ON
--     ENABLE_INTEGRITYCHECK = OFF
--     ENABLE_SANITIZER = OFF
--     ENABLE_THREAD_SANITIZER = OFF
--     COVERAGE = OFF
--     ENABLE_SSE42 = OFF
--     ENABLE_AVX2 = ON
--     ENABLE_AVX512F = ON
--     ENABLE_PROFILING_ITT = ON
-- 
-- PROJECT ............................... OpenVINO
-- CMAKE_BINARY_DIR ...................... /home/panda/git/openvino/build
-- OpenVINO_MAIN_SOURCE_DIR .............. /home/panda/git/openvino
-- IE_MAIN_SOURCE_DIR .................... /home/panda/git/openvino/inference-engine
-- CMAKE_GENERATOR ....................... Unix Makefiles
-- CMAKE_C_COMPILER_ID ................... GNU
-- CMAKE_BUILD_TYPE ...................... Release
-- INTEL_VTUNE_DIR is not defined
-- Could NOT find ITT (missing: Located_ITT_INCLUDE_DIRS Located_ITT_LIBS) 
CMake Warning at openvino/itt/CMakeLists.txt:26 (message):
  Profiling option enabled, but no ITT library was found


-- The name openvino::itt is an ALIAS for itt. It will be exported to the InferenceEngineDeveloperPackage with the original name.
-- Current hash b162f9d5ac8168d64f47a304358c37442d433e86
-- NGRAPH_VERSION 0.0.0+b162f9d
-- NGRAPH_VERSION_SHORT 0.0.0
-- NGRAPH_WHEEL_VERSION 0.0.0
-- NGRAPH_API_VERSION 0.0
-- NGRAPH_ADDRESS_SANITIZER_ENABLE:      OFF
-- NGRAPH_CODE_COVERAGE_ENABLE:          OFF
-- NGRAPH_DEBUG_ENABLE:                  OFF
-- NGRAPH_DEPRECATED_ENABLE:             ON
-- NGRAPH_DYNAMIC_COMPONENTS_ENABLE:     ON
-- NGRAPH_EXPORT_TARGETS_ENABLE:         ON
-- NGRAPH_IE_ENABLE:                     OFF
-- NGRAPH_IE_STATIC_LIB_ENABLE:          
-- NGRAPH_INTERPRETER_ENABLE:            ON
-- NGRAPH_LIB_VERSIONING_ENABLE:         OFF
-- NGRAPH_ONNX_IMPORT_ENABLE:            ON
-- NGRAPH_PYTHON_BUILD_ENABLE:           OFF
-- NGRAPH_TEST_UTIL_ENABLE:              ON
-- NGRAPH_THREAD_SANITIZER_ENABLE:       OFF
-- NGRAPH_TOOLS_ENABLE:                  
-- NGRAPH_UB_SANITIZER_ENABLE:           OFF
-- NGRAPH_USE_PROTOBUF_LITE:             OFF
-- NGRAPH_UNIT_TEST_ENABLE:              OFF
-- NGRAPH_WARNINGS_AS_ERRORS:            OFF
-- NGRAPH_CXX_STANDARD:                  11
-- NGRAPH_FORWARD_CMAKE_ARGS -DCMAKE_C_COMPILER=/usr/bin/cc;-DCMAKE_CXX_COMPILER=/usr/bin/c++;-DCMAKE_CXX_STANDARD:STRING=11;-DCMAKE_CXX_STANDARD_REQUIRED:BOOL=ON;-DCMAKE_CXX_EXTENSIONS:BOOL=OFF;-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON;-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON;-DCMAKE_BUILD_TYPE=Release
-- Installation directory: /usr/local
-- NGRAPH_COMMON_CXX_FLAGS -Wformat;-Wformat-security;-D_FORTIFY_SOURCE=2;-fstack-protector-strong;-s;-fsigned-char;-Werror;-ffunction-sections;-fdata-sections;-fdiagnostics-show-option;-Wundef;-Wreturn-type;-Wuninitialized;-Winit-self;-Wmaybe-uninitialized;-Wno-error=maybe-uninitialized;-Wno-error=return-type;-fPIC;-Wno-error=return-type;-Wno-undef
-- NGRAPH_COMMON_C_FLAGS -Wformat;-Wformat-security;-D_FORTIFY_SOURCE=2;-fstack-protector-strong;-s;-ffunction-sections;-fdata-sections;-fdiagnostics-show-option;-Wundef;-Wreturn-type;-Wuninitialized;-Winit-self;-Wmaybe-uninitialized;-Wno-error=maybe-uninitialized;-Wno-error=return-type;-fPIC;-Wno-error=return-type;-Wno-undef
-- Compile Flags: -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -fstack-protector-strong -s -fsigned-char -Werror -ffunction-sections -fdata-sections -fdiagnostics-show-option -Wundef -Wreturn-type -Wuninitialized -Winit-self -Wmaybe-uninitialized -Wno-error=maybe-uninitialized -Wno-error=return-type -fPIC -Wno-error=return-type -Wno-undef -DEIGEN_MPL2_ONLY -DTBB_USE_THREADING_TOOLS -DNGRAPH_DYNAMIC_COMPONENTS_ENABLE
-- Shared Link Flags:  -Wl,--gc-sections -Wl,--exclude-libs,ALL
-- CMAKE_CXX_FLAGS_RELEASE -O3 -DNDEBUG
-- CMAKE_CXX_FLAGS_DEBUG -O0 -g
-- 
-- 3.7.1.0
Generated: /home/panda/git/openvino/build/_deps/ext_onnx-build/onnx/onnx_ngraph_onnx-ml.proto
Generated: /home/panda/git/openvino/build/_deps/ext_onnx-build/onnx/onnx-operators_ngraph_onnx-ml.proto
-- 
-- ******** Summary ********
--   CMake version         : 3.16.3
--   CMake command         : /usr/bin/cmake
--   System                : Linux
--   C++ compiler          : /usr/bin/c++
--   C++ compiler version  : 9.3.0
--   CXX flags             : -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -fstack-protector-strong -s -fsigned-char -Werror -ffunction-sections -fdata-sections -fdiagnostics-show-option -Wundef -Wreturn-type -Wuninitialized -Winit-self -Wmaybe-uninitialized -Wno-error=maybe-uninitialized -Wno-error=return-type -fPIC -Wno-error=return-type -Wno-undef -Wnon-virtual-dtor
--   Build type            : Release
--   Compile definitions   : IE_BUILD_POSTFIX="";NGRAPH_DEPRECATED_ENABLE;PROJECT_ROOT_DIR="/home/panda/git/openvino"
--   CMAKE_PREFIX_PATH     : 
--   CMAKE_INSTALL_PREFIX  : /usr/local
--   CMAKE_MODULE_PATH     : /home/panda/git/openvino/cmake;/home/panda/git/openvino/cmake/download;/home/panda/git/openvino/cmake/cross_compile;/home/panda/git/openvino/ngraph/cmake/Modules/;/home/panda/git/openvino/cmake/Modules/
-- 
--   ONNX version          : 1.6.0
--   ONNX NAMESPACE        : ngraph_onnx
--   ONNX_BUILD_TESTS      : OFF
--   ONNX_BUILD_BENCHMARKS : OFF
--   ONNX_USE_LITE_PROTO   : OFF
--   ONNXIFI_DUMMY_BACKEND : OFF
--   ONNXIFI_ENABLE_EXT    : OFF
-- 
--   Protobuf compiler     : 
--   Protobuf includes     : 
--   Protobuf libraries    : 
--   BUILD_ONNX_PYTHON     : OFF
-- The name ngraph::reference is an ALIAS for ngraph_reference. It will be exported to the InferenceEngineDeveloperPackage with the original name.
-- unit tests disabled
-- Inference Engine enabled features: 
-- 
--     CI_BUILD_NUMBER: custom_master_b162f9d5ac8168d64f47a304358c37442d433e86
--     ENABLE_TESTS = OFF
--     ENABLE_MKL_DNN = OFF
--     ENABLE_CLDNN = OFF
--     ENABLE_LTO = OFF
--     OS_FOLDER = OFF
--     TREAT_WARNING_AS_ERROR = ON
--     ENABLE_INTEGRITYCHECK = OFF
--     ENABLE_SANITIZER = OFF
--     ENABLE_THREAD_SANITIZER = OFF
--     COVERAGE = OFF
--     ENABLE_SSE42 = OFF
--     ENABLE_AVX2 = ON
--     ENABLE_AVX512F = ON
--     ENABLE_PROFILING_ITT = ON
--     ENABLE_GNA = ON
--     ENABLE_CLDNN_TESTS = OFF
--     THREADING = TBB
--     GNA_LIBRARY_VERSION = GNA2
--     ENABLE_VPU = ON
--     ENABLE_MYRIAD = ON
--     ENABLE_MYRIAD_NO_BOOT = OFF
--     ENABLE_GAPI_TESTS = OFF
--     GAPI_TEST_PERF = OFF
--     ENABLE_MYRIAD_MVNC_TESTS = OFF
--     ENABLE_DATA = OFF
--     ENABLE_SAME_BRANCH_FOR_MODELS = OFF
--     ENABLE_BEH_TESTS = OFF
--     ENABLE_FUNCTIONAL_TESTS = OFF
--     ENABLE_SAMPLES = ON
--     ENABLE_SPEECH_DEMO = ON
--     ENABLE_FUZZING = OFF
--     VERBOSE_BUILD = OFF
--     ENABLE_UNSAFE_LOCATIONS = OFF
--     ENABLE_ALTERNATIVE_TEMP = ON
--     ENABLE_OPENCV = ON
--     ENABLE_PYTHON = ON
--     ENABLE_V7_SERIALIZE = OFF
--     ENABLE_JAVA = OFF
--     ENABLE_CPPLINT = ON
--     ENABLE_CPPLINT_REPORT = OFF
--     ENABLE_CLANG_FORMAT = ON
--     ENABLE_TBB_RELEASE_ONLY = ON
-- 
-- MODELS_PATH=
CMake Warning at inference-engine/cmake/vpu_dependencies.cmake:120 (message):
  VPU_OCL_COMPILER is not found.  Some tests will skipped
Call Stack (most recent call first):
  inference-engine/cmake/dependencies.cmake:43 (include)
  inference-engine/CMakeLists.txt:18 (include)


CMake Warning at inference-engine/cmake/dependencies.cmake:304 (message):
  Unable to locate Speech Demo
Call Stack (most recent call first):
  inference-engine/CMakeLists.txt:18 (include)


-- libGNA::API INTERFACE_LIBRARY : /home/panda/git/openvino/inference-engine/temp/gna_02.00.00.1047.1/include
-- libGNA::KERNEL SHARED_LIBRARY : /home/panda/git/openvino/inference-engine/temp/gna_02.00.00.1047.1/linux/x64/libgna.so
-- Found Cython version 0.29.17
-- Register template_plugin to be built in build-plugins/template_plugin
-- Configuring done
-- Generating done
-- Build files have been written to: /home/panda/git/openvino/build

make --jobs=$(nproc --all)

稍等片刻就编译完成了。

[ 98%] Linking CXX shared library ../../../../bin/intel64/Release/lib/libHeteroPlugin.so
[ 98%] Linking CXX shared library ../../../../bin/intel64/Release/lib/libGNAPlugin.so
[ 98%] Linking CXX shared library ../../../../../bin/intel64/Release/lib/libmyriadPlugin.so
[ 98%] Linking CXX shared library ../../../../bin/intel64/Release/lib/libMultiDevicePlugin.so
[ 98%] Built target MultiDevicePlugin
[ 98%] Linking CXX shared library ../../../../../bin/intel64/Release/lib/libtemplatePlugin.so
[ 98%] Built target HeteroPlugin
[100%] Built target GNAPlugin
[100%] Built target templatePlugin
[100%] Built target myriadPlugin
[100%] Linking CXX executable ../../../../../bin/intel64/Release/myriad_compile
[100%] Linking CXX executable ../../../../../bin/intel64/Release/myriad_perfcheck
[100%] Built target myriad_perfcheck
[100%] Built target myriad_compile


然后是安装

sudo make install
...

Install the project...
-- Install configuration: "Release"
-- Installing: /usr/local/bin/setupvars.sh
-- Installing: /usr/local/install_dependencies
...


文件默认被安装到 /usr/local 下, 为了与以往的脚本兼容,我手动将这些文件移动了 /opt/intel/openvino 目录下。
然后安装 神经棒驱动文件

panda@Panda:/opt/intel/openvino/install_dependencies$ source install_NCS_udev_rules.sh 
Updating udev rules...
Udev rules have been successfully installed.

重启系统后,可以测试一下设备

panda@Panda:/opt/intel/openvino/inference_engine/samples/python/hello_query_device$ lsusb
Bus 001 Device 013: ID 03e7:2485 Intel Movidius MyriadX

panda@Panda:/opt/intel/openvino/inference_engine/samples/python/hello_query_device$ python3 hello_query_device.py 
Available devices:
	Device: MYRIAD
	Metrics:
		DEVICE_THERMAL: UNSUPPORTED TYPE
		OPTIMIZATION_CAPABILITIES: FP16
		RANGE_FOR_ASYNC_INFER_REQUESTS: 3, 6, 1
		SUPPORTED_METRICS: DEVICE_THERMAL, OPTIMIZATION_CAPABILITIES, RANGE_FOR_ASYNC_INFER_REQUESTS, SUPPORTED_METRICS, SUPPORTED_CONFIG_KEYS, FULL_DEVICE_NAME, AVAILABLE_DEVICES
		SUPPORTED_CONFIG_KEYS: DEVICE_ID, EXCLUSIVE_ASYNC_REQUESTS, LOG_LEVEL, VPU_MYRIAD_FORCE_RESET, VPU_MYRIAD_PLATFORM, VPU_CUSTOM_LAYERS, PERF_COUNT, VPU_PRINT_RECEIVE_TENSOR_TIME, CONFIG_FILE, VPU_HW_STAGES_OPTIMIZATION, MYRIAD_ENABLE_FORCE_RESET, MYRIAD_ENABLE_RECEIVING_TENSOR_TIME, MYRIAD_CUSTOM_LAYERS, MYRIAD_ENABLE_HW_ACCELERATION
		FULL_DEVICE_NAME: Intel Movidius Myriad X VPU
		AVAILABLE_DEVICES: 1.1-ma2480

	Default values for device configuration keys:
		DEVICE_ID: 
		EXCLUSIVE_ASYNC_REQUESTS: NO
		LOG_LEVEL: LOG_NONE
		VPU_MYRIAD_FORCE_RESET: NO
		VPU_MYRIAD_PLATFORM: 
		VPU_CUSTOM_LAYERS: 
		PERF_COUNT: NO
		VPU_PRINT_RECEIVE_TENSOR_TIME: NO
		CONFIG_FILE: 
		VPU_HW_STAGES_OPTIMIZATION: YES
		MYRIAD_ENABLE_FORCE_RESET: NO
		MYRIAD_ENABLE_RECEIVING_TENSOR_TIME: NO
		MYRIAD_CUSTOM_LAYERS: 
		MYRIAD_ENABLE_HW_ACCELERATION: YES

跑个分类模型测试一下
在这里插入图片描述

panda@Panda:/opt/intel/openvino/inference_engine/samples/python$ python3 classification_sample/classification_sample.py --input ~/test/beagle.jpeg --model ~/ml/models/public/squeezenet1.1/FP16/squeezenet1.1.xml -d MYRIAD --labels ~/ml/models/synset_words.txt 
[ INFO ] Creating Inference Engine
[ INFO ] Loading network files:
	/home/panda/ml/models/public/squeezenet1.1/FP16/squeezenet1.1.xml
	/home/panda/ml/models/public/squeezenet1.1/FP16/squeezenet1.1.bin
[ INFO ] Preparing input blobs
[ WARNING ] Image /home/panda/test/beagle.jpeg is resized from (168, 300) to (227, 227)
[ INFO ] Batch size is 1
[ INFO ] Loading model to the plugin
[ INFO ] Starting inference in synchronous mode
[ INFO ] Processing output blob
[ INFO ] Top 10 results: 
Image /home/panda/test/beagle.jpeg

classid probability
------- -----------
beagle    0.6635742
English foxhound 0.2944336
Walker hound, Walker foxhound0.0374146
 boxer   0.0008821
Saint Bernard, St Bernard0.0008273
Greater Swiss Mountain dog0.0006657
Welsh springer spaniel0.0005026
basset, basset hound0.0003791
EntleBucher0.0002651
American Staffordshire terrier, Staffordshire terrier, American pit bull terrier, pit bull terrier0.0002090


[ INFO ] This sample is an API example, for any performance measurements please use the dedicated benchmark_app tool

一切正常,又可以愉快的玩耍了!

谢谢阅读,如果您觉得有用,请收藏点赞投票。


版权声明:本文为dxxdxxd原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。