[英]Loading openvino python library on Raspebrry pi 4
After followign the guides (and coming through the github trackers), I was able to get OpenVINO to install on my pi4 and can run /opt/intel/openvino/bin/armv7l/Release/object_detection_sample_ssd successfully using my own trained model.在遵循指南(并通过 github 跟踪器)之后,我能够将 OpenVINO 安装在我的 pi4 上,并且可以使用我自己训练的 Z20F35E630DAF44DFA4C3F68F593 成功运行 /opt/intel/openvino/bin/armv7l/Release/object_detection_sample_ssd。
I used the follow cmake command most recently, but I've done pretty much all iterations I could find on the several instruction pages.我最近使用了以下 cmake 命令,但我已经完成了几乎所有可以在几个指令页面上找到的迭代。
cmake -DCMAKE_BUILD_TYPE=Release /
-DENABLE_SSE42=OFF /
-DTHREADING=SEQ /
-DENABLE_GNA=OFF /
-DENABLE_PYTHON=ON /
-DPYTHON_EXECUTABLE=/usr/bin/python3 /
-DPYTHON_LIBRARY=/usr/lib/arm-linux-gnueabihf/libpython3.7m.so /
-DPYTHON_INCLUDE_DIR=/usr/include/python3.7m /
-NGRAPH_PYTHON_BUILD_ENABLE=ON /
-DCMAKE_CXX_FLAGS=-latomic /
-DOPENCV_EXTRA_EXE_LINKER_FLAGS=-latomic /
-D CMAKE_INSTALL_PREFIX=/usr/local /
.. && make
When I try one of the python examples I get当我尝试 python 示例之一时,我得到
ModuleNotFoundError: No module named 'ngraph'
Looking more into it now and it appears the issue is the "setupvars.sh" script not calling into the right directory.现在仔细研究一下,问题似乎是“setupvars.sh”脚本没有调用正确的目录。 I was able to get the module openvino to load by adjusting the export path.
我能够通过调整导出路径来加载模块 openvino。 I must say the amount of documentation that is, quite frankly all over the place and seems to have wrong directory structures left and right.
我必须说文档的数量,坦率地说,到处都是,而且似乎左右都有错误的目录结构。
As of right now, the builds for the Raspberry Pi are not being made with NGRAPH compiled.截至目前,Raspberry Pi 的构建不是使用 NGRAPH 编译的。 The user has to compile it themselves from scratch per this thread.
用户必须根据这个线程从头开始编译它。 https://community.intel.com/t5/Intel-Distribution-of-OpenVINO/No-ngraph-bindings-for-python-in-raspbian-distribution/mp/1263401#M23093
https://community.intel.com/t5/Intel-Distribution-of-OpenVINO/No-ngraph-bindings-for-python-in-raspbian-distribution/mp/1263401#M23093
The comment by the Intel "Support" is wrong and won't work on new builds.英特尔“支持”的评论是错误的,不适用于新版本。
Please refer to the steps below for building Open Source OpenVINO™ Toolkit for Raspbian OS:请参考以下步骤为 Raspbian OS 构建开源 OpenVINO™ 工具包:
Set up build environment and install build tools设置构建环境并安装构建工具
sudo apt update && sudo apt upgrade -y
sudo apt install build-essential
Install CMake from source从源安装 CMake
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
make -j4 && sudo make install
Install OpenCV from source从源安装 OpenCV
sudo apt install git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev python3-scipy libatlas-base-dev
cd ~/
git clone --depth 1 --branch 4.5.2 https://github.com/opencv/opencv.git
cd opencv && mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local..
make -j4 && sudo make install
Download source code and install dependencies下载源代码并安装依赖项
cd ~/
git clone --depth 1 --branch 2021.3 https://github.com/openvinotoolkit/openvino.git
cd ~/openvino
git submodule update --init --recursive
sh./install_build_dependencies.sh
cd ~/openvino/inference-engine/ie_bridges/python/
pip3 install -r requirements.txt
Start CMake build开始 CMake 构建
export OpenCV_DIR=/usr/local/lib/cmake/opencv4
cd ~/openvino
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/home/pi/openvino_dist \
-DENABLE_MKL_DNN=OFF \
-DENABLE_CLDNN=OFF \
-DENABLE_GNA=OFF \
-DENABLE_SSE42=OFF \
-DTHREADING=SEQ \
-DENABLE_OPENCV=OFF \
-DNGRAPH_PYTHON_BUILD_ENABLE=ON \
-DNGRAPH_ONNX_IMPORT_ENABLE=ON \
-DENABLE_PYTHON=ON \
-DPYTHON_EXECUTABLE=$(which python3.7) \
-DPYTHON_LIBRARY=/usr/lib/arm-linux-gnueabihf/libpython3.7m.so \
-DPYTHON_INCLUDE_DIR=/usr/include/python3.7 \
-DCMAKE_CXX_FLAGS=-latomic..
make -j4 && sudo make install
Configure the Intel® Neural Compute Stick 2 Linux USB Driver配置英特尔® 神经计算棒 2 Linux USB 驱动程序
sudo usermod -a -G users "$(whoami)"
source /home/pi/openvino_dist/bin/setupvars.sh
sh /home/pi/openvino_dist/install_dependencies/install_NCS_udev_rules.sh
Verify nGraph module binding to Python验证 nGraph 模块绑定到 Python
cd /home/pi/openvino_dist/deployment_tools/inference_engine/samples/python/object_detection_sample_ssd
python3 object_detection_sample_ssd.py -h
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.