Skip to content

xmba15/generic_dbscan

Repository files navigation

.github/workflows/build.yml

📝 c++ generic DBSCAN


  • c++ generic dbscan library on CPU & GPU. header-only codes for cpu dbscan.
  • cpu dbscan uses kd-tree for radius search.
  • gpu dbscan or G-DBSCAN uses BFS on nodes of point.

🎉 TODO


  • Implement generic kd-tree
  • Implement generic dbscan
  • Create unittest & examples
  • GPU DBSCAN

🎛 Dependencies


  • base dependencies
sudo apt-get install \
    libpcl-dev \

tested with pcl 1.10

  • gpu dbscan

CUDA toolkits (tested on cuda 11)

lower pcl version (that uses older eigen version) might not be compatible with cuda

🔨 How to Build


# build lib
make default -j`nproc`

# build examples

# build only cpu dbscan
make apps -j`nproc`

# build both cpu and gpu dbscan
make gpu_apps -j`nproc`

🏃 How to Run


# after make apps or make gpu_apps

# cpu
./build/examples/test_pointcloud_clustering [path/to/pcl/file] [eps] [min/points]

# gpu

./build/examples/test_pointcloud_clustering_gpu [path/to/pcl/file] [eps] [min/points]

# eps and min points are parameters of dbscan algorithm

# for example
./build/examples/test_pointcloud_clustering ./data/street_no_ground.pcd 0.7 3 1

# or
./build/examples/test_pointcloud_clustering_gpu ./data/street_no_ground.pcd 0.7 3 1

# change final parameters to 0 to disable visualization
  • processing time (average of 10 tests):
# number of points: 11619
# processing time (cpu): 80[ms]
# processing time (gpu): 38[ms]

# difference in speed will get more obvious with point cloud of more points
  • Here is the sample result:

clustered_results

🐳 How to Run with Docker

  • cpu
# build
docker build -f ./dockerfiles/ubuntu2004_gpu.dockerfile -t dbscan .

# run
docker run -it --rm -v `pwd`:/workspace dbscan
# build
docker build -f ./dockerfiles/ubuntu2004_gpu.dockerfile -t dbscan_gpu .

# run
docker run -it --rm --gpus all -v `pwd`:/workspace dbscan_gpu

💎 References