官方文档
官网:https://mmdetection3d.readthedocs.io/zh_CN/latest/1_exist_data_model.html
Train
训练集路径设置
需要指定自己存放数据的目录,以kitti数据集为例,需要修改kitti-3d-3class.py, hv_pointpillars_secfpnn_6x8_160e_kitti-3d-3class.py,两个文件的data_root路径
单GPU训练
python tools/train.py configs/pointpillars/hv_pointpillars_secfpn_6x8_160e_kitti-3d-3class.py
终端输入tensorboard --logdir work_dirs/hv_pointpillars_secfpn_6x8_160e_kitti-3d-3class对训练过程中的loss曲线等进行可视化。
多GPU训练
CUDA_VISIBLE_DEVICES=4,5,6,7 PORT=29501 ./tools/dist_train.sh ${CONFIG_FILE} 4
Test
# 单块显卡测试
默认是第一张卡,如果想指定某张卡通过export CUDA_VISIBLE_DEVICES设定,如指定第八张卡:
export CUDA_VISIBLE_DEVICES=7
python tools/test.py ${CONFIG_FILE} ${CHECKPOINT_FILE} [--out ${RESULT_FILE}] [--eval ${EVAL_METRICS}] [--show] [--show-dir ${SHOW_DIR}]
# CPU:禁用显卡并运行单块 CPU 测试脚本(实验性)
export CUDA_VISIBLE_DEVICES=-1
python tools/test.py ${CONFIG_FILE} ${CHECKPOINT_FILE} [--out ${RESULT_FILE}] [--eval ${EVAL_METRICS}] [--show] [--show-dir ${SHOW_DIR}]
# 多块显卡测试
./tools/dist_test.sh ${CONFIG_FILE} ${CHECKPOINT_FILE} ${GPU_NUM} [--out ${RESULT_FILE}] [--eval ${EVAL_METRICS}]
示例:
保存模型,可视化预测结果,可视化真实标签,计算 mAP
python tools/test.py configs/pointpillars/hv_pointpillars_secfpnn_6x8_160e_kitti-3d-3class.py \
work_dirs/hv_pointpillars_secfpnn_6x8_160e_kitti-3d-3class/latest.pth \
--eval mAP \
--show --show-dir ./data/show_results \
--eval-options 'show=True' 'out_dir=./data/scannet/show_results'