openvino/inference-engine/ie_bridges/python
Sergey Lyubimtsev a10f40d6d4
Set scikit-image~=0.18.3 for python versions >=3.7 (#7910)
* Set scikit-image~=0.18.3 for python versions >=3.7

* Set scikit-image>=0.17.2 (0.17.2 is not available for >=3.7)
2021-10-12 11:49:42 +03:00
..
cmake [New Python API] Add new python API based on pybind11 (#7752) 2021-10-05 13:55:54 +03:00
docs New IRC package structure (#6255) 2021-09-15 16:49:11 +03:00
sample Fix a result shape for a model with a 3d tensor at the output (#7741) 2021-09-30 16:58:11 +03:00
src Split Transformations between MOC and Common pipelines (#7580) 2021-10-08 19:07:41 +03:00
tests Improved ov::Tensor behavior (#7683) 2021-09-28 12:50:51 +03:00
wheel Set scikit-image~=0.18.3 for python versions >=3.7 (#7910) 2021-10-12 11:49:42 +03:00
.bandit feat: linters for IE Py API, wheel, samples (#5352) 2021-04-28 13:52:03 +03:00
CMakeLists.txt Improved openvino runtime python wheel build (#7604) 2021-09-23 10:41:57 +03:00
README.md Removed NGRAPH_PYTHON_BUILD_ENABLE (#6556) 2021-07-07 21:23:36 +03:00
requirements.txt Set less strict numpy requirements (#6039) 2021-06-04 20:55:22 +03:00
requirements_dev.txt feat: linters for IE Py API, wheel, samples (#5352) 2021-04-28 13:52:03 +03:00
setup.cfg feat: linters for IE Py API, wheel, samples (#5352) 2021-04-28 13:52:03 +03:00

README.md

Software Requirements

  • CMake* 3.9 or later
  • Microsoft* Visual Studio 2015 or later on Windows*
  • gcc 4.8 or later on Linux
  • Python 2.7 or higher on Linux*
  • Python 3.6 or higher on Windows*

Prerequisites

  1. Install Inference Engine Python API dependencies:
pip3 install -r requirements.txt

Building on Linux

Build Inference Engine Python API alongside with the Inference Engine build. You need to run Inference Engine build with the following flags:

  cd <INSTALL_DIR>/openvino
  mkdir -p build
  cd build
  cmake -DENABLE_PYTHON=ON -DPYTHON_EXECUTABLE=`which python3.6` \
  	-DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.6m.so \
  	-DPYTHON_INCLUDE_DIR=/usr/include/python3.6 ..
  make -j16

Building on Windows

You need to run Inference Engine build with the following flags:

	cd <INSTALL_DIR>/openvino
	mkdir build
	cd build
	set PATH=C:\Program Files\Python36\Scripts;%PATH%
	cmake -G "Visual Studio 15 2017 Win64" ^
		-DENABLE_PYTHON=ON ^
		-DPYTHON_EXECUTABLE="C:\Program Files\Python36\python.exe" ^
		-DPYTHON_INCLUDE_DIR="C:\Program Files\Python36\include" ^
		-DPYTHON_LIBRARY="C:\Program Files\Python36\libs\python36.lib" ..

Then build generated solution INFERENCE_ENGINE_DRIVER.sln using Microsoft* Visual Studio or run cmake --build . --config Release to build from the command line.

Building Python wheel

  1. Install Inference Engine Python API dependencies:
pip3 install -r wheel/requirements-dev.txt
  1. Install the patchelf tool on Linux only:
sudo apt install patchelf
  1. Run Inference Engine build with the following options:
-DENABLE_PYTHON=ON
-DENABLE_WHEEL=ON

Running sample

Before running the Python samples:

  • add the folder with built openvino Python module (located at bin/intel64/Release/lib/python_api/python3.6 for Linux) to the PYTHONPATH environment variable.
  • add the folder with Inference Engine libraries to LD_LIBRARY_PATH variable on Linux (or PATH on Windows).

Example of command line to run classification sample:

python3 sample/classification_sample.py -m <path/to/xml> -i <path/to/input/image> -d CPU