https://www.jianshu.com/p/0543229dc7b8
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
sudo gedit /etc/apt/sources.list
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main restricted universe multiverse
sudo apt-get update
https://www.freesion.com/article/99911008229/
#cuda环境设置
export PATH="/usr/local/cuda-11.3/bin:$PATH"
export CUDA_PATH=/usr/local/cuda-11.3
export LD_LIBRARY_PATH="/usr/local/cuda-11.3/lib64:$LD_LIBRARY_PATH"
sudo pip3 install torch-1.9.0-cp36-cp36m-linux_aarch64.whl
aarch64-linux-gnu-gcc‘ failed with exit status 1
sudo pip install pyzmq==25.1.0
ImportError: libopenblas.so.0: cannot open
sudo apt-get install libopenblas-dev
Python 3.6.8 (default, Aug 20 2019, 17:12:48)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.__version__
'1.3.0'
>>> torch.cuda.is_available()
True
>>> torch.randn(4,4,4).cuda().mean()
tensor(-0.0479, device='cuda:0')
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple
-i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/
sudo pip install pyzmq==25.1.0
pip install matplotlib
for torchvision
pip install --upgrade pip setuptools wheel
pip install pycocotools
pip install terminaltables
pip install Cython
suggestion:
pip install openmim
mim install mmcv1.5.3
mim install mmcls0.25.0
mim install mmdet2.25.1
mim install mmsegmentation0.25.0
减速带算法mmdet3d pip install -e .
for Illegal instruction(core dumped)”: export OPENBLAS_CORETYPE=ARMV8
sudo apt install llvm
https://github.com/traveller59/spconv to install spconv and cumm,please read README carefully ,change python version in setup.py
agx版本:
sudo chmod +x cmake-3.27.0-rc4-linux-aarch64.sh
xavier:sudo sh cmake-3.27.0-rc4-linux-aarch64.sh
# 安装过程中遇到:
# 选择1
Do you accept the license? [yn]:
# 输入 y
# 选择2
By default the CMake will be installed in:
"/usr/cmake-3.23.0-linux-x86_64"
Do you want to include the subdirectory cmake-3.23.0-linux-x86_64?
Saying no will install in: "/usr" [Yn]:
# 输入 n
x86版本:
1、sudo wget https://cmake.org/files/v3.18/cmake-3.18.0-Linux-x86_64.sh
sh cmake-3.18.0-Linux-x86_64.sh
2、安装包解压后
export PATH="/home/sen/motan/cmake-3.20.0-linux-x86_64/bin:$PATH"
可以使用cmake --version 查看 如果输出 cmake的版本号说明已经正确安装了cmake
sudo apt-get update
sudo apt-get install -y build-essential
git clone https://github.com/openppl-public/ppl.cv.git
cd ppl.cv
export PPLCV_DIR=/home/sen/motan/ppl.cv
git checkout tags/v0.7.0 -b v0.7.0
./build.sh aarch64/cuda
x86
pip install onnxruntime==1.14.0
本地下载onnxruntime
export ONNXRUNTIME_DIR=$(pwd)
export LD_LIBRARY_PATH=$ONNXRUNTIME_DIR/lib:$LD_LIBRARY_PATH
echo '# set env for onnxruntime' >> ~/.bashrc
echo "export ONNXRUNTIME_DIR=${ONNXRUNTIME_DIR}" >> ~/.bashrc
echo "export LD_LIBRARY_PATH=$ONNXRUNTIME_DIR/lib:$LD_LIBRARY_PATH" >> ~/.bashrc
source ~/.bashrc
#tensorrt-选择cp37,cp38,cp39对应python版本
pip install TensorRT-8.2.3.0/python/tensorrt-8.2.3.0-cp38-none-linux_x86_64.whl
export TENSORRT_DIR=/usr/local/TensorRT-8.2.3.0
export LD_LIBRARY_PATH=$TENSORRT_DIR/lib:$LD_LIBRARY_PATH
pip install pycuda
此时tensorrt不能导入,cuDNN安装完后可以
添加动态库
sudo gedit /etc/ld.so.conf
/usr/local/TensorRT-8.2.3.0/lib
/usr/local/cuda-11.3/lib64
sudo ldconfig
cuDNN
export CUDNN_DIR=/usr/local/cuda
export LD_LIBRARY_PATH=$CUDNN_DIR/lib64:$LD_LIBRARY_PATH
然后解压,把inculde和lib64里的文件复制到cuda中
sudo cp -r /usr/local/cudnn-11.3-linux-x64-v8.2.1.32/cuda/include/cudnn* /usr/local/cuda/include
sudo cp -r /usr/local/cudnn-11.3-linux-x64-v8.2.1.32/cuda/lib64/libcudnn* /usr/local/cuda/lib64
安转完后,同样可以进入Python环境,然后简单打印下版本号等信息,只要不报错就说明安装成功。
import tensorrt
print(tensorrt.__version__)
assert tensorrt.Builder(tensorrt.Logger())
pip install opencv-contrib-python==4.8.0.74
arm
sudo apt-get install protobuf-compiler libprotoc-dev
export PATH=/usr/local/cuda/bin:${PATH}
export CUDA_PATH=/usr/local/cuda
export cuDNN_PATH=/usr/lib/aarch64-linux-gnu
export CMAKE_ARGS="-DONNX_CUSTOM_PROTOC_EXECUTABLE=/usr/bin/protoc"
mkdir /code
cd /code
git clone --recursive https://github.com/Microsoft/onnxruntime
git submodule update --init --recursive --progress
cd /code/onnxruntime
./build.sh --update --config Release --enable_pybind --build_shared_lib --build --build_wheel \
--use_openmp --use_tensorrt --tensorrt_home /usr/src/tensorrt --cuda_home /usr/local/cuda --cudnn_home /usr/lib/aarch64-linux-gnu
https://onnxruntime.ai/docs/build/eps.html#nvidia-jetson-tx1tx2nanoxavier
1、cd path-to-mmdeploy
mkdir -p build && cd build
cmake .. \
-DMMDEPLOY_BUILD_SDK=ON \
-DMMDEPLOY_BUILD_SDK_PYTHON_API=ON \
-DMMDEPLOY_BUILD_EXAMPLES=ON \
-DMMDEPLOY_TARGET_DEVICES="cuda;cpu" \
-DMMDEPLOY_TARGET_BACKENDS="trt" \
-DMMDEPLOY_CODEBASES=all \
-Dpplcv_DIR=${PPLCV_DIR}/cuda-build/install/lib/cmake/ppl
cmake .. -DCMAKE_CXX_COMPILER=g++-9 -DMMDEPLOY_BUILD_SDK=ON -DMMDEPLOY_BUILD_EXAMPLES=ON -DMMDEPLOY_BUILD_SDK_PYTHON_API=ON -DMMDEPLOY_TARGET_DEVICES="cuda;cpu" -DMMDEPLOY_TARGET_BACKENDS="ort;trt" -Dpplcv_DIR=${PPLCV_DIR}/cuda-build/install/lib/cmake/ppl -DTENSORRT_DIR=${TENSORRT_DIR} -DCUDNN_DIR=${CUDNN_DIR} -DONNXRUNTIME_DIR=${ONNXRUNTIME_DIR} -DMMDEPLOY_CODEBASES=all
2、make -j$(nproc) && make install
3、复制build中lib内所有的文件到mmdeploy/mmdeploy/lib的位置
4、编译成功后,返回上一层
cd ..
apt-get install libjpeg-dev zlib1g-dev
pip install Pillow==10.0.0
pip install -v -e .
所有环境变量如下:
#cuda
export PATH="/usr/local/cuda-11.3/bin:$PATH"
export CUDA_PATH=/usr/local/cuda-11.3
export LD_LIBRARY_PATH="/usr/local/cuda-11.3/lib64:$LD_LIBRARY_PATH"
#cmake
export PATH=/home/sen/motan/cmake-3.18.0-Linux-x86_64/bin:$PATH
#ppl.cv
export PPLCV_DIR=/home/sen/motan/ppl.cv
#tensorrt
export TENSORRT_DIR=/usr/local/TensorRT-8.2.3.0
export LD_LIBRARY_PATH=$TENSORRT_DIR/lib:$LD_LIBRARY_PATH
#CUDNN
export CUDNN_DIR=/usr/local/cuda-11.3
export LD_LIBRARY_PATH=$CUDNN_DIR/lib64:$LD_LIBRARY_PATH
export MMDEPLOY_DIR=/home/sen/motan/mmdeploy
export ONNXRUNTIME_DIR=/home/sen/motan/onnxruntime-linux-x64-1.8.1
export LD_LIBRARY_PATH=$ONNXRUNTIME_DIR/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/sen/motan/mmdeploy/mmdeploy/lib
export LIBRARY_PATH=$LIBRARY_PATH:/home/sen/motan/mmdeploy/mmdeploy/lib
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
使用时改
转engine文件必须用图片代码
1、/home/sen/motan/DCMMDet3D/demo/data/nuscenes/1.json里图片的路径
2、/home/sen/motan/mmdeploy/configs/mmdet3d/monocular-detection/monocular-detection_static.py里json的路径