Note: The work presented in this repository is for demo and preview purposes only.
This repository provides a set of sample code that demostrate how to run PaddlePaddle models in OpenVINO.
Download this OpenVINO PaddlePaddle sample repository! Please note that we will install materials inside the openvino-paddlepaddle-demo folder as the default working directory.
git clone https://github.com/raymondlo84/openvino-paddlepaddle-demo.git
cd openvino-paddlepaddle-demo
Upcoming release openvino 2022.1 will officially support PaddlePaddle. But users can experience this feature from OpenVINO github master branch in advance.
We install the OpenVINO source library to the openvino/openvino_dist directory by default. Users can change it by modifying the cmake option "CMAKE_INSTALL_PREFIX".
For users who may have connection problem to github, may add this configuration to ~/.gitconfig :
[url "git://github.com"]
insteadOf="https://github.com"
Clone the OpenVINO source code from GitHub.
git clone https://github.com/openvinotoolkit/openvino.git
cd openvino
git submodule update --init --recursive
Install the dependencies for OpenVINO source and Python.
- For Linux
chmod +x install_build_dependencies.sh
./install_build_dependencies.sh
pip3 install -r inference-engine/ie_bridges/python/src/requirements-dev.txt
#install Python Dependencies
pip install -r inference-engine/ie_bridges/python/src/requirements-dev.txt
Compile the source code with the Python option enabled. It may take a few minute depending on your pc.
export OPENVINO_BASEDIR=`pwd`
mkdir build
cd build
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="${OPENVINO_BASEDIR}/openvino_dist" \
-DPYTHON_EXECUTABLE=$(which python3) \
-DENABLE_MYRIAD=OFF \
-DENABLE_VPU=OFF \
-DENABLE_PYTHON=ON \
-DNGRAPH_PYTHON_BUILD_ENABLE=ON \
..
make -j$(nproc); make install
Create the virtual environment and install dependencies. Now let's start from the working directory openvino-paddlepaddle-demo.
cd openvino-paddlepaddle-demo
python3 -m venv openvino_env
source openvino_env/bin/activate
#install the dependencies
python -m pip install --upgrade pip
pip install -r requirements.txt -i https://mirror.baidu.com/pypi/simple
#install the kernel to Jupyter
python -m ipykernel install --user --name openvino_env
This step is required as we are going to export the static paddlepaddle model from PaddlePaddle Open Model Zoo PaddleDetection, and may also do inference with PaddlePaddle as well.
# Note: please make sure you are in the openvino-paddlepaddle-demo directory.
git clone https://github.com/PaddlePaddle/PaddleDetection.git
cd PaddleDetection && git checkout release/2.1 && cd -
pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple
pip install --upgrade -r PaddleDetection/requirements.txt -i https://mirror.baidu.com/pypi/simple
#Optional
#python PaddeDetection/setup.py install
Enable the virtual environment, and also the OpenVINO environment. Then, execute the jupyter lab. These steps are required if a new session is used (i.e., the terminal was closed or restarted).
#For Linux and Mac
source openvino_env/bin/activate
source openvino/openvino_dist/bin/setupvars.sh
jupyter lab notebooks
PPYolo - notebooks/101-object-detection-yolo. MobilenetV3 Large - notebooks/100-mobilenetv3.
Note: Please make sure you select the openvino_env as the Kernel in the Notebooks.
- OpenVINO Notebooks - Great tutorials and simple pip install setup! (Recommended)
- Compiling OpenVINO from Source
- Converting a Paddle* Model
- Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.
- Performance results are based on testing as of dates shown in configurations and may not reflect all publicly available updates. See backup for configuration details.
- No product or component can be absolutely secure.
- Intel technologies may require enabled hardware, software or service activation.
- Your costs and results may vary.
- © Intel Corporation. Intel, the Intel logo, and other Intel marks are trademarks of Intel Corporation or its subsidiaries. Other names and brands may be claimed as the property of others.