PV-RCNN代码应用——参数修改

PV-RCNN:paper,code
PV-RCNN代码解读——数据处理

1. 修改kitti_dataset.yaml

打开tools/cfgs/dataset_configs/kitti_dataset.yaml
可能需要更改的内容有

# 第3行,点云范围,根据实际自己的点云范围调整
POINT_CLOUD_RANGE: [0, -40, -3, 70.4, 40, 1] 
# 顺序为[x_min, y_min, z_min, x_max, y_max, z_max]

# 第65-72行,体素参数,根据点云的稠密程度调整
VOXEL_SIZE: [0.05, 0.05, 0.1] #体素大小
MAX_POINTS_PER_VOXEL: 5 #每个体素的最高点数
      MAX_NUMBER_OF_VOXELS: {
      #体素数量上限
        'train': 16000,
        'test': 40000
      }

这里是我写的统计点云数据范围代码

2. 更改点云数据velodyne

我的点云数据文件名叫pseudo-lidar_velodyne

 1. 将自己的pseudo-lidar_velodyne文件放入data/kitti/training
 2. 进入pcdet/datasets/kitti/kitti_object_eval_python/kitti_common.py
 3. 将第47行代码中的'velodyne'改为'pseudo-lidar_velodyne'

3. 训练

PV-RCNN代码应用于我们自己的点云数据,进入tools
官方给出的训练代码为

python train.py --cfg_file ${
     CONFIG_FILE}

我这里使用的参数batch_sizeworkers是2,epochs是10,储存路径命名为'mydata_1'

python train.py --cfg_file cfgs/kitti_models/pv_rcnn.yaml --batch_size 2 --workers 2 --epochs 10 --extra_tag 'mydata_1'

3. 测试

进入tools,官方给出的训练代码为

python test.py --cfg_file ${
     CONFIG_FILE} --batch_size ${
     BATCH_SIZE} --ckpt ${
     CKPT}

训练的结果储存在output/kitti_models/pv_rcnn/default/ckpt
我使用的文件是checkpoint_epoch_10.pthbatch_size是2
extra_tag表示储存路径的一个文件夹名,最好和训练的参数保持一致

python test.py --cfg_file cfgs/kitti_models/pv_rcnn.yaml --batch_size 2 --ckpt ../output/kitti_models/pv_rcnn/mydata_1/ckpt/checkpoint_epoch_10.pth --extra_tag 'mydata_1'

4. 可视化

进入tools,官方给出的可视化代码为

python demo.py --cfg_file cfgs/kitti_models/pv_rcnn.yaml \
    --ckpt pv_rcnn_8369.pth \
    --data_path ${
     POINT_CLOUD_DATA}
    # The original KITTI .bin data within data/kitti, like data/kitti/training/velodyne/000008.bin

Kitti的数据看一下效果

python demo.py --cfg_file cfgs/kitti_models/pv_rcnn.yaml --ckpt ../output/kitti_models/pv_rcnn/kitti_1/ckpt/checkpoint_epoch_10.pth --data_path ../data/kitti/training/velodyne/000000.bin

改成自己的训练结果和点云数据
这里get_velodyne_path()中的点云名字使用的是pseudo-lidar_velodyne

python demo.py --cfg_file cfgs/kitti_models/pv_rcnn.yaml --ckpt ../output/kitti_models/pv_rcnn/mydata_1/ckpt/checkpoint_epoch_10.pth --data_path ../data/kitti/training/pseudo-lidar_velodyne/000000.bin

5. 可能遇到的错误

以下错误表示没有检测到目标

ValueError: zero-size array to reduction operation minimum which has no identity

你可能感兴趣的:(PV-RCNN,python,机器学习,大数据,人工智能)