Raspberry Pi 4B安装 OpenVINO™ 工具包

本文详细介绍了如何在Raspberry Pi 4B 8GB上下载并安装OpenVINO 2021.4.582工具包,设置环境变量,为英特尔神经计算棒2设备添加USB规则,构建对象检测示例,以及解决常见问题。重点涉及下载、依赖安装、模型运行和设备兼容性。
摘要由CSDN通过智能技术生成

组件:
Raspberry Pi 4B 8G

环境:

  • OpenVINO:2021.4.582
  • Python 3.7.3
  • g++ (Raspbian 8.3.0-6+rpi1) 8.3.0

官方文档:https://docs.openvinotoolkit.org/latest/openvino_docs_install_guides_installing_openvino_raspbian.html

下载树莓派使用的 OpenVINO™ 工具包

https://storage.openvinotoolkit.org/repositories/openvino/packages/

根据需要选择合适的 l_openvino_toolkit_runtime_raspbian_p_\<version>.tgzOpenVINO 工具包

wget https://storage.openvinotoolkit.org/repositories/openvino/packages/2021.4/l_openvino_toolkit_runtime_raspbian_p_2021.4.582.tgz

pi@raspberrypi:~/Desktop $ wget https://storage.openvinotoolkit.org/repositories/openvino/packages/2021.4/l_openvino_toolkit_runtime_raspbian_p_2021.4.582.tgz
–2021-09-03 14:58:53-- https://storage.openvinotoolkit.org/repositories/openvino/packages/2021.4/l_openvino_toolkit_runtime_raspbian_p_2021.4.582.tgz
长度:28644606 (27M) [application/octet-stream]
正在保存至: “l_openvino_toolkit_runtime_raspbian_p_2021.4.582.tgz”
l_openvino_toolkit_runtime 100%[=======================================>] 27.32M 4.85MB/s 用时 6.9s
2021-09-03 14:59:02 (3.98 MB/s) - 已保存 “l_openvino_toolkit_runtime_raspbian_p_2021.4.582.tgz” [28644606/28644606])

下载好以后,如下图

在这里插入图片描述

创建安装文件夹
sudo mkdir -p /opt/intel/openvino_2021

在这里插入图片描述

将下载好的 OpenVINO™ 工具包 解压到该目录中

sudo tar -xf  l_openvino_toolkit_runtime_raspbian_p_2021.4.582.tgz --strip 1 -C /opt/intel/openvino_2021

在这里插入图片描述

安装外部软件依赖项

使用OpenVINO™ 工具包需要 CMake 版本 3.7.2 或更高版本。要安装CMake,需要打开终端窗口并运行以下命令:

sudo apt install cmake
设置环境变量

设置环境变量,才能编译和运行 OpenVINO 工具包应用程序。

运行以下脚本临时设置环境变量:

source /opt/intel/openvino_2021/bin/setupvars.sh

注:每次关闭树莓派时会删除 OpenVINO 环境变量。

可以按如下方式永久设置环境变量:

echo "source /opt/intel/openvino_2021/bin/setupvars.sh" >> ~/.bashrc

坏境变量设置成功后,每次打开一个新终端,都会看到以下内容:

[setupvars.sh] OpenVINO environment initialized
为英特尔神经计算棒 2 设备添加 USB 规则

将当前 Linux 用户添加到users组中:

sudo usermod -a -G users "pi"

注意:如果没有修改.bashrc永久设置环境变量,每次使用OpenVINO 需要运行:

source /opt/intel/openvino_2021/bin/setupvars.sh

在英特尔® 神经计算棒 2 上执行推理,需要安装运行install_NCS_udev_rules.sh脚本的 USB 规则:

sh /opt/intel/openvino_2021/install_dependencies/install_NCS_udev_rules.sh

pi@raspberrypi:~/Desktop $ sh /opt/intel/openvino_2021/install_dependencies/install_NCS_udev_rules.sh
Updating udev rules…
Udev rules have been successfully installed.

树莓派已经成功安装 OpenVINO™ 工具包,可以进行使用了。

