1、安装
conda create --name polarstream python=3.7
source activate polarstream
以下操作均在虚拟环境中进行
pip install torch-1.8.1+cu111-cp37-cp37m-linux_x86_64.whl
pip install torchvision==0.9.1
git clone https://github.com/qchenclaire/polarstream
cd polarstream
pip install -r requirements.txt
requirements.txt的内容如下:
numba
xlwt
fire
protobuf
opencv-python
opencv-contrib-python
pybind11 easydict
open3d-python
terminaltables
pytest-runner
addict
pycocotools
imagecorruptions
objgraph
cachetools
descartes
jupyter
matplotlib
motmetrics==1.1.3
numpy
pandas==0.24
Pillow==7.1.0
pyquaternion==0.9.5
scikit-learn
Shapely
tqdm
pyyaml
requests
detectron2 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cu111/torch1.8/index.html
/home/user/tools/torch_cluster-1.5.9-cp37-cp37m-linux_x86_64.whl
/home/user/tools/torch_scatter-2.0.6-cp37-cp37m-linux_x86_64.whl
/home/user/tools/torch_sparse-0.6.10-cp37-cp37m-linux_x86_64.whl
/home/user/tools/torch_spline_conv-1.2.1-cp37-cp37m-linux_x86_64.whl
torchgeometry
export PYTHONPATH="${PYTHONPATH}:/home/user/catkin_ws/polarstream"
git clone https://github.com/tianweiy/nuscenes-devkit
#添加到python搜索路经
export PYTHONPATH="${PYTHONPATH}:/home/user/catkin_ws/nuscenes-devkit/python-sdk"
bash setup.sh
- 安装APEX
Note: apex build is also gpu-specific.
git clone https://github.com/NVIDIA/apex
cd apex
pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./
pip install spconv-cu114
2、基于nuScenes数据集训练
2.1 数据准备
- 数据组织
基于关键帧训练,数据集按以下结构组织,其中maps未使用,sweeps可以为空.
- 创建数据
将/home/user/catkin_ws/polarstream/det3d/datasets/nuscenes/nusc_common.py中399行的print(cnt / (nsweeps - 1))注释
将/home/mdj/catkin_ws/polarstream/tools/generate_instance_ids.py中62行改为info_path = ‘/home/user/data/nuSenses/v1.0-trainval01_blobs/infos_val_01sweeps_withvelo_filter_True.pkl’
执行以下两条命令:
python tools/create_data.py nuscenes_data_prep --root_path=/home/user/data/nuSenses/v1.0-trainval01_blobs --version="v1.0-trainval" --nsweeps=1
生成文件infos_train_01sweeps_withvelo_filter_True.pkl与infos_val_01sweeps_withvelo_filter_True.pkl
python tools/generate_instance_ids.py
生成instance_all
2.2 单GPU训练
将/home/user/catkin_ws/polarstream/configs/nusc/pp/polarstream_det_n_seg_1_sector.py中第5行设为nsweeps = 1,第120行设为data_root = “/home/user/data/nuSenses/v1.0-trainval01_blobs”
执行
python tools/train.py /home/user/catkin_ws/polarstream/configs/nusc/pp/polarstream_det_n_seg_1_sector.py --work_dir /home/user/catkin_ws/polarstream
开始训练
如图所示为训练过程