TransWikia.com

How to set up OPENVINO in Ubuntu 20.04 to use intel movidius NCS?

Ask Ubuntu Asked by Delux Darling on December 31, 2021

Intel OPENVINO toolkit installation not supported in Ubuntu 20.04. I tried toolkit 2020.3.194

2 Answers

Since I can't comment Liju G. Chacko's answer:

In the cmake step, I got the following error:

CMake Error at inference-engine/cmake/dependencies.cmake:240 (message):
      OpenCV is not available on current platform
Call Stack (most recent call first):
      inference-engine/CMakeLists.txt:18 (include)

OpenCV was installed, so changing the line 240 in ../inference-engine/cmake/dependencies.cmake "fixed" it:

else()
-  message(FATAL_ERROR "OpenCV is not available on current platform")
+  set(OPENCV_SUFFIX "ubuntu20")
endif()

Also, there is two typing errors in the last step

$ source /usr/local/bin/setupvars.sh

At line 101, there is a "eliif" instead of "elif" and the line 131 should be commented.

Besides that, worked like a charm.

Answered by renandame on December 31, 2021

I have successfully setup OPENVINO in Kubuntu20.04. Steps I have followed is described below.

$ sudo apt-get install libopencv-dev python3-opencv python3 python3-pip python3-virtualenv libgfortran5
$ git clone https://github.com/openvinotoolkit/openvino.git

(hash -95677afe29206af7219a7648728f880667bcd989)

$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:openvino/bin/intel64/Release/lib 
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:openvino/build/lib 
$ cd openvino
$ git submodule update --init --recursive
$ chmod +x install_dependencies.sh
$ ./install_dependencies.sh
$ mkdir build && cd build

You have to make some changes in code before continuing

(+ for adding , - for removing)

(1)file- /scripts/setupvars/setupvars.sh

line 97

  if [ -z "$python_version" ]; then
+    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)')
-    if command -v python3.7 >/dev/null 2>&1; then    
+    elif command -v python3.7 >/dev/null 2>&1; then
        python_version=3.7
        python_bitness=$(python3.7 -c 'import sys; print(64 if sys.maxsize > 2**32 else 32)')    
    elif command -v python3.6 >/dev/null 2>&1; then   

line 129

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

(2)file- /inference-engine/src/gna_plugin/gna_helper.cpp

line 59 in function profilerRtcStart(intel_gna_profiler_rtc *p)

-ftime(&p->start);
+timespec start;
+clock_gettime(CLOCK_REALTIME, &start);
+p->start.time = start.tv_sec;
+p->start.millitm = start.tv_nsec/1000000;

line 68 in function profilerRtcStop(intel_gna_profiler_rtc *p)

-ftime(&p->stop);
+timespec stop;
+clock_gettime(CLOCK_REALTIME, &stop);
+p->stop.time = stop.tv_sec;
+p->stop.millitm = stop.tv_nsec/1000000;

(3)file- /inference-engine/thirdparty/ade/sources/ade/source/execution_engine.cpp

line 140 in function std::unique_ptr ExecutionEngine::createExecutable(const Graph& graph)

-return std::move(ret);
+return ret;

(4)file- /model-optimizer/install_prerequisites/install_prerequisites

line 75

-sudo -E apt -y install python3-pip python3-venv libgfortran3
+sudo -E apt -y install python3-pip python3-virtualenv libgfortran5

Go to build folder.

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

Note-:option -DENABLE_CLDNN=OFF disables GPU

$ make --jobs=$(nproc --all)
$ sudo make install
$ sudo ldconfig
$ cd ../model-optimizer

If your /tmp directory does not have enough space(require more than 4 GB), then assign an alternate temporary folder for python. Run export TMPDIR=<folder>

$ pip3 install -r requirements.txt 
$ cd install_prerequisites
$ ./install_prerequisites.sh
$ cd ..
$ cat <<EOF > 97-myriad-usbboot.rules
SUBSYSTEM=="usb", ATTRS{idProduct}=="2150", ATTRS{idVendor}=="03e7", GROUP="users", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
SUBSYSTEM=="usb", ATTRS{idProduct}=="2485", ATTRS{idVendor}=="03e7", GROUP="users", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
SUBSYSTEM=="usb", ATTRS{idProduct}=="f63b", ATTRS{idVendor}=="03e7", GROUP="users", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
EOF
$ sudo cp 97-myriad-usbboot.rules /etc/udev/rules.d/
$ sudo udevadm control --reload-rules
$ sudo udevadm trigger
$ sudo ldconfig

Now Installation of openvino is over.

  1. Compiled c and c++ example are present in folder- ~/inference_engine_samples_samples_build/intel64/Release/
  2. python examples are present in folder- /usr/local/deployment_tools/inference_engine/samples/python/
  3. Installation won't copy model-optimizer(/model-optimizer) into root directory

For more examples download open_model_zoo

  1. git clone https://github.com/opencv/open_model_zoo.git
  2. Go to <open_model_zoo folder>/demos/ and run ./build_demos.sh
  3. Compiled c and c++ examples goes to folder- ~/omz_demos_build/intel64/Release/
  4. <open_model_zoo folder>/tools/downloader/ contains downloader.py to download models. By default downloader downloader downloads models in '<open_model_zoo folder>/tools/downloader/public' or '<open_model_zoo folder>/tools/downloader/intel' folder

Before using model-optimizer or python sample, ensure to run

$ source /usr/local/bin/setupvars.sh

Answered by Liju G. Chacko on December 31, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP