Comments (5)
Since you mention you are using the flann_set_distance_type() function, I assume you are using the C bindings, is this correct? What version of FLANN are you using (1.7.1, trunk)? Can you include a small code snippet of your code?
from flann.
Thanks for your response Marius.
Yes, i use the C bindings with FLANN 1.7.1.
Here is a snippet of my code :
//
FLANNParameters flann_params;
flann_params.checks = FLANN_CHECKS_UNLIMITED;
flann_params.eps = 0.0;
flann_params.trees = 1;
flann_params.algorithm = FLANN_INDEX_KDTREE;
flann_set_distance_type( FLANN_DIST_CHI_SQUARE, 0);
flann_index_t index_ptr;
flann_find_nearest_neighbors_index( index_ptr, testset, tcount, result, dists, nn, flann_params);
//
I'm looking for the nn exact nearest neighbors.
apparently the distance calculus is doing with the euclidian distance, not with the chi square distance.
There is a problem in my code?
Thanks,
Marzieh
from flann.
Hi Marzieh,
Your code looks fine, it should use the chi square distance. How did you
verify that is the euclidean distance instead?
Marius
On Fri, Aug 17, 2012 at 12:19 AM, Marzounette [email protected]:
Thanks for your response Marius.
Yes, i use the C bindings with FLANN 1.7.1.
Here is a snippet of my code :
//
FLANNParameters flann_params;
flann_params.checks = FLANN_CHECKS_UNLIMITED;
flann_params.eps = 0.0;
flann_params.trees = 1;
flann_params.algorithm = FLANN_INDEX_KDTREE;
flann_set_distance_type( FLANN_DIST_CHI_SQUARE, 0);flann_index_t index_ptr;
flann_find_nearest_neighbors_index( index_ptr, testset, tcount, result,
dists, nn, flann_params);
//I'm looking for the nn exact nearest neighbors.
apparently the distance calculus is doing with the euclidian distance, not
with the chi square distance.
There is a problem in my code?Thanks,
Marzieh—
Reply to this email directly or view it on GitHubhttps://github.com//issues/60#issuecomment-7811500.
from flann.
with printing in L2 and chisquare distance. Only L2 distance is actually performed.
Marzieh
from flann.
I cannot reproduce this. I've done the following changes:
added flann_set_distance_type( FLANN_DIST_CHI_SQUARE, 0); to examples/flann_example.c
and added printfs to L2 and ChiSquare distances in src/cpp/flann/algorithms/dists.h (see patch below)
If I recompile and run flann_example_c only the ChiSquare message gets printed.
Regards,
Marius
diff -Naur flann-1.7.1-src/examples/flann_example.c flann-1.7.1-src_/examples/flann_example.c
--- flann-1.7.1-src/examples/flann_example.c 2011-12-26 02:17:13.000000000 -0800
+++ flann-1.7.1-src_/examples/flann_example.c 2012-08-29 11:58:54.000000000 -0700
@@ -98,6 +98,7 @@
p.trees = 8;
p.log_level = FLANN_LOG_INFO;
p.checks = 64;
+ flann_set_distance_type( FLANN_DIST_CHI_SQUARE, 0);
printf("Computing index.\n");
index_id = flann_build_index(dataset, rows, cols, &speedup, &p);
diff -Naur flann-1.7.1-src/src/cpp/flann/algorithms/dist.h flann-1.7.1-src_/src/cpp/flann/algorithms/dist.h
--- flann-1.7.1-src/src/cpp/flann/algorithms/dist.h 2011-12-26 02:17:13.000000000 -0800
+++ flann-1.7.1-src_/src/cpp/flann/algorithms/dist.h 2012-08-29 11:59:48.000000000 -0700
@@ -138,6 +138,7 @@
template <typename Iterator1, typename Iterator2>
ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType worst_dist = -1) const
{
+ printf("In L2 dist\n");
ResultType result = ResultType();
ResultType diff0, diff1, diff2, diff3;
Iterator1 last = a + size;
@@ -683,6 +684,7 @@
template <typename Iterator1, typename Iterator2>
ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType worst_dist = -1) const
{
+ printf("In ChiSquare dist\n");
ResultType result = ResultType();
ResultType sum, diff;
Iterator1 last = a + size;
from flann.
Related Issues (20)
- Link in the README is dead HOT 2
- different dists result on window vs ubuntu HOT 1
- Allow disabling of static library build
- New ANN libraries much faster than flann! HOT 1
- Overwrite install list
- flann_cuda_tests are failing HOT 4
- links in readme outdated
- BIZ
- cannot access ubc website for downloading the source code for FLANN 1.9.1
- 'Composite' mode has duplicate results (nearest neighbors not unique) HOT 1
- How to build Flann on windows? HOT 3
- The knnsearch result seems to be random in C++ version HOT 1
- matlab issues
- 不支持C++ 17,要求版本为C++ 14 HOT 3
- Assessment of the difficulty in porting CPU architecture for the FLANN
- All URLs in the README are broken
- generates broken pkg-config pc file (stray semicolon)
- Flann 1.9.2 is not deterministic HOT 1
- There was a problem compiling the FLANN CADA 9.2,How to fix ?
- flann-1.8.4 Build on Windows VS2022 - Fails with platform toolset v143 - works with platform toolset v142 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flann.