构建并运行对象检测示例

按照以下步骤使用 OpenVINO 工具包中的推理引擎示例使用预训练的人脸检测模型。

创建build的目录并进入:

mkdir build && cd build

构建对象检测示例:

cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-march=armv7-a" /opt/intel/openvino_2021/deployment_tools/inference_engine/samples/cpp

pi@raspberrypi:~ $ mkdir build && cd build
pi@raspberrypi:~/build $ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-march=armv7-a" /opt/intel/openvino_2021/deployment_tools/inference_engine/samples/cpp
– The C compiler identification is GNU 8.3.0
– The CXX compiler identification is GNU 8.3.0
– 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
– 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 strtoll
– Looking for strtoll - found
– Configuring done
– Generating done
– Build files have been written to: /home/pi/build

在build 文件夹下生成了很多案例:
在这里插入图片描述
使用 make 编译 object_detection_sample_ssd 案例

make -j2 object_detection_sample_ssd

pi@raspberrypi:~/build $ make -j2 object_detection_sample_ssd
Scanning dependencies of target gflags_nothreads_static
[ 6%] Building CXX object thirdparty/gflags/CMakeFiles/gflags_nothreads_static.dir/src/gflags.cc.o
[ 13%] Building CXX object thirdparty/gflags/CMakeFiles/gflags_nothreads_static.dir/src/gflags_reporting.cc.o
[ 20%] Building CXX object thirdparty/gflags/CMakeFiles/gflags_nothreads_static.dir/src/gflags_completions.cc.o
[ 26%] Linking CXX static library …/…/armv7l/Release/lib/libgflags_nothreads.a
[ 26%] Built target gflags_nothreads_static
Scanning dependencies of target ie_samples_utils
[ 40%] Building CXX object common/utils/CMakeFiles/ie_samples_utils.dir/src/common.cpp.o
[ 40%] Building CXX object common/utils/CMakeFiles/ie_samples_utils.dir/src/args_helper.cpp.o
[ 46%] Building CXX object common/utils/CMakeFiles/ie_samples_utils.dir/src/slog.cpp.o
[ 53%] Linking CXX static library …/…/armv7l/Release/lib/libie_samples_utils.a
[ 53%] Built target ie_samples_utils
Scanning dependencies of target format_reader
[ 66%] Building CXX object common/format_reader/CMakeFiles/format_reader.dir/MnistUbyte.cpp.o
[ 66%] Building CXX object common/format_reader/CMakeFiles/format_reader.dir/bmp.cpp.o
[ 73%] Building CXX object common/format_reader/CMakeFiles/format_reader.dir/format_reader.cpp.o
[ 80%] Building CXX object common/format_reader/CMakeFiles/format_reader.dir/opencv_wrapper.cpp.o
[ 86%] Linking CXX shared library …/…/armv7l/Release/lib/libformat_reader.so
[ 86%] Built target format_reader
Scanning dependencies of target object_detection_sample_ssd
[ 93%] Building CXX object object_detection_sample_ssd/CMakeFiles/object_detection_sample_ssd.dir/main.cpp.o
[100%] Linking CXX executable …/armv7l/Release/object_detection_sample_ssd
[100%] Built target object_detection_sample_ssd
pi@raspberrypi:~/build $

使用模型下载器从github下载预训练的人脸检测模型:

git clone --depth 1 https://github.com/openvinotoolkit/open_model_zoo
cd open_model_zoo/tools/downloader
python3 -m pip install -r requirements.in
python3 downloader.py --name face-detection-adas-0001 

