xmba15 / generic_dbscan Goto Github PK
View Code? Open in Web Editor NEWgeneric DBSCAN on CPU & GPU
generic DBSCAN on CPU & GPU
Hi @xmba15 ,
Thanks for this amazing implementation.
I used a Eigen::Vector2d
to perform clustering as follows:
template <typename POINT_CLOUD_TYPE>
double at(const POINT_CLOUD_TYPE &p, const int axis) {
switch (axis) {
case 0: {
return p(0);
break;
}
case 1: {
return p(1);
break;
}
default: {
throw std::runtime_error("axis out of range");
}
}
}
template <typename POINT_CLOUD_TYPE>
double
distance(const POINT_CLOUD_TYPE &p1, const POINT_CLOUD_TYPE &p2,
const std::function<double(const POINT_CLOUD_TYPE &p, const int axis)>
&valueAtFunc = ::at<POINT_CLOUD_TYPE>) {
double result = 0.0;
for (int i = 0; i < 2; ++i) {
result += std::pow(valueAtFunc(p1, i) - valueAtFunc(p2, i), 2);
}
return std::sqrt(result);
}
int main(int argc, char *argv[]) {
const double eps = std::stof(argv[3]);
const int minPoints = std::stoi(argv[4]);
using DBSCAN = clustering::DBSCAN<2, grid_map::Position,
decltype(points_navigable_zone)>;
DBSCAN::Ptr dbscan =
std::make_shared<DBSCAN>(eps, minPoints, ::distance<grid_map::Position>,
::at<grid_map::Position>);
std::vector<std::vector<int>> clusterIndices;
std::cout << "POINTS SIZE" << points_navigable_zone.size() << std::endl;
clusterIndices = dbscan->estimateClusterIndices(points_navigable_zone);
}
Although for just 430 points the time performance is 23 ms using the following parameters:
Can you help me understand why the performance is slow?
Thanks,
Bruno
Thanks for your great work, I have implement this repository on the real program. But I found the speed is not very idea. Is it possible to merge function makeGraphStep1Kernel and makeGraphStep2Kernel, because I found there exists similar calculation in this two functions.
i run this code in my pc,and the result is the gpu process time is 500 ms and cpu 80 ms?
is any wrong i do?
Thanks for your open source, After compiling the source code, I got the folloewing warning. Do you know how to avoid these warning?
:0:16: warning: ISO C++11 requires whitespace after the macro name
:0:19: warning: ISO C++11 requires whitespace after the macro name
:0:23: warning: ISO C++11 requires whitespace after the macro name
:0:16: warning: ISO C++11 requires whitespace after the macro name
:0:19: warning: ISO C++11 requires whitespace after the macro name
:0:23: warning: ISO C++11 requires whitespace after the macro name
warning: ‘void HandleError(cudaError_t, const char*, int)’ defined but not used [-Wunused-function]
static void HandleError(cudaError_t err, const char* file, int line)
^~~~~~~~~~~
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.