CenterPoint执行手顺

环境搭建

Requirements

  • Linux
  • Python 3.6+
  • PyTorch 1.1 or higher
  • CUDA 10.0 or higher
  • CMake 3.13.2 or higher
  • APEX
  • spconv
1、代码下载
git clone git://github.com/tianweiy/CenterPoint.git
cd CenterPoint
pip --default-timeout=100 install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt

# add CenterPoint to PYTHONPATH by adding the following line to ~/.bashrc (change the path accordingly)
export PYTHONPATH="${PYTHONPATH}:PATH_TO_CENTERPOINT"

2、nuScenes dev-kit

git clone git://github.com/tianweiy/nuscenes-devkit

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

3、Cuda Extensions

# set the cuda path(change the path to your own cuda location) 
export PATH=/usr/local/cuda-10.0/bin:$PATH
export CUDA_PATH=/usr/local/cuda-10.0
export CUDA_HOME=/usr/local/cuda-10.0
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64:$LD_LIBRARY_PATH
bash setup.sh 

4、APEX

加速训练

git clone git://github.com/NVIDIA/apex
cd apex
git checkout 5633f6  # recent commit doesn't build in our system 
pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./

5、spconv

sudo apt-get install libboost-all-dev
git clone git://github.com/traveller59/spconv.git --recursive
cd spconv && git checkout 7342772
//往第三方库中拷贝文件夹 D:\workspace\pycharm\3D_object\CenterPoint-master\spconv
python setup.py bdist_wheel
cd ./dist && pip install *

报错如下:

在这里插入图片描述

在CMakeList.txt开头添加
find_package(PythonInterp REQUIRED)

在这里插入图片描述

vim /data/3D_object/CenterPoint/spconv/src/spconv/all.cc
删除git:

CenterPoint执行手顺

1、数据集准备
# For nuScenes Dataset         
└── NUSCENES_DATASET_ROOT
       ├── samples       <-- key frames
       ├── sweeps        <-- frames without annotation
       ├── maps          <-- unused
       ├── v1.0-trainval <-- metadata

创建链接

mkdir data && cd data
ln -s DATA_ROOT 
mv DATA_ROOT nuScenes # rename to nuScenes
2、数据生成
python tools/create_data.py nuscenes_data_prep --root_path="/data/3D_object/CenterPoint-master/data/nuScenes" --version="v1.0-trainval" --nsweeps=10

# root_path:数据集目录
# version:数据集版本

数据生成

# For nuScenes Dataset 
└── CenterPoint
       └── data    
              └── nuScenes 
                     ├── samples       <-- key frames
                     ├── sweeps        <-- frames without annotation
                     ├── maps          <-- unused
                     |── v1.0-trainval <-- metadata and annotations
                     |── infos_train_10sweeps_withvelo_filter_True.pkl <-- train annotations
                     |── infos_val_10sweeps_withvelo_filter_True.pkl <-- val annotations
                     |── dbinfos_train_10sweeps_withvelo.pkl <-- GT database info files
                     |── gt_database_10sweeps_withvelo <-- GT database 
3、模型训练

使用4个GPU分布式训练:

python -m torch.distributed.launch --nproc_per_node=4 ./tools/train.py CONFIG_PATH

python -m torch.distributed.launch --nproc_per_node=3 ./tools/train.py ./configs/nusc/voxelnet/nusc_centerpoint_voxelnet_0075voxel_dcn.py

报错如下:

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Pzn3G0cu-1644993880277)(C:\Users\hp\AppData\Roaming\Typora\typora-user-images\image-20211112195732658.png)]

解决方法:

sudo apt update
sudo apt install libgl1-mesa-glx

单个GPU训练:

python ./tools/train.py ./configs/nusc/voxelnet/nusc_centerpoint_voxelnet_0075voxel_dcn.py
# python ./tools/train.py CONFIG_PATH
# CONFIG_PATH:要使用哪个模型

测试加推理:

python -m torch.distributed.launch --nproc_per_node=3 ./tools/dist_test.py ./configs/nusc/voxelnet/nusc_centerpoint_voxelnet_0075voxel_fix_bn_z.py --work_dir work_dirs/nusc_centerpoint_voxelnet_0075voxel_fix_bn_z --checkpoint work_dirs/nusc_centerpoint_voxelnet_0075voxel_fix_bn_z/latest.pth 
# 使用了三个数据集
total scene num: 850
exist scene num: 255
train scene: 212, val scene: 43
train sample: 8414, val sample: 25735
dataset length:  8414
load 22364 traffic_cone database infos
load 21428 truck database infos
load 99127 car database infos
load 69156 pedestrian database infos
load 3041 ignore database infos
load 3751 construction_vehicle database infos
load 33975 barrier database infos
load 2871 motorcycle database infos
load 3195 bicycle database infos
load 3300 bus database infos
load 5982 trailer database infos
4、模型测试
python tools/demo.py
python tools/demo_nuscenes.py 
# 需要修改config地址和work_dir 确定使用哪个模型
5、追踪代码

nusc_centerpoint_voxelnet_0075voxel_dcn

python tools/nusc_tracking/pub_test.py --work_dir work_dirs/nusc_centerpoint_voxelnet_0075voxel_dcn  --checkpoint work_dirs/nusc_centerpoint_voxelnet_0075voxel_dcn/infos_val_10sweeps_withvelo_filter_True.json

centerpoint_voxel_1440_dcn_flip_testset

python tools/nusc_tracking/pub_test.py --work_dir work_dirs/nusc_centerpoint_voxelnet_dcn_0075voxel_flip_testset  --checkpoint work_dirs/nusc_centerpoint_voxelnet_dcn_0075voxel_flip_testset/infos_test_10sweeps_withvelo_filter_True.json  
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值