pi@raspberrypi:~/build $ git clone --depth 1 https://github.com/openvinotoolkit/open_model_zoo
正克隆到 ‘open_model_zoo’…
remote: Enumerating objects: 2954, done.
remote: Counting objects: 100% (2954/2954), done.
remote: Compressing objects: 100% (2196/2196), done.
remote: Total 2954 (delta 898), reused 1572 (delta 637), pack-reused 0
接收对象中: 100% (2954/2954), 145.44 MiB | 2.55 MiB/s, 完成.
处理 delta 中: 100% (898/898), 完成.
正在检出文件: 100% (2448/2448), 完成.
pi@raspberrypi:~/build $ cd open_model_zoo/tools/downloader
pi@raspberrypi:~/build/open_model_zoo/tools/downloader $ python3 -m pip install -r requirements.in
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pyyaml>=5.4.1 (from -r requirements.in (line 1))
Downloading https://www.piwheels.org/simple/pyyaml/PyYAML-5.4.1-cp37-cp37m-linux_armv7l.whl (45kB)
100% |████████████████████████████████| 51kB 172kB/s
Collecting requests>=2.25.1 (from -r requirements.in (line 2))
Downloading https://files.pythonhosted.org/packages/92/96/144f70b972a9c0eabbd4391ef93ccd49d0f2747f4f6a2a2738e99e5adc65/requests-2.26.0-py2.py3-none-any.whl (62kB)
100% |████████████████████████████████| 71kB 326kB/s
Collecting charset-normalizer~=2.0.0; python_version >= “3” (from requests>=2.25.1->-r requirements.in (line 2))
Downloading https://files.pythonhosted.org/packages/33/53/b7f6126a2b9fd878b025fe3c40266cfaad696f312165008ce045bffa3fe7/charset_normalizer-2.0.4-py3-none-any.whl
Requirement already satisfied: idna<4,>=2.5; python_version >= “3” in /usr/lib/python3/dist-packages (from requests>=2.25.1->-r requirements.in (line 2)) (2.6)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/lib/python3/dist-packages (from requests>=2.25.1->-r requirements.in (line 2)) (1.24.1)
Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python3/dist-packages (from requests>=2.25.1->-r requirements.in (line 2)) (2018.8.24)
Installing collected packages: pyyaml, charset-normalizer, requests
The script normalizer is installed in ‘/home/pi/.local/bin’ which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed charset-normalizer-2.0.4 pyyaml-5.4.1 requests-2.26.0
pi@raspberrypi:~/build/open_model_zoo/tools/downloader $ python3 downloader.py --name face-detection-adas-0001
################|| Downloading face-detection-adas-0001 ||################

========== Downloading /home/pi/build/open_model_zoo/tools/downloader/intel/face-detection-adas-0001/FP32/face-detection-adas-0001.xml
… 100%, 231 KB, 265 KB/s, 0 seconds passed

========== Downloading /home/pi/build/open_model_zoo/tools/downloader/intel/face-detection-adas-0001/FP32/face-detection-adas-0001.bin
… 100%, 4113 KB, 1842 KB/s, 2 seconds passed

========== Downloading /home/pi/build/open_model_zoo/tools/downloader/intel/face-detection-adas-0001/FP16/face-detection-adas-0001.xml
… 100%, 231 KB, 260 KB/s, 0 seconds passed

========== Downloading /home/pi/build/open_model_zoo/tools/downloader/intel/face-detection-adas-0001/FP16/face-detection-adas-0001.bin
… 100%, 2056 KB, 1249 KB/s, 1 seconds passed

========== Downloading /home/pi/build/open_model_zoo/tools/downloader/intel/face-detection-adas-0001/FP16-INT8/face-detection-adas-0001.xml
… 100%, 498 KB, 450 KB/s, 1 seconds passed

========== Downloading /home/pi/build/open_model_zoo/tools/downloader/intel/face-detection-adas-0001/FP16-INT8/face-detection-adas-0001.bin
… 100%, 1074 KB, 785 KB/s, 1 seconds passed

运行示例,指定模型、输入图像的路径以及与 树莓派 操作系统一起运行所需的 VPU:

格式:

./armv7l/Release/object_detection_sample_ssd -m <path_to_model>/face-detection-adas-0001.xml -d MYRIAD -i <path_to_image>

我在 build 目录下进行测试:

./armv7l/Release/object_detection_sample_ssd -m ./open_model_zoo/tools/downloader/intel/face-detection-adas-0001/FP32/face-detection-adas-0001.xml -d MYRIAD -i ./test.jpg

