centerpoint环境配置

一、环境配置

ubuntu20.04+python3.7+cuda10.2+pytorch1.10.1+cmake3.22+spconv2.1.21

1、Basic Installation

# basic python libraries
conda create --name centerpoint python=3.7
conda activate centerpoint
#conda命令安装会从pkgs读取之前下载过的包,会更快
conda install pytorch==1.10.1 torchvision==0.11.2 torchaudio==0.10.1 cudatoolkit=10.2
git clone https://github.com/tianweiy/CenterPoint.git
cd CenterPoint
#安装依赖项
pip install -r requirements.txt
# add CenterPoint to PYTHONPATH by adding the following line to ~/.bashrc (change the path accordingly)
export PYTHONPATH="${PYTHONPATH}:PATH_TO_CENTERPOINT"

2、Advanced Installation

nuScenes dev-kit

 pip install nuscenes-devkit==1.0.5

git clone https://github.com/tianweiy/nuscenes-devkit
# add the following line to ~/.bashrc and reactivate bash (remember to change the PATH_TO_NUSCENES_DEVKIT value)
export PYTHONPATH="${PYTHONPATH}:PATH_TO_NUSCENES_DEVKIT/python-sdk"

Cuda Extensions

cuda10.2之前已经安装过,直接在创建的conda环境中添加环境变量即可

# set the cuda path(change the path to your own cuda location) 
export PATH=/usr/local/cuda-10.0/bin:$PATH
export CUDA_PATH=/usr/local/cuda-10.2
export CUDA_HOME=/usr/local/cuda-10.2
export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64:$LD_LIBRARY_PATH

# Rotated NMS 
cd ROOT_DIR/det3d/ops/iou3d_nms
python setup.py build_ext --inplace

# Deformable Convolution (Optional and only works with old torch versions e.g. 1.1)
cd ROOT_DIR/det3d/ops/dcn
python setup.py build_ext --inplace

APEX (Optional)

git clone https://github.com/NVIDIA/apex
cd apex
git checkout 5633f6  # recent commit doesn't build in our system 
pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./

centerpoint环境配置_第1张图片

spconv

sudo apt-get install libboost-all-dev #安装依赖项
git clone https://github.com/traveller59/spconv.git --recursive
cd spconv && git checkout 7342772
python setup.py bdist_wheel
cd ./dist && pip install *

执行到第四行命令时报错,利用cmake编译的时候发现找不到pybind11下的cmakelist.txt编译文件,发现pybind11是另外一个仓库,在clone该项目时没有下载下来,所以单独clone了一下第三方仓库(检查third_party/pybind11包中是否为空,如果是空的,则需要单独下载其中的文件并放入pybind11中)

安装spconv之前安装cmake #pip install cmake

报错如下:

centerpoint环境配置_第2张图片

安装spconv的另一种办法直接pip install spconv

uhznagnauznaGitHub - traveller59/spconv: Spatial Sparse Convolution Librarya

centerpoint环境配置_第3张图片

 centerpoint环境配置_第4张图片

centerpoint环境配置_第5张图片

二、下载数据集

https://www.nuscenes.org/nuscenes#download

# For nuScenes Dataset         
└── NUSCENES_DATASET_ROOT
       ├── samples       <-- key frames
       ├── sweeps        <-- frames without annotation
       ├── maps          <-- unused
       ├── v1.0-mini <-- metadata

下载v1.0-mini数据集即可,trainval数据集过大

进入tools/create_data.py文件修改版本信息为‘v1.0-mini’

centerpoint环境配置_第6张图片

进入centerpoint虚拟环境,在centerpoint路径下执行以下命令,数据生成

# python tools/create_data.py nuscenes_data_prep --root_path=/home/root123/Documents/CenterPoint-master/data/nuScenes --version="v1.0-mini" --nsweeps=10

centerpoint环境配置_第7张图片

centerpoint环境配置_第8张图片

三、配置参数开始训练(如果用pycharm执行,则需要改配置文件中的data路径等)

python ./tools/train.py ./configs/nusc/voxelnet/nusc_centerpoint_voxelnet_0075voxel_dcn.py
# python ./tools/train.py CONFIG_PATH
# CONFIG_PATH:要使用哪个模型

CenterPoint执行手顺_碎碎念。。。的博客-CSDN博客_nsweeps

 bash setup.sh 报错:

centerpoint环境配置_第9张图片

 在文件中查找替换:

centerpoint环境配置_第10张图片

再次执行bash setup.sh 成功如下:

centerpoint环境配置_第11张图片

参考如下博客第5条:

CenterPoint的环境配置error大全【已全部解决】_皮皮鲁与鲁西西�的博客-CSDN博客

你可能感兴趣的:(python,人工智能,深度学习,pytorch)