yancie-yjr / DBQ-SSD

The official implementation of the paper DBQ-SSD: Dynamic Ball Query for Efficient 3D Object Detection (ICLR 2023)
Apache License 2.0
17 stars 3 forks source link

pointnet2.ball_query_sparse_wrapper(B, N, M, K, radius, nsample, new_xyz, xyz, indices, idx) AttributeError: module 'pcdet.ops.pointnet2.pointnet2_batch.pointnet2_batch_cuda' has no attribute 'ball_query_sparse_wrapper' #5

Closed gc625-kodifly closed 11 months ago

gc625-kodifly commented 11 months ago

Hi,

Thank you for your work, I'm currently trying to migrate your model to the latest openpcdet version. I have currently done the following:

  1. moved all code related to DBQSSD into pcdet, (DBQSSD_backbone, head, etc).
  2. moved all cuda/cpp ops into the respective directories.
  3. Added extra_compile_args:
         extra_compile_args = {
             "cxx": ["-O3"],
             "nvcc": [
                 "-O3",
                 "-DCUDA_HAS_FP16=1",
                 "-D__CUDA_NO_HALF_OPERATORS__",
                 "-D__CUDA_NO_HALF_CONVERSIONS__",
                 "-D__CUDA_NO_HALF2_OPERATORS__",
                 "-lcudnn",
             ]
         }

and make_cuda_ext the sparse operations:

            make_cuda_ext(
                name='pointnet2_batch_cuda',
                module='pcdet.ops.pointnet2.pointnet2_batch',
                sources=[
                    'src/pointnet2_api.cpp',
                    'src/ball_query.cpp',
                    'src/ball_query_gpu.cu',
                    'src/group_points.cpp',
                    'src/group_points_gpu.cu',
                    'src/interpolate.cpp',
                    'src/interpolate_gpu.cu',
                    'src/sampling.cpp',
                    'src/sampling_gpu.cu',
                    'src/ball_query_sparse.cpp',
                    'src/ball_query_sparse_gpu.cu',
                    'src/group_points_sparse.cpp',
                    'src/group_points_sparse_gpu.cu',
                    'src/sparse_indexing.cpp',
                    'src/sparse_indexing_gpu.cu',
                ],
            ),

since THC has been deprecated in newer versions of pytorch, I have commented them out:

#include <torch/serialize/tensor.h>
#include <cuda.h>
#include <cuda_runtime_api.h>
#include <vector>
// #include <THC/THC.h>
#include "group_points_sparse_gpu.h"

// extern THCState *state;
// ...

running python3 setup.py develop also doesn't give any problems, but when I try training, I get the following error:

/home/user/OpenPCDet/pcdet/ops/pointnet2/pointnet2_batch/pointnet2_utils.py", line 329, in forward
    pointnet2.ball_query_sparse_wrapper(B, N, M, K, radius, nsample, new_xyz, xyz, indices, idx)
AttributeError: module 'pcdet.ops.pointnet2.pointnet2_batch.pointnet2_batch_cuda' has no attribute 'ball_query_sparse_wrapper'

Any ideas how I can fix this problem? Thanks

gc625-kodifly commented 11 months ago

nevermind, model is training now, I forgot to add

#include "ball_query_sparse_gpu.h"
#include "group_points_sparse_gpu.h"
#include "sparse_indexing_gpu.h"

and

    m.def("group_points_sparse_wrapper", &group_points_sparse_wrapper_fast, "group_points_sparse_wrapper_fast");
    m.def("group_points_sparse_grad_wrapper", &group_points_sparse_grad_wrapper_fast, "group_points_sparse_grad_wrapper_fast");

    m.def("sparse_indexing_get_wrapper", &sparse_indexing_get_wrapper_fast, "sparse_indexing_get_wrapper_fast");
    m.def("sparse_indexing_put_wrapper", &sparse_indexing_put_wrapper_fast, "sparse_indexing_put_wrapper_fast");
    m.def("sparse_indexing_replace_wrapper", &sparse_indexing_replace_wrapper_fast, "sparse_indexing_replace_wrapper_fast");

in pointnet2_api.cpp