检测一张人脸图片后,程序输出一个图像 ( out_0.bmp),其中检测到的人脸被框出。

pi@raspberrypi:~/build $ ./armv7l/Release/object_detection_sample_ssd -m ./open_model_zoo/tools/downloader/intel/face-detection-adas-0001/FP32/face-detection-adas-0001.xml -d MYRIAD -i ./test.jpg
[ INFO ] InferenceEngine:
IE version … 2021.4.0
Build … 2021.4.0-3839-cd81789d294-releases/2021/4
Parsing input parameters
[ INFO ] Files were added: 1
[ INFO ] ./test.jpg
[ INFO ] Loading Inference Engine
[ INFO ] Device info:
MYRIAD
myriadPlugin version … 2021.4.0
Build … 2021.4.0-3839-cd81789d294-releases/2021/4
[ INFO ] Loading network files:
[ INFO ] ./open_model_zoo/tools/downloader/intel/face-detection-adas-0001/FP32/face-detection-adas-0001.xml
[ INFO ] Preparing input blobs
[ INFO ] Batch size is 1
[ INFO ] Preparing output blobs
[ INFO ] Loading model to the device
[ INFO ] Create infer request
[ WARNING ] Image is resized from (640, 640) to (672, 384)
[ INFO ] Batch size is 1
[ INFO ] Start inference
[ INFO ] Processing output blobs
[0,1] element, prob = 1 (150,111)-(540,610) batch id : 0 WILL BE PRINTED!
[1,1] element, prob = 0.0268555 (591,126)-(616,185) batch id : 0
[2,1] element, prob = 0.0258789 (587,137)-(620,217) batch id : 0
[3,1] element, prob = 0.0249023 (553,283)-(616,423) batch id : 0
[4,1] element, prob = 0.0219727 (561,50)-(580,82) batch id : 0
[5,1] element, prob = 0.0200195 (544,97)-(597,204) batch id : 0
[6,1] element, prob = 0.0200195 (571,117)-(610,190) batch id : 0
[7,1] element, prob = 0.0200195 (595,69)-(646,199) batch id : 0
[8,1] element, prob = 0.0200195 (514,192)-(608,278) batch id : 0
[9,1] element, prob = 0.0200195 (559,242)-(621,373) batch id : 0
[10,1] element, prob = 0.0200195 (601,278)-(644,441) batch id : 0
[11,1] element, prob = 0.019043 (577,52)-(597,83) batch id : 0
[12,1] element, prob = 0.019043 (562,100)-(581,138) batch id : 0
[13,1] element, prob = 0.019043 (577,101)-(596,135) batch id : 0
[14,1] element, prob = 0.019043 (594,100)-(612,133) batch id : 0
[15,1] element, prob = 0.019043 (416,-5)-(480,37) batch id : 0
[16,1] element, prob = 0.019043 (451,-4)-(508,37) batch id : 0
[17,1] element, prob = 0.019043 (555,82)-(587,153) batch id : 0
[18,1] element, prob = 0.019043 (617,213)-(641,280) batch id : 0
[19,1] element, prob = 0.019043 (595,122)-(644,241) batch id : 0
[20,1] element, prob = 0.019043 (596,234)-(651,354) batch id : 0
[21,1] element, prob = 0.0180664 (578,78)-(596,110) batch id : 0
[22,1] element, prob = 0.0180664 (593,76)-(613,115) batch id : 0
[23,1] element, prob = 0.0180664 (547,103)-(566,138) batch id : 0
[24,1] element, prob = 0.0180664 (555,8)-(591,70) batch id : 0
[25,1] element, prob = 0.0180664 (564,48)-(611,135) batch id : 0
[26,1] element, prob = 0.0180664 (586,218)-(615,293) batch id : 0
[27,1] element, prob = 0.0180664 (597,205)-(640,293) batch id : 0
[28,1] element, prob = 0.0180664 (533,294)-(593,436) batch id : 0
[29,1] element, prob = 0.0180664 (552,405)-(587,481) batch id : 0
[30,1] element, prob = 0.0170898 (562,128)-(581,167) batch id : 0
[31,1] element, prob = 0.0170898 (556,349)-(582,410) batch id : 0
[32,1] element, prob = 0.0170898 (555,36)-(586,93) batch id : 0
[33,1] element, prob = 0.0170898 (573,30)-(605,92) batch id : 0
[34,1] element, prob = 0.0170898 (556,64)-(586,124) batch id : 0
[35,1] element, prob = 0.0170898 (548,52)-(594,140) batch id : 0
[36,1] element, prob = 0.0170898 (530,70)-(580,172) batch id : 0
[37,1] element, prob = 0.0170898 (617,148)-(641,209) batch id : 0
[38,1] element, prob = 0.0170898 (586,177)-(618,269) batch id : 0
[39,1] element, prob = 0.0170898 (546,362)-(587,445) batch id : 0
[40,1] element, prob = 0.0170898 (570,364)-(599,456) batch id : 0
[41,1] element, prob = 0.0170898 (505,95)-(558,272) batch id : 0
[42,1] element, prob = 0.0170898 (564,173)-(625,300) batch id : 0
[43,1] element, prob = 0.0170898 (525,242)-(599,395) batch id : 0
[44,1] element, prob = 0.0161133 (414,-1)-(450,34) batch id : 0
[45,1] element, prob = 0.0161133 (433,-3)-(467,31) batch id : 0
[46,1] element, prob = 0.0161133 (449,-2)-(483,30) batch id : 0
[47,1] element, prob = 0.0161133 (477,0)-(515,38) batch id : 0
[48,1] element, prob = 0.0161133 (609,-4)-(630,29) batch id : 0
[49,1] element, prob = 0.0161133 (563,75)-(581,111) batch id : 0
[50,1] element, prob = 0.0161133 (577,128)-(596,169) batch id : 0
[51,1] element, prob = 0.0161133 (606,131)-(625,166) batch id : 0
[52,1] element, prob = 0.0161133 (621,129)-(640,171) batch id : 0
[53,1] element, prob = 0.0161133 (609,230)-(628,266) batch id : 0
[54,1] element, prob = 0.0161133 (573,325)-(598,383) batch id : 0
[55,1] element, prob = 0.0161133 (542,376)-(567,433) batch id : 0
[56,1] element, prob = 0.0161133 (562,418)-(580,464) batch id : 0
[57,1] element, prob = 0.0161133 (570,2)-(612,70) batch id : 0
[58,1] element, prob = 0.0161133 (569,65)-(603,119) batch id : 0
[59,1] element, prob = 0.0161133 (571,85)-(603,152) batch id : 0
[60,1] element, prob = 0.0161133 (589,89)-(617,161) batch id : 0
[61,1] element, prob = 0.0161133 (599,95)-(629,157) batch id : 0
[62,1] element, prob = 0.0161133 (530,115)-(577,189) batch id : 0
[63,1] element, prob = 0.0161133 (596,123)-(629,194) batch id : 0
[64,1] element, prob = 0.0161133 (603,197)-(633,264) batch id : 0
[65,1] element, prob = 0.0161133 (584,245)-(614,322) batch id : 0
[66,1] element, prob = 0.0161133 (544,424)-(574,499) batch id : 0
[67,1] element, prob = 0.0161133 (544,453)-(594,561) batch id : 0
[68,1] element, prob = 0.0161133 (534,113)-(590,260) batch id : 0
[69,1] element, prob = 0.0161133 (557,95)-(635,269) batch id : 0
[70,1] element, prob = 0.0161133 (495,171)-(566,310) batch id : 0
[71,1] element, prob = 0.0161133 (475,138)-(583,347) batch id : 0
[72,1] element, prob = 0.0161133 (553,422)-(717,699) batch id : 0
[73,1] element, prob = 0.015625 (546,50)-(565,82) batch id : 0
[74,1] element, prob = 0.015625 (542,120)-(570,175) batch id : 0
[75,1] element, prob = 0.015625 (546,129)-(566,164) batch id : 0
[76,1] element, prob = 0.015625 (576,173)-(601,226) batch id : 0
[77,1] element, prob = 0.015625 (592,178)-(613,214) batch id : 0
[78,1] element, prob = 0.015625 (592,238)-(611,271) batch id : 0
[79,1] element, prob = 0.015625 (562,364)-(579,405) batch id : 0
[80,1] element, prob = 0.015625 (562,391)-(579,434) batch id : 0
[81,1] element, prob = 0.015625 (532,446)-(551,486) batch id : 0
[82,1] element, prob = 0.015625 (547,444)-(566,486) batch id : 0
[83,1] element, prob = 0.015625 (560,442)-(579,489) batch id : 0
[84,1] element, prob = 0.015625 (389,0)-(448,42) batch id : 0
[85,1] element, prob = 0.015625 (461,1)-(528,71) batch id : 0
[86,1] element, prob = 0.015625 (546,20)-(599,107) batch id : 0
[87,1] element, prob = 0.015625 (618,56)-(645,116) batch id : 0
[88,1] element, prob = 0.015625 (550,133)-(585,219) batch id : 0
[89,1] element, prob = 0.015625 (572,157)-(611,240) batch id : 0
[90,1] element, prob = 0.015625 (618,244)-(642,321) batch id : 0
[91,1] element, prob = 0.015625 (581,277)-(612,354) batch id : 0
[92,1] element, prob = 0.015625 (561,339)-(601,416) batch id : 0
[93,1] element, prob = 0.015625 (563,389)-(606,495) batch id : 0
[94,1] element, prob = 0.015625 (530,425)-(563,500) batch id : 0
[95,1] element, prob = 0.015625 (198,570)-(317,645) batch id : 0
[96,1] element, prob = 0.015625 (258,568)-(382,642) batch id : 0
[97,1] element, prob = 0.015625 (596,63)-(688,470) batch id : 0
[98,1] element, prob = 0.015625 (524,240)-(636,507) batch id : 0
[99,1] element, prob = 0.0146484 (467,0)-(490,29) batch id : 0
[100,1] element, prob = 0.0146484 (575,-1)-(610,37) batch id : 0
[101,1] element, prob = 0.0146484 (530,51)-(551,86) batch id : 0
[102,1] element, prob = 0.0146484 (360,70)-(387,116) batch id : 0
[103,1] element, prob = 0.0146484 (561,154)-(581,193) batch id : 0
[104,1] element, prob = 0.0146484 (578,152)-(598,192) batch id : 0
[105,1] element, prob = 0.0146484 (592,156)-(613,194) batch id : 0
[106,1] element, prob = 0.0146484 (561,182)-(580,218) batch id : 0
[107,1] element, prob = 0.0146484 (606,175)-(625,215) batch id : 0
[108,1] element, prob = 0.0146484 (590,202)-(614,253) batch id : 0
[109,1] element, prob = 0.0146484 (608,211)-(627,249) batch id : 0
[110,1] element, prob = 0.0146484 (622,212)-(639,250) batch id : 0
[111,1] element, prob = 0.0146484 (577,236)-(597,271) batch id : 0
[112,1] element, prob = 0.0146484 (621,231)-(639,266) batch id : 0
[113,1] element, prob = 0.0146484 (574,259)-(600,309) batch id : 0
[114,1] element, prob = 0.0146484 (573,351)-(595,409) batch id : 0
[115,1] element, prob = 0.0146484 (547,422)-(565,464) batch id : 0
[116,1] element, prob = 0.0146484 (408,0)-(482,81) batch id : 0
[117,1] element, prob = 0.0146484 (443,9)-(487,79) batch id : 0
[118,1] element, prob = 0.0146484 (537,57)-(570,127) batch id : 0
[119,1] element, prob = 0.0146484 (519,105)-(558,195) batch id : 0
[120,1] element, prob = 0.0146484 (506,158)-(543,239) batch id : 0
[121,1] element, prob = 0.0146484 (545,167)-(593,233) batch id : 0
[122,1] element, prob = 0.0146484 (565,220)-(605,294) batch id : 0
[123,1] element, prob = 0.0146484 (562,253)-(608,320) batch id : 0
[124,1] element, prob = 0.0146484 (562,290)-(603,374) batch id : 0
[ INFO ] Image out_0.bmp created!
[ INFO ] Execution successful
[ INFO ] This sample is an API example, for any performance measurements please use the dedicated benchmark_app tool

