ONNX
Installation
Prerequisites
!pip install -U numpy==1.23.1
!pip install -U onnx==1.12.0
!pip install -U onnxruntime==1.12.1
!pip install -U protobuf==3.16.0
!pip install -U typing-extensions==4.4.0
Ubuntu users: the quickest way to install protobuf is to run
apt-get install python3-pip python3-dev libprotobuf-dev protobuf-compiler
Then you can build ONNX as:
export CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=ON"
git clone --recursive https://github.com/onnx/onnx.git
cd onnx
# prefer lite proto
set CMAKE_ARGS=-DONNX_USE_LITE_PROTO=ON
pip install -e .
Verify Installation
After installation, run
python -c "import onnx"
Testing
ONNX uses pytest as test driver. In order to run tests, you will first need to install pytest:
pip install pytest nbval
After installing pytest, use the following command to run tests.
pytest
Benchmark
https://github.com/google/benchmark/tree/0d98dba29d66e93259db7daa53a9327df767a415
Installation
# Check out the library.
$ git clone https://github.com/google/benchmark.git
# Go to the library root directory
$ cd benchmark
# Make a build directory to place the build output.
$ cmake -E make_directory "build"
# Generate build system files with cmake, and download any dependencies.
$ cmake -E chdir "build" cmake -DBENCHMARK_DOWNLOAD_DEPENDENCIES=on -DCMAKE_BUILD_TYPE=Release ../
# or, starting with CMake 3.13, use a simpler form:
# cmake -DCMAKE_BUILD_TYPE=Release -S . -B "build"
# Build the library.
$ cmake --build "build" --config Release
fatal: 无法访问 ‘https://github.com/openstreetmap/osmosis.git/’:GnuTLS recv error (-110): The TLS connection was non-properly terminated.
解决方案:
关掉ssl
输入以下代码:
apt-get install gnutls-bin
git config --global http.sslVerify false
git config --global http.postBuffer 1048576000
pybind11
$ cd /workspace/TensorRT/parsers/onnx/third_party/onnx/third_party/
$ git clone https://github.com/pybind/pybind11.git
运行错误
运行yolov5
时docker
容器报错:ImportError: libGL.so.1: cannot open shared object file: No such file or directory
。
解决办法:
apt-get install ffmpeg libsm6 libxext6 -y
$ cd $TRT_OSSPATH
$ mkdir -p build && cd build
$ cmake .. -DTRT_LIB_DIR=$TRT_LIBPATH -DTRT_OUT_DIR=`pwd`/out
$ make -j$(nproc)