xmba15 / generic_dbscan

generic DBSCAN on CPU & GPU

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

.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


About

generic DBSCAN on CPU & GPU


Languages

Language:C++ 64.2%Language:Cuda 23.4%Language:CMake 8.0%Language:Dockerfile 2.8%Language:Makefile 1.4%Language:Shell 0.2%