目录
一、基本配置
- Ubuntu 22.04.2
- CUDA 11.8
二、准备工作
1.生成数据信息(pkl文件)
1.1 KITTI
python -m pcdet.datasets.kitti.kitti_dataset create_kitti_infos tools/cfgs/dataset_configs/kitti_dataset.yaml
1.2 Waymo
后面可能会用,待更新...
2.激活环境
3.进入tools文件夹下
四、训练
单卡(指定显卡号):
CUDA_VISIBLE_DEVICES=2 python train.py --cfg_file ./cfgs/kitti_models/pointpillar.yaml --batch_size 4 --epochs 80
参数:
CUDA_VISIBLE_DEVICES(可选):显卡 号
--cfg_file:模型 配置文件
--batch_size:批处理大小
--epochs:训练周期
多卡:
注:本人 torch版本是2.0.0,下面命令会报错
CUDA_VISIBLE_DEVICES=1,2 python -m torch.distributed.launch --nproc_per_node=2 train.py --cfg_file cfgs/kitti_models/pointpillar.yaml --launcher pytorch
将torch.distributed.launch改为torch.distributed.run即可。
简易版:
CUDA_VISIBLE_DEVICES=1,2 python -m torch.distributed.run --nproc_per_node=2 train.py --cfg_file cfgs/kitti_models/pointpillar.yaml --launcher pytorch
自用版:
一张GPU显卡:
OMP_NUM_THREADS=32 CUDA_VISIBLE_DEVICES=1 python -m torch.distributed.run --nproc_per_node=1 train.py --cfg_file cfgs/kitti_models/pointpillar.yaml --launcher pytorch --batch_size 2 --epochs 80
二张GPU显卡:
OMP_NUM_THREADS=32 CUDA_VISIBLE_DEVICES=1,2 python -m torch.distributed.run --nproc_per_node=2 train.py --cfg_file cfgs/kitti_models/pointpillar.yaml --launcher pytorch --batch_size 2 --epochs 80
三张GPU显卡:
OMP_NUM_THREADS=32 CUDA_VISIBLE_DEVICES=0,1,2 python -m torch.distributed.run --nproc_per_node=3 train.py --cfg_file cfgs/kitti_models/pointpillar.yaml --launcher pytorch --batch_size 2 --epochs 80
需要改的参数:
可选:OMP_NUM_THREADS、CUDA_VISIBLE_DEVICES
修改:--batch_size、--epochs
五、测试
CUDA_VISIBLE_DEVICES=1 python test.py --cfg_file ./cfgs/kitti_models/pointpillar.yaml --batch_size 64 --ckpt ../output/cfgs/kitti_models/pointpillar/default/ckpt/latest_model.pth --eval_all
新参数:
--eval_all
疑惑:
--eval_tag mAP (不太懂)
python test.py --cfg_file ./cfgs/kitti_models/pointpillar.yaml --batch_size 4 --ckpt pointpillar1.pth --eval_tag mAP
六、demo结果可视化
python demo.py --cfg_file cfgs/kitti_models/pointpillar.yaml --ckpt pointpillar.pth --data_path 000099.bin
参数 | 说明 | 文件类型 |
--cfg_file | 跟 模型配置文件 | .yaml |
--data_path | 跟 要可视化的点云数据(测试集) | .bin |
--ckpt | 跟 训练的模型的路径 | .pth |
自用 (使用mayavi库可视化)
python mayavi_demo.py --cfg_file cfgs/kitti_models/pointpillar.yaml --ckpt pointpillar1.pth --data_path 000099.bin
编写了一个 mayavi_demo.py
七、损失函数 可视化
tensorBoard可视化
安装tensorboard
pip install tensorboard
输入
tensorboard --logdir=../output/cfgs/kitti_models/pointpillar/default/tensorboard --bind_all
参数:
--bind_all
打开网址:
http://server_ip:6006
粗略写的,后面完善。