1安装conda(miniforge)

NVIDIA Jetson Xavier的aarch64架构无法使用anaconda,可以使用miniforge替代.

下载:
miniforge的github地址
miniforge的.sh release下载地址

安装:

sh Miniforge-pypy3-4.8.3-4-Linux-aarch64.sh

使用基本同conda

conda activate XXX
conda deactivate
conda create -n open-mmlab python=3.6
conda remove -n open-mmlab --all
conda install 
conda uninstall 

2安装pytorch

1、创建环境

conda create -n open-mmlab python=3.6 -y
conda activate open-mmlab

2、下载安装
需要到Nvidia PyTorch for Jetson下载对应版本的pytorch和torchvision,此网站有详细安装说明,照着做即可:

  • 下载对应的版本(pytorch和CUDA对应关系)为使用mmdetection,我安装的版本为pytorch1.3.0+torchvision0.4.2(系统环境: jetpack4.2.3+L4T32.2.1+cuda10.0+cudnn7.3)
sudo apt-get install python3-pip libopenblas-base libopenmpi-dev 
pip3 install Cython
pip3 install numpy torch-1.8.0-cp36-cp36m-linux_aarch64.whl
  • 安装成功pytorch之后(先别安torchvision),检查下是否安装成功:
python3
>>>import torch

如果报错:Illegal instruction(core dumped)
可以在每次运行Python指令前运行:export OPENBLAS_CORETYPE=ARMV8
也可以将export OPENBLAS_CORETYPE=ARMV8加入到“~/.bashrc”中

  • 安装torchvision
    (where 0.X.0 is the torchvision version,在网站上可以看到)
sudo apt-get install libjpeg-dev zlib1g-dev libpython3-dev libavcodec-dev libavformat-dev libswscale-dev
git clone --branch v0.X.0 https://github.com/pytorch/vision torchvision   
cd torchvision
export BUILD_VERSION=0.X.0  
python3 setup.py install --user
cd ../  
pip install 'pillow<7' # always needed for Python 2.7, not needed torchvision v0.5.0+ with Python 3.6

3安装mmdetection

以下均参考github
1、Install MMCV

pip install mmcv-full==1.2.4 -f https://download.openmmlab.com/mmcv/dist/cu100/torch1.3.0/index.html

2、Install MMDetection.

pip install git+https://github.com/open-mmlab/mmdetection.git

3、Install MMDetection3D

git clone https://github.com/open-mmlab/mmdetection3d.git
cd mmdetection3d
pip install -v -e .

可能错误

Building wheel for llvmlite (setup.py) ... error
RuntimeError: llvm-config failed executing, please point LLVM_CONFIG to the path for llvm-config

原因:没有安装LLVM

conda install llvm

依旧有错误

Be sure to set LLVM_CONFIG to the right executable path.

原因并没有找到LLVM路径,手动指定路径=/usr/lib/llvm-8/bin/llvm-config(每个人可能个不一样)

LLVM_CONFIG=/usr/lib/llvm-8/bin/llvm-config pip install -v -e .

4、运行

python demo/pcd_demo.py demo/kitti_000008.bin configs/second/hv_second_secfpn_6x8_80e_kitti-3d-car.py checkpoints/second.pth
python demo/pcd_demo.py demo/sunrgbd_000017.bin configs/votenet/votenet_8x8_scannet-3d-18class.py checkpoints/votenet.pth
python demo/pcd_demo.py demo/sunrgbd_000017.bin configs/h3dnet/h3dnet_3x8_scannet-3d-18class.py checkpoints/h3dnet.pth

votenet等许多模型会报错:The model and loaded state dict do not match exactly
但官方只有votenet的解决方式:转换下模型再用

python ./tools/model_converters/convert_votenet_checkpoints.py checkpoints/votenet.pth --out=checkpoints/vot.pth

报错…
1、

libgeos_c.so: cannot open shared object file: No such file or directory

解决:

conda install geos

2、

libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /home/xavier/miniforge3/envs/open-mmlab/lib/./libgeos-3.9.1.so)

解决:

cd ~/miniforge3/envs/open-mmlab/lib
sudo cp libstdc++.so.6.0.28 /usr/lib/aarch64-linux-gnu
cd /usr/lib/aarch64-linux-gnu
sudo rm -f libstdc++.so.6
ln -s libstdc++.so.6.0.28 libstdc++.so.6

3、

 module 'pycocotools' has no attribute '__version__'

解决:

pip list | grep pycocotools
pip uninstall pycocotools
pip uninstall mmpycocotools
pip install mmpycocotools

4、

libgomp-d22c30c5.so.1.0.0: cannot allocate memory in static TLS block

解决:bashrc添加:

export LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libgomp.so.1

4安装Open3D

安装完成以上就可以运行mmdetection了,但是没有可视化,需要安装open3D,然而arrch64没有open3D,源码编译安装又是一堆坑…

Logo

更多推荐