Giter VIP home page Giter VIP logo

pointpillars's Introduction

A Simple PointPillars PyTorch Implenmentation for 3D Lidar(KITTI) Detection. [Zhihu]

  • It can be run without installing Spconv, mmdet or mmdet3d.
  • Only one detection network (PointPillars) was implemented in this repo, so the code may be more easy to read.
  • Sincere thanks for the great open-source architectures mmcv, mmdet and mmdet3d, which helps me to learn 3D detetion and implement this repo.

News

  • 2024-04 Exporting PointPillars to ONNX & TensorRT is supported on branch feature/deployment.

mAP on KITTI validation set (Easy, Moderate, Hard)

Repo Metric Overall Pedestrian Cyclist Car
this repo 3D-BBox 73.3259 62.7834 59.6278 51.4642 47.9446 43.8040 81.8677 63.6617 60.9126 86.6456 76.7439 74.1668
mmdet3d v0.18.1 3D-BBox 72.0537, 60.1114, 55.8320 52.0263, 46.4037, 42.4841 78.7231, 59.9526, 57.2489 85.4118, 73.9780, 67.7630
this repo BEV 77.8540 69.8003 66.6699 59.1687 54.3456 50.5023 84.4268 67.1409 63.7409 89.9664 87.9145 85.7664
mmdet3d v0.18.1 BEV 76.6485, 67.7609, 64.5605 59.0778, 53.3638, 48.4230 80.9328, 63.3447, 60.0618 89.9348, 86.5743, 85.1967
this repo 2D-BBox 80.5097 74.6120 71.4758 64.6249 61.4201 57.5965 86.2569 73.0828 70.1726 90.6471 89.3330 86.6583
mmdet3d v0.18.1 2D-BBox 78.4938, 73.4781, 70.3613 62.2413, 58.9157, 55.3660 82.6460, 72.3547, 68.4669 90.5939, 89.1638, 87.2511
this repo AOS 74.9647 68.1712 65.2817 49.3777 46.7284 43.8352 85.0412 69.1024 66.2801 90.4752 88.6828 85.7298
mmdet3d v0.18.1 AOS 72.41, 66.23, 63.55 46.00, 43.22, 40.94 80.85, 67.20, 63.63 90.37, 88.27, 86.07

Detection Visualization

[Compile]

cd ops
python setup.py develop

