安装iou-ssd对应的python环境

安装iou-ssd对应的python环境

安装python环境管理器virtualenv,(anaconda和ros有些冲突,因此不用anaconda)
sudo apt-get install virtualenv
创建一个环境名为ioussd的python环境
virtualenv -p /usr/bin/python3.6 ioussd
激活环境
source ioussd/bin/activate
激活后安装python的各种包

换pip源为阿里源(清华源似乎有点儿问题)

方法链接

在此之前请确认安装了显卡驱动,cuda,和cudnn

安装教程
``

Dependencies(20系列显卡)

  • python3.5+
  • cuda (version 10.2)
  • torch (tested on 1.4.0)
  • torchvision(tested on 0.5.0)
  • opencv
  • shapely
  • mayavi
  • spconv (v1.2)

Dependencies(30系列显卡)

  • python3.6
  • cuda (version 11.2)
  • torch (tested on 1.7.1)
  • torchvision(tested on 0.8.2)
  • opencv
  • shapely
  • mayavi
  • spconv (v1.0)

(1)安装torch(20系列显卡)

source ioussd/bin/activate
pip install torch==1.4.0 torchvision==0.5.0

若是30系列显卡则使用如下命令安装pytorch

30系列显卡

pip install torch==1.7.1+cu110 torchvision==0.8.2+cu110 torchaudio==0.7.2 -f https://download.pytorch.org/whl/torch_stable.html

(2)安装cmake

download the cmake from offical website the version of cmake should >=3.14

若版本不对先卸载cmake(卸载cmake可能会导致ros也被卸载,没关系,重装一下就ok,或者先改cmake再安装ros

sudo apt-get remove --purge cmake

到官网下载二进制版本的cmake不需要编译安装,更快一些

下载好后复制到一个特定位置,例如/usr/local/cmake/

sudo cp -r  ~/liang/cmake-3.14.0-Linux-x86_64  /usr/local/cmake/

add a envirment path in bashrc:

sudo gedit ~/.bashrc

export PATH=/usr/local/cmake/cmake-3.14.0-Linux-x86_64/bin:$PATH

验证cmake
cmake --version
输出版本若是3.14.0即可

(3)安装稀疏卷积spconv

git clone https://github.com/traveller59/spconv.git --recursive

安装c++库boost

sudo apt-get install libboost-all-dev
然后安装spconv

source ioussd/bin/activate
cd spconv
python setup.py bdist_wheel
cd dist
pip install spconv-1.2-cp36-cp36m-linux_x86_64.whl
安装spconv出现错误:nvcc fatal : Unsupported gpu architecture ‘compute_86‘时

主要原因应该是硬件能够支持的算力比较高,能达到8.6,但是cuda11.0支持不了这么高的算力,通过下述脚本,设置环境变量,降低算力要求,即可:
export TORCH_CUDA_ARCH_LIST="7.5"

(4)安装python的各种依赖库

source ioussd/bin/activate
pip install easydict tensorboardX   scikit-image numpy numba pyyaml tqdm opencv-python

(5)安装各种special 库(cu 和cpp文件)

source ioussd/bin/activate
cd  for_ubuntu502/PVRCNN-V1.1/
cd pvdet/dataset/roiaware_pool3d/
python setup.py install
cd pvdet/ops/iou3d_nms/
python setup.py install

安装这些库(roiaware_pool3d,iou3d_nms,pointnet2)报错参考“AT_CHECK“
解决链接
安装pointnet2报错“THCState_getCurrentStream"
解决链接

(6)install pointnet2

cd pvdet/model/pointnet2/pointnet2_stack
 python set_up.py install

(7)install fps_with_features_cuda

cd  new_train/ops/fps_wit_forgound_point/
python setup.py install

(8)安装点云可视化库

source ioussd/bin/activate
pip install mayavi
pip install pyqt5
sudo apt-get install libxcb-xinerama0

准备数据

(1)下载KITTI数据集

  1. Download the 3D KITTI detection dataset from here. Data to download include:

    • Velodyne point clouds (29 GB): input data to VoxelNet
    • Training labels of object data set (5 MB): input label to VoxelNet
    • Camera calibration matrices of object data set (16 MB): for visualization of predictions
    • Left color images of object data set (12 GB): for visualization of predictions
  2. Create cropped point cloud and sample pool for data augmentation, please refer to SECOND.

$ python new_train/tools/create_data_info.py
  1. Split the training set into training and validation set according to the protocol here.
└── DATA_DIR
       ├── training   <-- training data
       |   ├── image_2
       |   ├── label_2
       |   ├── velodyne
       |   └── velodyne_reduced
       └── testing  <--- testing data
       |   ├── image_2
       |   ├── label_2
       |   ├── velodyne
       |   └── velodyne_reduced

可以软链接KITTI数据集,从而不用进行数据拷贝

xavier部署

方法链接

你可能感兴趣的:(激光点云目标检测,自动驾驶,python)