0

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.

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 -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

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. I was able to get the module openvino to load by adjusting the export path. 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.

J.Milliscone
  • 31
  • 1
  • 7

2 Answers2

0

As of right now, the builds for the Raspberry Pi are not being made with NGRAPH compiled. 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/m-p/1263401#M23093

The comment by the Intel "Support" is wrong and won't work on new builds.

J.Milliscone
  • 31
  • 1
  • 7
  • You mentioned that you could run verification script (/opt/intel/openvino/bin/armv7l/Release/object_detection_sample_ssd) but unable to run one of the python examples. – Rommel_Intel Apr 01 '21 at 17:00
  • As such, we replicated your issue on our build from source setup with the Classification Python demo. We faced the same “ModuleNotFoundError” as you faced. – Rommel_Intel Apr 01 '21 at 17:02
  • Upon setting all the environment variables, we were able to run the demo successfully. That was the reason we provided the previous solution to you. – Rommel_Intel Apr 01 '21 at 17:02
  • However, we overlooked the fact that Python demo script does not import ngraph module in the script. We apologize for our oversight. – Rommel_Intel Apr 01 '21 at 17:02
  • We revalidated with Object Detection Demo (which imports ngraph module) and we are seeing the same error again. – Rommel_Intel Apr 01 '21 at 17:02
  • ngraph is not included in Intel distribution for Raspberry Pi, and now we are still investigating whether it is possible to build ngraph module with the open source version of OpenVINO. We will update you once we have clarified this. – Rommel_Intel Apr 01 '21 at 17:03
  • @IntelSupport please **edit & update** accordingly your answer above, instead of engaging with such long discussions in the comments. – desertnaut Apr 11 '21 at 21:47
0

Please refer to the steps below for building Open Source OpenVINO™ Toolkit for Raspbian OS:

  1. Set up build environment and install build tools

    sudo apt update && sudo apt upgrade -y

    sudo apt install build-essential

  2. Install CMake from source

    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

  3. Install OpenCV from source

    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

  4. 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

  5. Start CMake build

    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

  6. Configure the Intel® Neural Compute Stick 2 Linux USB Driver

    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

  7. Verify nGraph module binding to Python

    cd /home/pi/openvino_dist/deployment_tools/inference_engine/samples/python/object_detection_sample_ssd

    python3 object_detection_sample_ssd.py -h

Rommel_Intel
  • 1,369
  • 1
  • 4
  • 8