(ML) CenterPoint 環境配置 ubuntu 20.04 + pytorch1.10 + cuda11.3

YEN HUNG CHENG
2 min readMay 7, 2023

--

Photo by Max Böttinger on Unsplash

環境:ubuntu 20.04 + python3.7 + pytorch1.10 + cuda11.3

Github

建立一個新的環境

conda create -n Center python=3.7
conda activate Center
conda install pytorch==1.10.1 torchvision==0.11.2 torchaudio==0.10.1 cudatoolkit=11.3 -c pytorch -c conda-forge

將 CenterPoint 抓下來

git clone https://github.com/tianweiy/CenterPoint.git
cd CenterPoint
#安裝需要套件
pip install -r requirements.txt

將 CenterPoint 加到環境變數中

sudo gedit ~/.bashrc
# CenterPoint
export PYTHONPATH="${PYTHONPATH}:/home/jason/CenterPoint"

nuScenesdev-kit

cd CenterPoint 
git clone https://github.com/tianweiy/nuscenes-devkit

將 nuScenesdev-kit 加到環境變數中

sudo gedit ~/.bashrc
# add the following line to ~/.bashrc and reactivate bash (remember to change the PATH_TO_NUSCENES_DEVKIT value)
export PYTHONPATH="${PYTHONPATH}:/home/jason/CenterPoint/nuscenes-devkit/python-sdk"

Rotated NMS

cd CenterPoint/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 CenterPoint/det3d/ops/dcn
python setup.py build_ext --inplace

APEX (Optional, python>3.6)

cd CenterPoint
git clone https://github.com/NVIDIA/apex
cd apex
git checkout 5633f6
pip install -v --no-cache-dir --global-option="--cpp_ext" ./

spconv

pip install spconv-cu113

下載 v1.0-mini 數據集

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

cd CenterPoint
mkdir data && cd data
# 將 v1.0-mini 放到此處
mv v1.0-mini nuScenes
cd ..

數據生成

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

使用單 GPU 進行 Training

python ./tools/train.py ./configs/nusc/voxelnet/nusc_centerpoint_voxelnet_01voxel.py

⭐️由於沒有安裝 dcn 所以不能選有 dcn 結尾的檔案進行訓練

--

--