-
Notifications
You must be signed in to change notification settings - Fork 38
BuildingForLinux
To install software requirements, please follow instructions. This manual is for Ubuntu 20.04, for other OS it may be different.
DLI supports several inference frameworks:
- Intel® Distribution of OpenVINO™ Toolkit (C++ and Python APIs).
- Caffe (Python API).
- TensorFlow (Python API).
- TensorFlow Lite (C++ and Python APIs).
- ONNX Runtime (C++ and Python APIs).
- MXNet (Python Gluon API).
- OpenCV DNN (C++ and Python APIs).
- PyTorch (C++ and Python APIs).
- Apache TVM (Python API).
- Deep Graph Library (PyTorch-based).
- Spektral (Python API).
- RKNN (C++ API).
- ncnn (Python API).
- PaddlePaddle (Python API).
-
Install Python tools (Python 3.8 is already installed by default in Ubuntu 20.04).
sudo apt install python3-pip python3-venv python3-tk
-
Create and activate virtual environment.
cd ~/ python3 -m venv dl-benchmark-env source ~/dl-benchmark-env/bin/activate python3 -m pip install --upgrade pip
-
Clone repository.
sudo apt install git git clone https://github.com/itlab-vision/dl-benchmark.git
-
Install requirements.
pip install -r ~/dl-benchmark/requirements.txt
If you would like to infer deep models using the Intel® Distribution of OpenVINO™ Toolkit (Python API), please, install openvino-dev
package using pip
.
pip install openvino-dev[caffe,mxnet,onnx,pytorch,tensorflow]==2022.1.0
Note: there is no way to install tensorflow
and tensorflow2
packages to the single virtual environment, so to convert tensorflow2
models, please, create another virtual environment and install openvino-dev
package with the support of tensorflow2
:
pip install openvino-dev[tensorflow2]==2022.1.0
Note: please, set the OpenVINO version instead of 2022.1.0
.
If you would like to infer deep models using the Intel® Distribution of OpenVINO™ Toolkit (C++ API), please, install the OpenVINO toolkit from sources or download pre-built package and follow Benchmark C++ tool build instructions to get OpenVINO C++ benchmark app built.
If you prefer Caffe to infer deep neural networks, please, install Miniconda or Anaconda and corresponding package caffe
.
conda install caffe
Note: Caffe requires Python <=3.7.
If you would like to infer deep models using the TensorFlow, please, install package intel-tensorflow
using pip
.
pip install tensorflow
To infer deep learning models using the TensorFlow lite framework please install tensorflow
python package.
pip install tensorflow
TensorFlow lite CPP requires to be built from sources along with dedicated benchmark tool. Please refer to build instruction to build binaries.
To infer deep learning models using ONNX Runtime (Python API), please, install the corresponding package.
pip install onnxruntime
ONNX Runtime requires to be built from sources along with dedicated benchmark tool. Please refer to build instruction to build binaries.
If you would like to infer deep models using MXNet please install mxnet
python package.
pip install mxnet
To use OpenCV DNN backend inferring deep models, please, install the opencv-python
package.
pip install opencv-python
To use the OpenVINO Inference Engine backend, please, install the openvino
and openvino-dev
Python packages
and build OpenCV from sources. Set WITH_OPENVINO
option executing cmake
. The sequence of required instructions
is represented below. Don't foget to update environment variables.
OCV_VERSION=4.7.0
git clone --recurse-submodules https://github.com/opencv/opencv.git \
--depth 1 --branch ${OCV_VERSION} --single-branch
OpenCV_BUILD_DIR=build-opencv
mkdir $OpenCV_BUILD_DIR
cd $OpenCV_BUILD_DIR
cmake -G Ninja \
-D CMAKE_INSTALL_PREFIX=install \
-D CMAKE_BUILD_TYPE=Release \
-D BUILD_EXAMPLES=OFF \
-D BUILD_TESTS=OFF \
-D BUILD_DOCS=OFF \
-D WITH_OPENVINO=ON \
-D OPENCV_LIB_INSTALL_PATH=lib \
-D OPENCV_CONFIG_INSTALL_PATH=cmake \
-D PYTHON3_PACKAGES_PATH=install/python/python3 \
./opencv && ninja && cmake --install .'
OpenCV_INSTALL_DIR="$OpenCV_BUILD_DIR/install"
OpenCV_DIR="$OpenCV_INSTALL_DIR/cmake"
LD_LIBRARY_PATH="$OpenCV_INSTALL_DIR/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
PYTHONPATH="$OpenCV_INSTALL_DIR/python/python3/cv2/python-3.8${PYTHONPATH:+:$PYTHONPATH}"
Note: please, set the OpenCV version instead of 4.7.0
.
OpenCV DNN CPP requires to be built from sources along with dedicated benchmark tool. Please refer to build instruction to build binaries.
To infer deep learning models using PyTorch, please, install the following packages:
pip install torch torchvision torchaudio
PyTorch CPP requires to be built from sources along with dedicated benchmark tool. Please refer to build instruction to build binaries.
To infer deep learning models using PyTorch, please, install the following packages:
pip install dgl -f https://data.dgl.ai/wheels/torch-2.1/repo.html
Note: if you have installed dgl-cuXX package, please uninstall it first.
If you would like to infer deep models using Spektral, please, install the package spektral
using pip.
pip install spektral
RKNN requires to be built from sources along with dedicated benchmark tool. Please refer to build instruction to build binaries.
To infer deep learning models using ncnn, please, install the following packages:
pip install ncnn
To infer deep learning models using Apache TVM, please, install the following package:
pip install apache-tvm
Notes:
- If you would like to infer Caffe, MXNet, PyTorch, TensorFlow Lite or ONNX models directly or convert these models to the TVM format, please, install the corresponding framework.
- If you would like to infer TensorFlow models, please, convert these models to the ONNX format using tf2onnx according to the recommendations of Apache TVM developers.
To infer deep learning models using PaddlePaddle, please, install the following packages.
Command to install CPU version:
python -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple
or
python -m pip install paddlepaddle -i https://pypi.tuna.tsinghua.edu.cn/simple
If you only want to install GPU version, please refer the command below.
python -m pip install paddlepaddle-gpu -i https://mirror.baidu.com/pypi/simple
or
python -m pip install paddlepaddle-gpu -i https://pypi.tuna.tsinghua.edu.cn/simple