# 3D vehicle detection
### 基于注意力机制的3D点云车辆检测算法研究
### 算法模型图-注意力模型
![图0](results/result0.png)
### 算法模型图-感兴趣区域聚合模型
![图0](results/result-1.png)
感兴趣区域特征聚合模块核心代码
```python
class SimpleVoxel(nn.Module):
def __init__(self,
num_input_features=4,
use_norm=True,
num_filters=[32, 128],
with_distance=False,
name='VoxelFeatureExtractor'):
super(SimpleVoxel, self).__init__()
self.name = name
self.num_input_features = num_input_features
# features 是 N*K*3 的张量,跟 pointnet++ 的 sample 和 group 很像
# 它在 KITTILiDAR 类中就已经做过了处理
# num_voxels 是 N*1 的张量
def forward(self, features, num_voxels):
#return features
# features: [concated_num_points, num_voxel_size, 3(4)]
# num_voxels: [concated_num_points]
# points_mean 是 K 个近邻点的中心点位置,oncat
# points_mean
# 保存在 coordinate 变量中
points_mean = features[:, :, :self.num_input_features].sum(
dim=1, keepdim=False) / num_voxels.type_as(features).view(-1, 1)
return points_mean.contiguous()
# SimpleVoxel输出一个 N ∗ K ∗ 4 体素化点云, 4 代表点云xyz值和雷达强度项。
```
## 实验代码环境配置
### Environment
```python
Ubuntu 16.04
Python 3.7
pytorch 1.4.0
torchvision 0.5.0
CUDA 10.0
```
### Dependencies
```python
python3.5+
opencv
shapely
mayavi
spconv (v1.0)
```
### 实际安装命令
1.基础安装
```python
pip install opencv-python
pip install shapely
pip install mayavi
pip install scikit-image
pip install numba
pip install matplotlib
pip install Cython
pip install terminaltables
pip install tqdm
pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
pip install pybind11
```
2.spconv安装
spconv 安装过程涉及cmake安装
```python
sudo apt-get install libboost-all-dev
git clone https://github.com/traveller59/spconv.git --recursive
cd spconv && git checkout 7342772
python setup.py bdist_wheel
cd ./dist && pip install *
```
### Installation
1.mmdet/ops中,编译 C++/CUDA模块
```python
cd mmdet/ops/points_op
python setup.py build_ext --inplace
cd mmdet/ops/iou3d
python setup.py build_ext --inplace
cd mmdet/ops/pointnet2
python setup.py build_ext --inplace
```
2.~/.bashrc中,加环境变量
```python
export NUMBAPRO_CUDA_DRIVER=/usr/lib/x86_64-linux-gnu/libcuda.so
export NUMBAPRO_NVVM=/usr/local/cuda/nvvm/lib64/libnvvm.so
export NUMBAPRO_LIBDEVICE=/usr/local/cuda/nvvm/libdevice
export LD_LIBRARY_PATH=/home/ch511/anaconda3/envs/sassd/lib/python3.7/site-packages/spconv;
```
3.安装mmcv
```python
pip install pytest-runner -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install mmcv -i https://pypi.tuna.tsinghua.edu.cn/simple
```
4.安装mmdet
即将本地项目中的mmdet加入site-package中,使得项目可以直接调用。源码中没有setup.py,可以用使用mmdetection的setup.py(将requirement相关注释掉)。
```python
python setup.py develop
```
## Data Preparation
1.下载数据集
[KITTI数据集官网](http://www.cvlibs.net/datasets/kitti/eval_object.php?obj_benchmark=3d)下载如下数据:
- Velodyne point clouds (29 GB): input data to VoxelNet
- Training labels of object data set (5 MB): input label to VoxelNet
- Camera calibration matrices of object data set (16 MB): for visualization of predictions
- Left color images of object data set (12 GB): for visualization of predictions
2.整理KITTI数据集目录
注意需要创建空的velodyne_reduced文件夹,用来放置后续筛选得到的视锥体内的点云数据。
```python
└── KITTI
├── training <-- training data
| ├── image_2
| ├── label_2
| ├── calib
| ├── velodyne
| └── velodyne_reduced # empty folder
└── testing <--- testing data
| ├── image_2
| ├── calib
| ├── velodyne
| └── velodyne_reduced # empty folder
```
3.下载ImageSets
下载地址:https://xiaozhichen.github.io/files/mv3d/imagesets.tar.gz
放置位置:放在KITTI目录下
4.生成数据集
```python
python tools/create_data.py
```
## Train & Eval
Train Model with single GPU
```python
python ./tools/train.py ./configs/car_cfg.py
```
Eval Model with single GPU
```python
python ./tools/test.py ./configs/car_cfg.py ./work_dir/checkpoint_epoch_90.pth
```
## 评估结果
### KITTI离线测试集训练90Epoch的结果展示
![图1](results/result1.png)
![图2](results/result2.png)
![图3](results/result3.png)
没有合适的资源?快使用搜索试试~ 我知道了~
基于注意力机制的三维点云车辆目标检测算法研究
共350个文件
pyc:174个
py:114个
so:12个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 73 浏览量
2024-04-29
09:50:36
上传
评论
收藏 51.59MB ZIP 举报
温馨提示
环境: Ubuntu 16.04 Python 3.7 pytorch 1.4.0 torchvision 0.5.0 CUDA 10.0 依赖: python3.5+ opencv shapely mayavi spconv (v1.0) 1.基础安装 pip install opencv-python pip install shapely pip install mayavi pip install scikit-image pip install numba pip install matplotlib pip install Cython pip install terminaltables pip install tqdm
资源推荐
资源详情
资源评论
收起资源包目录
基于注意力机制的三维点云车辆目标检测算法研究 (350个子文件)
points_op.cpp 7KB
iou3d.cpp 6KB
iou3d.cpp 6KB
interpolate.cpp 2KB
interpolate.cpp 2KB
pointnet2_api.cpp 450B
pointnet2_api.cpp 450B
iou3d_kernel.cu 14KB
iou3d_kernel.cu 14KB
interpolate_gpu.cu 5KB
interpolate_gpu.cu 5KB
.DS_Store 8KB
.DS_Store 6KB
.DS_Store 6KB
interpolate_gpu.h 1KB
interpolate_gpu.h 1KB
cuda_utils.h 353B
cuda_utils.h 353B
hqdefault.jpg 15KB
README.md 5KB
not-zip-safe 1B
points_op.o 10.7MB
points_op.o 9.59MB
iou3d.o 9.57MB
iou3d.o 9.06MB
pointnet2_api.o 8.84MB
pointnet2_api.o 8.19MB
interpolate.o 2.47MB
interpolate.o 1.97MB
iou3d_kernel.o 223KB
iou3d_kernel.o 156KB
interpolate_gpu.o 26KB
interpolate_gpu.o 23KB
PKG-INFO 8KB
kitti_infos_trainval.pkl 24.41MB
kitti_dbinfos_train.pkl 13.65MB
kitti_infos_val.pkl 12.41MB
kitti_infos_train.pkl 12.01MB
kitti_infos_test.pkl 10.47MB
result1.png 424KB
model.png 386KB
result0.png 95KB
result-1.png 90KB
result3.png 88KB
result2.png 58KB
kitti_eval.py 36KB
geometry.py 29KB
ssd_rotate_head.py 26KB
kitti_common.py 26KB
rotate_nms_gpu.py 24KB
kitti.py 21KB
kitti_utils.py 20KB
mean_ap.py 15KB
cmn.py 15KB
kitti_object.py 14KB
create_data.py 14KB
point_augmentor.py 13KB
eval_hooks.py 12KB
target_ops.py 12KB
retina_head.py 11KB
fastai_optim.py 10KB
custom.py 10KB
sampling.py 10KB
resnet.py 10KB
transforms.py 9KB
rpn_head.py 9KB
single_stage.py 9KB
points_ops.py 8KB
utils.py 8KB
convfc_bbox_head.py 8KB
points_ops.py 7KB
box_coders.py 7KB
car_cfg.py 7KB
bbox_head.py 7KB
test.py 6KB
__init__.py 6KB
anchor3d_generator.py 6KB
multi_cfg.py 6KB
assignment.py 6KB
test.py 6KB
pillar.py 6KB
test_mixins.py 6KB
iou3d_utils.py 6KB
iou3d_utils.py 6KB
fcn_mask_head.py 6KB
recall.py 6KB
setup.py 6KB
rpn.py 5KB
class_names.py 5KB
vxnet.py 5KB
train.py 5KB
region_similarity.py 5KB
coco_utils.py 5KB
fpn.py 5KB
sampler.py 5KB
losses.py 5KB
anchor_target.py 5KB
learning_schedules_fastai.py 4KB
idea.py 4KB
coco.py 4KB
共 350 条
- 1
- 2
- 3
- 4
资源评论
MarcoPage
- 粉丝: 2957
- 资源: 3005
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功