输入图像:
在这里插入图片描述
输出图像:
在这里插入图片描述

查看树莓派有哪些设备支持 OpenVINO

pi@raspberrypi:~/Desktop $ source /opt/intel/openvino_2021/bin/setupvars.sh
[setupvars.sh] OpenVINO environment initialized
pi@raspberrypi:~/Desktop $ python3
Python 3.7.3 (default, Jan 22 2021, 20:04:44)
[GCC 8.3.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.
>>> from openvino.inference_engine import IECore
>>> ie = IECore()
>>> print(ie.available_devices)
[‘MYRIAD’]

注:
MYRIAD为神经计算棒插入树莓派后显示的设备名称。
如果插入的对象为Windows 10电脑则显示:[‘CPU’, ‘GNA’, ‘GPU’, ‘MYRIAD’]

踩坑:
  1. 我在检测图像时,找不到 object_detection_sample_ssd 这个文件:

pi@raspberrypi:~/build $ ./armv7l/Release/object_detection_sample_ssd -m ./open_model_zoo/tools/downloader/intel/face-detection-adas-0001/FP32/face-detection-adas-0001.xml -d MYRIAD -i ./test.jpg
./armv7l/Release/object_detection_sample_ssd: error while loading shared libraries: libinference_engine_transformations.so: cannot open shared object file: No such file or directory

  1. 在引入 openvino.inference_engine 库找不到 openvino

pi@raspberrypi:~/Desktop $ python3
Python 3.7.3 (default, Jan 22 2021, 20:04:44)
[GCC 8.3.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.
>>> from openvino.inference_engine import IECore
Traceback (most recent call last):
File “”, line 1, in
ModuleNotFoundError: No module named ‘openvino’

添加环境变可以解决以上问题

source /opt/intel/openvino_2021/bin/setupvars.sh
树莓派4B支持64位操作系统,因此可以安装64位版本的Raspberry Pi OS。ROS(Robot Operating System)是一个用于机器人软件开发的灵活框架,支持多种操作系统。要在64位的Raspberry Pi OS上安装ROS,可以遵循以下步骤: 1. 更新系统包列表和已安装的包: ```bash sudo apt update sudo apt upgrade ``` 2. 添加Debian软件仓库密钥: ```bash sudo apt install curl curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add - ``` 3. 添加ROS软件源到你的源列表中(这里以ROS Noetic为例,适用于Ubuntu 20.04,也就是对应于树莓派的Raspberry Pi OS 64位版本): ```bash sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' ``` 4. 安装ROS Noetic桌面完整版: ```bash sudo apt install ros-noetic-desktop-full ``` 5. 为ROS环境设置初始化脚本: ```bash echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc source ~/.bashrc ``` 6. 安装依赖项以便编译和运行rosinstall工具: ```bash sudo apt install python3-rosdep python3-rosinstall-generator python3-rosinstall python3-wstool build-essential ``` 7. 初始化rosdep(rosdep是ROS的依赖管理工具),需要在系统中安装一些依赖: ```bash sudo apt install python3-rosdep sudo rosdep init rosdep update ``` 8. 现在你已经安装了ROS Noetic,可以开始使用ROS环境进行开发了。 请注意,安装ROS之前,需要确保你的树莓派4B已经安装了64位版本的Raspberry Pi OS,并且系统已经更新到最新版本。另外,安装ROS可能需要较大的磁盘空间,并且在安装过程中需要注意依赖关系和兼容性问题。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值