原作者地址:https://github.com/tianweiy/CenterPoint
配置过程主要参考CenterPoint/docs/INSTALL.md
在conda中配置虚拟环境
# basic python libraries
conda create --name centerpoint python=3.6
conda activate centerpoint
conda install pytorch==1.1.0 torchvision==0.3.0 cudatoolkit=10.0 -c pytorch
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"
nuScenes dev-kit
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(更新到自己的版本比如11.3)
# set the cuda path(change the path to your own cuda location)
export PATH=/usr/local/cuda-11.3/bin:$PATH
export CUDA_PATH=/usr/local/cuda-11.3
export CUDA_HOME=/usr/local/cuda-11.3
export LD_LIBRARY_PATH=/usr/local/cuda-11.3/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
或者执行 根目录下bash setup.sh
APEX (Optional)
git clone https://github.com/NVIDIA/apex
cd apex
git checkout 5633f6 # recent commit doesn't build in our system
#有错误可去掉--global-option="--cuda_ext"
pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./
spconv(建议checkout v1.2.1)
sudo apt-get install libboost-all-dev
git clone https://github.com/traveller59/spconv.git --recursive
cd spconv && git checkout 7342772
#如果出现nvcc fatal : Unsupported gpu architecture 'compute_86'错误
export TORCH_CUDA_ARCH_LIST="8.0"
cd third_party
git clone https://github.com/pybind/pybind11.git
cd pybind11
git checkout 085a29436a8c472caaaf7157aa644b571079bcaa
#docker
cd ../..
python setup.py bdist_wheel
#dist下可能多个版本 与python3.7对应
cd ./dist && pip install *
#Successfully installed spconv-1.0
其他问题:可参考:CenterPoint的环境配置error大全【已全部解决】_皮皮鲁与鲁西西�的博客-CSDN博客_spconv.spconv_utils
- 比如编译时出现cannot import name ‘SparseConv3d’ from ‘spconv’
解决方案:spconv的third_part里手动git clone pybind11并chekck
out到某个版本【版本号:085a29436a8c472caaaf7157aa644b571079bcaa】,然后再重新编译spconv即可。
- Det3D应该不用单独安装