[Datasets]

  1. Download

    Download point cloud(29GB), images(12 GB), calibration files(16 MB)和labels(5 MB)。Format the datasets as follows:

    kitti
        |- training
            |- calib (#7481 .txt)
            |- image_2 (#7481 .png)
            |- label_2 (#7481 .txt)
            |- velodyne (#7481 .bin)
        |- testing
            |- calib (#7518 .txt)
            |- image_2 (#7518 .png)
            |- velodyne (#7518 .bin)
    
  2. Pre-process KITTI datasets First

    cd PointPillars/
    python pre_process_kitti.py --data_root your_path_to_kitti
    

    Now, we have datasets as follows:

    kitti
        |- training
            |- calib (#7481 .txt)
            |- image_2 (#7481 .png)
            |- label_2 (#7481 .txt)
            |- velodyne (#7481 .bin)
            |- velodyne_reduced (#7481 .bin)
        |- testing
            |- calib (#7518 .txt)
            |- image_2 (#7518 .png)
            |- velodyne (#7518 .bin)
            |- velodyne_reduced (#7518 .bin)
        |- kitti_gt_database (# 19700 .bin)
        |- kitti_infos_train.pkl
        |- kitti_infos_val.pkl
        |- kitti_infos_trainval.pkl
        |- kitti_infos_test.pkl
        |- kitti_dbinfos_train.pkl
    

[Training]

cd PointPillars/
python train.py --data_root your_path_to_kitti

[Evaluation]

cd PointPillars/
python evaluate.py --ckpt pretrained/epoch_160.pth --data_root your_path_to_kitti 

[Test]

cd PointPillars/

# 1. infer and visualize point cloud detection
python test.py --ckpt pretrained/epoch_160.pth --pc_path your_pc_path 

# 2. infer and visualize point cloud detection and gound truth.
python test.py --ckpt pretrained/epoch_160.pth --pc_path your_pc_path --calib_path your_calib_path  --gt_path your_gt_path

# 3. infer and visualize point cloud & image detection
python test.py --ckpt pretrained/epoch_160.pth --pc_path your_pc_path --calib_path your_calib_path --img_path your_img_path


e.g. 
a. [infer on val set 000134]

python test.py --ckpt pretrained/epoch_160.pth --pc_path dataset/demo_data/val/000134.bin

or

python test.py --ckpt pretrained/epoch_160.pth --pc_path dataset/demo_data/val/000134.bin \ 
               --calib_path dataset/demo_data/val/000134.txt --img_path dataset/demo_data/val/000134.png \ 
               --gt_path dataset/demo_data/val/000134_gt.txt

b. [infer on test set 000002]

python test.py --ckpt pretrained/epoch_160.pth --pc_path dataset/demo_data/test/000002.bin

or 

python test.py --ckpt pretrained/epoch_160.pth --pc_path dataset/demo_data/test/000002.bin \ 
               --calib_path dataset/demo_data/test/000002.txt --img_path dataset/demo_data/test/000002.png

Acknowledements

Thanks for the open source code mmcv, mmdet and mmdet3d.

pointpillars's People

Contributors

zhulf0804 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pointpillars's Issues

nvcc fatal : Unsupported gpu architecture 'compute_61'

python setup.py develop running develop running egg_info writing pointpillars.egg-info/PKG-INFO writing dependency_links to pointpillars.egg-info/dependency_links.txt writing top-level names to pointpillars.egg-info/top_level.txt reading manifest file 'pointpillars.egg-info/SOURCES.txt' writing manifest file 'pointpillars.egg-info/SOURCES.txt' running build_ext building 'voxel_op' extension gcc -pthread -B /home/test/anaconda3/envs/pointpillars/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/test/anaconda3/envs/pointpillars/lib/python3.6/site-packages/torch/include -I/home/test/anaconda3/envs/pointpillars/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -I/home/test/anaconda3/envs/pointpillars/lib/python3.6/site-packages/torch/include/TH -I/home/test/anaconda3/envs/pointpillars/lib/python3.6/site-packages/torch/include/THC -I/home/test/anaconda3/envs/pointpillars/include/python3.6m -c voxelization/voxelization.cpp -o build/temp.linux-x86_64-3.6/voxelization/voxelization.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=voxel_op -D_GLIBCXX_USE_CXX11_ABI=1 -std=c++11 cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ gcc -pthread -B /home/test/anaconda3/envs/pointpillars/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/test/anaconda3/envs/pointpillars/lib/python3.6/site-packages/torch/include -I/home/test/anaconda3/envs/pointpillars/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -I/home/test/anaconda3/envs/pointpillars/lib/python3.6/site-packages/torch/include/TH -I/home/test/anaconda3/envs/pointpillars/lib/python3.6/site-packages/torch/include/THC -I/home/test/anaconda3/envs/pointpillars/include/python3.6m -c voxelization/voxelization_cpu.cpp -o build/temp.linux-x86_64-3.6/voxelization/voxelization_cpu.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=voxel_op -D_GLIBCXX_USE_CXX11_ABI=1 -std=c++11 cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ /usr/bin/nvcc -DWITH_CUDA -I/home/test/anaconda3/envs/pointpillars/lib/python3.6/site-packages/torch/include -I/home/test/anaconda3/envs/pointpillars/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -I/home/test/anaconda3/envs/pointpillars/lib/python3.6/site-packages/torch/include/TH -I/home/test/anaconda3/envs/pointpillars/lib/python3.6/site-packages/torch/include/THC -I/home/test/anaconda3/envs/pointpillars/include/python3.6m -c voxelization/voxelization_cuda.cu -o build/temp.linux-x86_64-3.6/voxelization/voxelization_cuda.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options '-fPIC' -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=voxel_op -D_GLIBCXX_USE_CXX11_ABI=1 -gencode=arch=compute_61,code=sm_61 -std=c++11 nvcc fatal : Unsupported gpu architecture 'compute_61' error: command '/usr/bin/nvcc' failed with exit status 1

开启模型训练的时候出现了错误

您好,我在处理预处理的时候并未发现异常,但是在准备训练的时候出现了维度不匹配的问题,不知道是哪里出现问题了,能否帮忙看看呢

PS E:\XSpace\DeepLearning\PointPillars> python train.py --data_root D:\BaiduNetdiskDownload\object
==================== 0 ====================
0%| | 0/619 [00:00<?, ?it/s]>
e:\xspace\deeplearning\pointpillars\model\anchors.py(183)anchor_target()
-> assigned_gt_labels_weights = torch.zeros_like(cur_anchors[:, 0])
(Pdb) pos_flag
tensor([False, False, False, ..., False, False, False], device='cuda:0')
(Pdb) pos_flag.shape
torch.Size([107136])
(Pdb) assigned_gt_inds.shape
torch.Size([107136])
(Pdb) gt_labels
tensor([-1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 1, 1, 1, 1, 1], device='cuda:0',
dtype=torch.int32)
(Pdb) assigned_gt_inds[pos_flag] - 1
tensor([26, 26, 26, 25, 25, 24, 12, 24, 12, 24, 18, 18, 17, 17, 16, 16, 13, 13,
22, 22, 15, 19, 19, 20, 20, 20, 20, 14], device='cuda:0')

Evaluation in KITTI label file format

Hi again,

I was wondering if there is a way how to save results of evaluate.py into a KITTI label format. I have noticed that there is a results/submit/ folder which contains the detections, but the coordinates seem to be different to what KITTI label format expects and there are some low confidence guesses as well.

Thanks for any info on this!

pointpillars execution speed

I was able to confirm the operation very easily compared to the PointPillars head family.
It's great!!
However, when I measured the execution speed, it was about 1.5 fps.
I measured the following with time.time ().
result_filter = model (batched_pts = [pc_torch],
mode ='test') [0]
According to the PointPillars treatise, it runs at 42.4fps in the Pytorch pipeline, except for TensorRT. What should I do to get the same fps?

关于eval结果与mmdet3d官方结果对比问题

作者您这个工程很容易理解也很容易复现,但是我还是有个问题,我看了下最新的pillars的评估结果,发现mmdet3d精度是要略微高一些的,我看了下不同的地方大概在以下几点:
1.学习率设置,官方是0.001,这个工程是0.00025,我相信这是您调试出来的较好的lr。
2.在pillar_encoder里,目前官方代码好像是不再用offset去代替原始绝对坐标了。我不太清楚目前到低使用哪个效果较好。
3.数据增强方面,不管是sample_group还是db_filter您应该是在原始的基础上又进行了调整,不知道我的猜想是否正确。
4.分布式训练所带来的提升,这一点我无法肯定,因为我没有那么多显卡去验证。
最后我再问下,您使用的坐标系最后是激光雷达坐标系吗?

Is reflectivity used in the input?

Hello zhulf0804.

Is the reflectance of the LiDAR point cloud unused in train?
This is because it seemed that the data after the 3 arrays (x, y, z) of points were not handled.
Will the same result be obtained if the point cloud data .bin with the reflectance set to 0 is given during the test?
@voxelization_cuda.cu

hard_voxelize_gpu function
NDim = 3

@voxel_module.py

voxel_num = hard_voxelize(points, voxels, coors,
num_points_per_voxel, voxel_size,
coors_range, max_points, max_voxels, 3,
  deterministic)

evaluate的运行出错

你好,我输入以下代码测试evaluate
python evaluate.py --ckpt pretrained/epoch_160.pth --data_root kittiCut
出现了下列错误

Traceback (most recent call last):
  File "E:\LCH_Content\Code\1Preparations\PointPillars__zhulf0804\evaluate.py", line 386, in <module>
    main(args)
  File "E:\LCH_Content\Code\1Preparations\PointPillars__zhulf0804\evaluate.py", line 280, in main
    val_dataset = Kitti(data_root=args.data_root,
  File "E:\LCH_Content\Code\1Preparations\PointPillars__zhulf0804\dataset\kitti.py", line 50, in __init__
    self.sorted_ids = list(self.data_infos.keys())
AttributeError: 'list' object has no attribute 'keys'

请问是我的输入有问题吗,搜问题得到的解决方案,都不太行

Train.py中的mask存在问题

第170行开始:

pos_idx = (batched_bbox_labels >= 0) & (batched_bbox_labels < args.nclasses)
bbox_pred = bbox_pred[pos_idx]

报错信息:The shape of the mask [320000] at index 0 does not match the shape of the indexed tensor [240000, 7] at index 0

我的变量大小如下 (batch_size=4, nclass=4):

bbox_cls_pred = bbox_cls_pred.permute(0, 2, 3, 1).reshape(-1, args.nclasses)       # [240000, 4] <- [4, 24, 100, 100]
bbox_pred = bbox_pred.permute(0, 2, 3, 1).reshape(-1, 7)                           # [240000, 7] <- [4, 42, 100, 100]
bbox_dir_cls_pred = bbox_dir_cls_pred.permute(0, 2, 3, 1).reshape(-1, 2)           # [240000, 2] <- [4, 12, 100, 100]

batched_bbox_labels = anchor_target_dict['batched_labels'].reshape(-1)             # [320000] <- [4, 80000] 
batched_label_weights = anchor_target_dict['batched_label_weights'].reshape(-1)    # [320000] <- [4, 80000]
batched_bbox_reg = anchor_target_dict['batched_bbox_reg'].reshape(-1, 7)           # [320000, 7] <- [4, 80000, 7]
batched_dir_labels = anchor_target_dict['batched_dir_labels'].reshape(-1)          # [320000] <- [4, 80000] 

mAP calculation

I have a question about mAP which in evaluate.py.

for i in range(0, len(score_thresholds), 4):
print(f"{i}, {precisions[i]}") // add
sums_AP += precisions[i]
mAP = sums_AP / 11 * 100

It seems precisions length is not match 11 sample.
I add the print then confirmed the precisions[i].

==precisions==
0, 1.0
4, 0.875968992248062
8, 0.8194945848375451
12, 0.776255707762557
16, 0.7104851330203443
20, 0.648
24, 0.522273425499232
28, 0.308589195491644
Sometime it takes 8~10samples.

Is the following implementation inconvenient?
for i in range(0, len(score_thresholds)):
print(f"{i}, {precisions[i]}") // add
sums_AP += precisions[i]
mAP = sums_AP / len(precisions) * 100

Evaluation without CUDA

Thank you for your nice implementation.
I tried running evaluation without cuda as the command below:
python evaluate.py --ckpt pretrained/epoch_160.pth --data_root kitti/ --no_cuda

This command ends up with an error in the function nms_gpu():
TypeError: nms_gpu(): incompatible function arguments. The following argument types are supported:
1. (arg0: at::Tensor, arg1: at::Tensor, arg2: float, arg3: int) -> int

Is there a cpu version of nms? Or is there any way can fix this error?
Thanks.

Training with nclasses 1 results in error

Hi, I'm trying to run train.py --nclasses 1, but it results in an IndexError:

Traceback (most recent call last):
  File "train.py", line 217, in <module>
    main(args)
  File "train.py", line 102, in main
    bbox_pred = bbox_pred[pos_idx]
IndexError: The shape of the mask [1928448] at index 0 does not match the shape of the indexed tensor [642816, 7] at index 0

It works fine with the default value of nclasses, but giving 1 gives this error. Can I ask for some help with fixing this please?

RuntimeError: CUDA error: unknown error

I got pytorch with cuda 11.7 on wsl2. When I tried to run trainning on demo kitti data, I got this:
image
I have checked my pytorch setup and run the pytorch tutoral but everything is just OK.
I have no idea of the error above. Any suggestions would be much appreciate.

ModuleNotFoundError: No module named 'ops.voxel_op'

Hello, I have this Error... While Running this code'python pre_process_kitti.py --data_root kitti'

my data path is 'kitti' and the error code is here.

File "C:\Users\sehye\anaconda3\envs\pointpillars\lib\site-packages\cumm\tensorview.py", line 20, in
from cumm.core_cc import tensorview_bind

ModuleNotFoundError: No module named 'ops.voxel_op'

please help me...

ops文件夹无法compile

如题,可能是因为包兼容问题,也可能是因为其他问题,ops里面的ops无法compile。
我尝试寻找了mmdet3d,但是把这部分代码提取出来。
请问楼主,有没有已经编译好ops的项目目录呢?

ModuleNotFoundError: No module named 'ops.voxel_op'

你好,我遇到如下两个问题,这个是什么原因:
1.执行evaluate.py脚本时报错:
PointPillars/ops/voxel_module.py", line 5, in
from .voxel_op import hard_voxelize
ModuleNotFoundError: No module named 'ops.voxel_op'

2.执行python setup.py develop时,卡住不动,不报错也没有任何提示。

Batch size under PillarEncoder

I found the following line sometimes brings me wrong batch size. eg. I have batch size 8, bs = coors_batch[-1, 0] + 1 should give me value 8, but occasionally gives me value 7.

# 6. pillar scatter
batched_canvas = []
bs = coors_batch[-1, 0] + 1
for i in range(bs):

Just wondering is bs short for batch_size? May I replace it with batch_size value?

AttributeError: 'NoneType' object has no attribute 'shape'

Traceback (most recent call last):
File "pre_process_kitti.py", line 163, in
main(args)
File "pre_process_kitti.py", line 140, in main
kitti_train_infos_dict = create_data_info_pkl(data_root, 'train', prefix, db=True)
File "pre_process_kitti.py", line 58, in create_data_info_pkl
image_shape = img.shape[:2]
AttributeError: 'NoneType' object has no attribute 'shape'

Kindly help me in this issue.

Compiler issue

Thanks for the hard work.

But when I run python setup.py develop

I got the following error :

running develop
running egg_info
writing pointpillars.egg-info/PKG-INFO
writing dependency_links to pointpillars.egg-info/dependency_links.txt
writing top-level names to pointpillars.egg-info/top_level.txt
/usr/local/lib/python3.7/dist-packages/torch/utils/cpp_extension.py:411: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
warnings.warn(msg.format('we could not find ninja.'))
reading manifest file 'pointpillars.egg-info/SOURCES.txt'
writing manifest file 'pointpillars.egg-info/SOURCES.txt'
running build_ext
/usr/local/lib/python3.7/dist-packages/torch/utils/cpp_extension.py:813: UserWarning: The detected CUDA version (11.2) has a minor version mismatch with the version that was used to compile PyTorch (11.3). Most likely this shouldn't be a problem.
warnings.warn(CUDA_MISMATCH_WARN.format(cuda_str_version, torch.version.cuda))
building 'voxel_op' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWITH_CUDA -I/usr/local/lib/python3.7/dist-packages/torch/include -I/usr/local/lib/python3.7/dist-packages/torch/include/torch/csrc/api/include -I/usr/local/lib/python3.7/dist-packages/torch/include/TH -I/usr/local/lib/python3.7/dist-packages/torch/include/THC -I/usr/local/cuda/include -I/usr/include/python3.7m -c voxelization/voxelization.cpp -o build/temp.linux-x86_64-3.7/voxelization/voxelization.o -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="_gcc" -DPYBIND11_STDLIB="_libstdcpp" -DPYBIND11_BUILD_ABI="_cxxabi1011" -DTORCH_EXTENSION_NAME=voxel_op -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
x86_64-linux-gnu-gcc: error: voxelization/voxelization.cpp: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

I updated everything and installed packages mentioned on the internet. But it still doesn't work. Do you have any idea ?

ModuleNotFoundError: No module named 'ops.voxel_op'

Hello,

I am having an issue when attempting to pre-process the data where I am getting a module not found error with .voxel_op as seen below, also other modules missing (iou3d, .process, etc) from the lines in the screenshot:

issues

I would like to say since I saw this in another thread as well, my program does compile and I have visual studio installed. However, I don't have an NVIDIA GPU, and don't know if that is an issue (no CUDA runtime). Below is what it looks like when I compile the program:

issues2

360 Degree detection issue

Hi,

First of all, thanks for the work, the program works really well for me.
I am using the pretrained network on my own LiDAR datasets.
I noticed that the point cloud visualization and detection only works for the front half.

I changed the test.py to

def point_range_filter(pts, point_range=[-69.12, -39.68, -3, 69.12, 39.68, 1]):  

and now it visualizes the whole point cloud, but the detection still only applies to the front half.
Can you help with that?

Current progress:
dfdfg

Thanks in advance!

Windows下预处理的时候出现了错误

我是3D目标检测的新手,看了你的博客后感觉受益匪浅,也想实践一下3D目标检测,但是遇到了一些问题。安装环境的时候并未发现任何异常,ops也成功安装了,但是开起预处理程序的时候出现了错误,能帮忙看看吗?非常感谢

PS E:\XSpace\DeepLearning\PointPillars> python pre_process_kitti.py --data_root D:\BaiduNetdiskDownload\object
Processing train data..
0%| | 0/3712 [00:00<?, ?it/s]
Traceback (most recent call last):
File "pre_process_kitti.py", line 159, in
main(args)
File "pre_process_kitti.py", line 137, in main
kitti_train_infos_dict = create_data_info_pkl(data_root, 'train', prefix, db=True)
File "pre_process_kitti.py", line 72, in create_data_info_pkl
image_shape=image_shape)
File "E:\XSpace\DeepLearning\PointPillars\utils\process.py", line 695, in remove_outside_points
indices = points_in_bboxes(points[:, :3], frustum_surfaces) # (N, 1)
TypeError: expected dtype object, got 'numpy.dtype[bool_]'

"IndexError: list index out of range" when executing "python setup.py develop"

Error when running setup.py in the following environment

Conda(pytorch1.8.1,python3.8,cuda11.1)

The error message is as follows
I don't know the cause of the error, please help me.

No CUDA runtime is found, using CUDA_HOME='/apps/cuda/11.3.1'
running develop
running egg_info
writing pointpillars.egg-info/PKG-INFO
writing dependency_links to pointpillars.egg-info/dependency_links.txt
writing top-level names to pointpillars.egg-info/top_level.txt
/home/ace14496ms/pypy38_pp/lib/python3.8/site-packages/torch/utils/cpp_extension.py:411: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
warnings.warn(msg.format('we could not find ninja.'))
reading manifest file 'pointpillars.egg-info/SOURCES.txt'
writing manifest file 'pointpillars.egg-info/SOURCES.txt'
running build_ext
building 'voxel_op' extension
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DWITH_CUDA -I/home/ace14496ms/pypy38_pp/lib/python3.8/site-packages/torch/include -I/home/ace14496ms/pypy38_pp/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/home/ace14496ms/pypy38_pp/lib/python3.8/site-packages/torch/include/TH -I/home/ace14496ms/pypy38_pp/lib/python3.8/site-packages/torch/include/THC -I/apps/cuda/11.3.1/include -I/apps/cudnn/8.4.1/cuda11.3/include -I/home/ace14496ms/pypy38_pp/include -I/apps/centos7/python/3.8.13_gcc11.2.0/include/python3.8 -c voxelization/voxelization.cpp -o build/temp.linux-x86_64-3.8/voxelization/voxelization.o -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="_gcc" -DPYBIND11_STDLIB="_libstdcpp" -DPYBIND11_BUILD_ABI="_cxxabi1011" -DTORCH_EXTENSION_NAME=voxel_op -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DWITH_CUDA -I/home/ace14496ms/pypy38_pp/lib/python3.8/site-packages/torch/include -I/home/ace14496ms/pypy38_pp/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/home/ace14496ms/pypy38_pp/lib/python3.8/site-packages/torch/include/TH -I/home/ace14496ms/pypy38_pp/lib/python3.8/site-packages/torch/include/THC -I/apps/cuda/11.3.1/include -I/apps/cudnn/8.4.1/cuda11.3/include -I/home/ace14496ms/pypy38_pp/include -I/apps/centos7/python/3.8.13_gcc11.2.0/include/python3.8 -c voxelization/voxelization_cpu.cpp -o build/temp.linux-x86_64-3.8/voxelization/voxelization_cpu.o -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="_gcc" -DPYBIND11_STDLIB="_libstdcpp" -DPYBIND11_BUILD_ABI="_cxxabi1011" -DTORCH_EXTENSION_NAME=voxel_op -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
Traceback (most recent call last):
File "setup.py", line 4, in
setup(
File "/home/ace14496ms/pypy38_pp/lib/python3.8/site-packages/setuptools/init.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/apps/centos7/python/3.8.13_gcc11.2.0/lib/python3.8/distutils/core.py", line 148, in setup
dist.run_commands()
File "/apps/centos7/python/3.8.13_gcc11.2.0/lib/python3.8/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/apps/centos7/python/3.8.13_gcc11.2.0/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/ace14496ms/pypy38_pp/lib/python3.8/site-packages/setuptools/command/develop.py", line 34, in run
self.install_for_development()
File "/home/ace14496ms/pypy38_pp/lib/python3.8/site-packages/setuptools/command/develop.py", line 136, in install_for_development
self.run_command('build_ext')
File "/apps/centos7/python/3.8.13_gcc11.2.0/lib/python3.8/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/apps/centos7/python/3.8.13_gcc11.2.0/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/ace14496ms/pypy38_pp/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 79, in run
_build_ext.run(self)
File "/apps/centos7/python/3.8.13_gcc11.2.0/lib/python3.8/distutils/command/build_ext.py", line 340, in run
self.build_extensions()
File "/home/ace14496ms/pypy38_pp/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 765, in build_extensions
build_ext.build_extensions(self)
File "/apps/centos7/python/3.8.13_gcc11.2.0/lib/python3.8/distutils/command/build_ext.py", line 449, in build_extensions
self._build_extensions_serial()
File "/apps/centos7/python/3.8.13_gcc11.2.0/lib/python3.8/distutils/command/build_ext.py", line 474, in _build_extensions_serial
self.build_extension(ext)
File "/home/ace14496ms/pypy38_pp/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 196, in build_extension
_build_ext.build_extension(self, ext)
File "/apps/centos7/python/3.8.13_gcc11.2.0/lib/python3.8/distutils/command/build_ext.py", line 528, in build_extension
objects = self.compiler.compile(sources,
File "/apps/centos7/python/3.8.13_gcc11.2.0/lib/python3.8/distutils/ccompiler.py", line 574, in compile
self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
File "/home/ace14496ms/pypy38_pp/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 513, in unix_wrap_single_compile
cflags = unix_cuda_flags(cflags)
File "/home/ace14496ms/pypy38_pp/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 480, in unix_cuda_flags
cflags + _get_cuda_arch_flags(cflags))
File "/home/ace14496ms/pypy38_pp/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1694, in _get_cuda_arch_flags
arch_list[-1] += '+PTX'
IndexError: list index out of range

TypeError: tuple indices must be integers or slices, not str

Thank you for your remarkable efforts.

I am running the test file for inference, however i am getting typeError as following:
Traceback (most recent call last):
File "/home/azooz/Downloads/PointPillars/test.py", line 138, in
main(args)
File "/home/azooz/Downloads/PointPillars/test.py", line 83, in main
result_filter = keep_bbox_from_lidar_range(result_filter, pcd_limit_range)
File "/home/azooz/Downloads/PointPillars/utils/process.py", line 592, in keep_bbox_from_lidar_range
lidar_bboxes = result['lidar_bboxes']
TypeError: tuple indices must be integers or slices, not str

Thank you in advance.

Potential mistake in anchors2bboxes function

Hi there,

I was looking at the above named function and I realised that the mapping from the delta -> bbox is not the inverse of bbox -> delta from the original point pillars paper (Section 3.2). The function in question is shown below:

def anchors2bboxes(anchors, deltas):
'''
anchors: (M, 7), (x, y, z, w, l, h, theta)
deltas: (M, 7)
return: (M, 7)
'''
da = torch.sqrt(anchors[:, 3] ** 2 + anchors[:, 4] ** 2)
x = deltas[:, 0] * da + anchors[:, 0]
y = deltas[:, 1] * da + anchors[:, 1]
z = deltas[:, 2] * anchors[:, 5] + anchors[:, 2] + anchors[:, 5] / 2
w = anchors[:, 3] * torch.exp(deltas[:, 3])
l = anchors[:, 4] * torch.exp(deltas[:, 4])
h = anchors[:, 5] * torch.exp(deltas[:, 5])
z = z - h / 2
theta = anchors[:, 6] + deltas[:, 6]
bboxes = torch.stack([x, y, z, w, l, h, theta], dim=1)
return bboxes

For example, to recover z should you not simply insert this after h has been defined:
z = deltas[:, 2] * h + anchors[:, 2]?

Also for theta no arcsin is used.

Here the a screenshot of the relevant section in the paper:
image

Is this intentional, and if so, why?

Thank you!

Question about PillarLayer

Hi, I have a question about the PillarLayer module. I was under the impression that the PointPillars algorithm is supposed to first group the input points into pillars, that is a 2D grid. But it looks like the PillarLayer and Voxelization code groups the points into a 3D grid. Could you explain more how this works, or if the voxels are later somewhere converted into pillars?

Thanks in advance!

ModuleNotFoundError: No module named 'ops.voxel_op'

Hi, I tried to run your source code.
But I got an error.
"ModuleNotFoundError: No module named 'ops.voxel_op'"
It seems that it is occurring in the voxel_module.py.
"Import ".voxel_op" could not be resolved"

How can I import ".voxel_op"?
Thank you

Simple Question

Hi, Thank you for your work!

Can you explain in more detail what bbox_dir_cls_pred is among bbox_cls_pred, bbox_pred, and bbox_dir_cls_pred that are the outputs of the Detection Head?

Are there any references?

Thank you.

Eval速度过慢

我使用您的 eval.py 进行模型评估,但是现在运行速度很慢,请问这是正常的吗?或者有什么加速方法么?
我目前观察,主要的时间都开销在 score_threshold 这部分,循环了近两万次:

for score_threshold in tqdm(score_thresholds):
    tp, fn, fp = 0, 0, 0
    aos = 0
    for i, id in enumerate(ids):
        cur_eval_ious = eval_ious[i]
        gt_ignores, det_ignores = total_gt_ignores[i], total_det_ignores[i]
        scores = total_scores[i]
        ................

我目前使用的是自己的数据集,没有使用 KITTI 因此代码上有简单的修改。

Bad inference result on sample after overfitting on same sample

Hi @zhulf0804 ,

I wanted to ensure the model can memorise a single training example. To do this I set the __len__() method in the Dataset to return 1. When training I printed the data_dict to ensure that the same sample was used for each iteration. Since the dataset length was set to 1, each epoch consisted of a single training step.

I visualised the train curves in tensorboard and as expected, all three losses eventually decreased to 0. Then I wanted to visualise the prediction of the model. For this I used the test.py script. However, when running on the same sample from training (000000.bin) the model produces zero predictions.

If I set the score_thr in pointpillar.py to 0, then I get a lot of predictions but they are obviously all very low confidence.

Any idea where I am going wrong?

Compilation without CUDA

Hi!

I was wondering if there is a way to run this code with pytorch without CUDA available. I managed to make this run on a machine with CUDA, but I would like to run on my machine which doesn't have GPU capabilities. While running the python setup.py develop I encountered an error.
OSError: CUDA_HOME environment variable is not set. Please set it to your CUDA install root.
I have noticed the setup.py script has CUDAExtension in it, which I suspect might be a problem.
I am not very familiar with pytorch or CUDA, so any help would be appreciated.

Thanks in advance!

ImportError: DLL load failed while importing voxel_op: The paging file is too small for this operation to complete.

(SimplePointPillar) C:\Users\ianph\SimplePointPillar>python train.py --data_root your_path_to_kitti
==================== 0 ====================
0%| | 0/619 [00:00<?, ?it/s]Traceback (most recent call last):
File "", line 1, in
File "C:\Users\ianph\anaconda3\envs\SimplePointPillar\lib\multiprocessing\spawn.py", line 116, in spawn_main
exitcode = _main(fd, parent_sentinel)
File "C:\Users\ianph\anaconda3\envs\SimplePointPillar\lib\multiprocessing\spawn.py", line 125, in _main
prepare(preparation_data)
File "C:\Users\ianph\anaconda3\envs\SimplePointPillar\lib\multiprocessing\spawn.py", line 236, in prepare
_fixup_main_from_path(data['init_main_from_path'])
File "C:\Users\ianph\anaconda3\envs\SimplePointPillar\lib\multiprocessing\spawn.py", line 287, in _fixup_main_from_path
main_content = runpy.run_path(main_path,
File "C:\Users\ianph\anaconda3\envs\SimplePointPillar\lib\runpy.py", line 265, in run_path
return _run_module_code(code, init_globals, run_name,
File "C:\Users\ianph\anaconda3\envs\SimplePointPillar\lib\runpy.py", line 97, in _run_module_code
run_code(code, mod_globals, init_globals,
File "C:\Users\ianph\anaconda3\envs\SimplePointPillar\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Users\ianph\SimplePointPillar\train.py", line 7, in
from utils import setup_seed
File "C:\Users\ianph\SimplePointPillar\utils_init
.py", line 3, in
from .process import bbox_camera2lidar, bbox3d2bevcorners, box_collision_test,
File "C:\Users\ianph\SimplePointPillar\utils\process.py", line 7, in
from ops.iou3d_module import boxes_overlap_bev, boxes_iou_bev
File "C:\Users\ianph\SimplePointPillar\ops_init
.py", line 1, in
from .voxel_module import Voxelization
File "C:\Users\ianph\SimplePointPillar\ops\voxel_module.py", line 5, in
from .voxel_op import hard_voxelize
ImportError: DLL load failed while importing voxel_op: The paging file is too small for this operation to complete.

能否推理自己的点云图片或者视频

请问,是否能使用rosbag包中保存的bin文件进行推理?如果使用自己的数据集推理,需要将点云数据保持和kitti数据大小一致才能完成推理吗?

关于多类别检测问题

首先,感谢您的开源工作,我想问下,如果我自己的数据集李有好多类比如说(摩托车/三轮摩托车),我训练时是不是只需要修改n_class和anchor就可以了,还说我需要预先手工设定anchor,多类别是增加多个类别head还是说需要额外的anchor

The question about filter_db function.

why use the function (filter_db) to filter the difficulty and min_points ? Does it make bad influence to the performance?

def filter_db(self, db_infos):
    # 1. filter_by_difficulty
    for k, v in db_infos.items():
        db_infos[k] = [item for item in v if item['difficulty'] != -1]

    # 2. filter_by_min_points, dict(Car=5, Pedestrian=10, Cyclist=10)
    filter_thrs = dict(Car=5, Pedestrian=10, Cyclist=10)
    for cat in self.CLASSES:
        filter_thr = filter_thrs[cat]
        db_infos[cat] = [item for item in db_infos[cat] if item['num_points_in_gt'] >= filter_thr]
    
    return db_infos

On Angle Calculation in LOSS

# sin(a - b) = sin(a)*cos(b) - cos(a)*sin(b)
bbox_pred[:, -1] = torch.sin(bbox_pred[:, -1].clone()) * torch.cos(batched_bbox_reg[:, -1].clone())
batched_bbox_reg[:, -1] = torch.cos(bbox_pred[:, -1].clone()) * torch.sin(batched_bbox_reg[:, -1].clone())

When calculating the direction loss between the pred and gt, I found that after calculating sin (a) * cos (b), you assigned the value to bbox_ Pred [:, - 1], but when calculating cos (a) * sin (b), you use bbox_ Pred [:, - 1] again, so your loss calculation becomes sin (a) * cos (b) - cos (sin (a) * cos (b)) sin (b) instead of sin (a) * cos (b) - cos (a) * sin (b). Is there an error here?
@zhulf0804

Compile error on windows

When i tried to run the cmd "python setup.py develop", I got this:

(Alog3D) D:\AlogLab\PointPillars\ops>python setup.py develop
running develop
running egg_info
writing pointpillars.egg-info\PKG-INFO
writing dependency_links to pointpillars.egg-info\dependency_links.txt
writing top-level names to pointpillars.egg-info\top_level.txt
reading manifest file 'pointpillars.egg-info\SOURCES.txt'
writing manifest file 'pointpillars.egg-info\SOURCES.txt'
running build_ext
error: [WinError 2] 系统找不到指定的文件。

(Alog3D) D:\AlogLab\PointPillars\ops>cl
用于 x86 的 Microsoft (R) C/C++ 优化编译器 19.16.27048 版
版权所有(C) Microsoft Corporation。保留所有权利。

用法: cl [ 选项... ] 文件名... [ /link 链接选项... ]

As you see, the cl is avaliable. I got no idea.
Thanks to the implementation but how could I fix this problem?

Evaluation with empty predictions

Hello!

I tried to run the model evaluation script with the pretrained model weights and a custom dataset. When the model doesn't predict anything in a point cloud, it seems that the function do_eval complains. I got the following error:

Traceback (most recent call last):
  File "evaluate.py", line 390, in <module>
    main(args)
  File "evaluate.py", line 374, in main
    do_eval(format_results, val_dataset.data_infos, CLASSES, saved_path)
  File "evaluate.py", line 63, in do_eval
    iou2d_v = iou2d(torch.from_numpy(gt_bboxes2d).cuda(), torch.from_numpy(det_bboxes2d).cuda())
  File "PointPillars/utils/process.py", line 432, in iou2d
    bboxes_x1 = torch.maximum(bboxes1[:, 0][:, None], bboxes2[:, 0][None, :]) # (n, m)
IndexError: too many indices for tensor of dimension 1

The iou2d function doesn't seem to account for empty detections. Do you have any suggestions how to fix this or how it should behave?

Thanks in advance for any help!

python setup.py develop compile error

Hi, Thanks for your great work.
I have problem when compile the "python setup develop" command.
I used Ubuntu 22, GPU 3080Ti, 3090, Conda Env. Do you have exp to handle these GPUs, I heard we need to install torch locally to prevent the error, also Might I ask what is your Ubuntu, GPU, and Env?
Thank you.

Some part of the errors:
" File "/home/abc/anaconda3/envs/PP/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 202, in build_extension
_build_ext.build_extension(self, ext)
File "/home/abc/anaconda3/envs/PP/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py", line 547, in build_extension
objects = self.compiler.compile(
File "/home/abc/anaconda3/envs/PP/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 529, in unix_wrap_ninja_compile
_write_ninja_file_and_compile_objects(
File "/home/abc/anaconda3/envs/PP/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1354, in _write_ninja_file_and_compile_objects
_run_ninja_build(
File "/home/abc/anaconda3/envs/PP/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1683, in _run_ninja_build
raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.