LshIndexParams broken by implementation of HierarchicalClusteringIndexParams (Bug #2397)
Description
Regression in commit: 7236858bea3c4da1c0cb7c6ccaf62fed184926e1
Specifically the following lines were removed in miniflann.cpp:
- if( algo == FLANN_INDEX_LSH )
- {
- buildIndex_<HammingDistance, LshIndex>(index, data, params);
- return;
- }
in method:
void Index::build(InputArray _data, const IndexParams& params, flann_distance_t _distType)
Associated revisions
Merge pull request #2397 from vbystricky:intelperc
History
Updated by Benjamin Dobell over 12 years ago
Note: Returning the if statement mentioned in the description is enough to fix support for LshIndexParams. This is just one example of special case handling (hacks?) for LshIndexParams, there were others too. It would probably be best to revert the commit and cleanly implement support again.
Updated by Benjamin Dobell over 12 years ago
Sorry,
"Returning the if statement mentioned in the description is enough to fix support for LshIndexParams"
should read:
"Returning the if statement mentioned in the description is not enough to fix support for LshIndexParams"
Updated by Marius Muja over 12 years ago
Hi,
Do you have an example of code that got broken by the commit? The if should be handled by the case branch:
case FLANN_DIST_HAMMING:
buildIndex< HammingDistance >(index, data, params);
break;
Updated by Stefano Fabri over 12 years ago
Hi,
Marius did we need also a knnSearch wrap method of findNeighbors as implemented in lsh_index.h?
Updated by Marius Muja over 12 years ago
Should be fixed in 5cf6c5f0b273cf73be623c1df4ea2a01c3c4be8a, Benjamin can you confirm?
Updated by Marius Muja over 12 years ago
Stefano, the knnSearch method in lsh_index.h overwrites the one inherited from the NNIndex to ensure a ResultSet storing only unique neighbors is used.
Updated by Stefano Fabri over 12 years ago
Ok so do we need to call directly findNeighbors? Because documentation and miniflann expose only knnSearch and radiusSearch actually with flann::Index_<T>::knnSearch and flann::Index_<T>::radiusSearch.
Updated by Marius Muja over 12 years ago
No, you should not call findNeighbors directly (it should actually be a protected member), it's being called by knnSearch and radiusSearch.
Updated by Benjamin Dobell over 12 years ago
Marius Muja wrote:
Should be fixed in 5cf6c5f0b273cf73be623c1df4ea2a01c3c4be8a, Benjamin can you confirm?
Thanks, that seems to have done the trick.
You mention in your commit message that this change is to enable backwards compatibility. What is the correct (i.e. modern) way to use LSH indexes now?
Presently I'm doing something like:
FlannBasedMatcher flannBasedMatcher(new flann::LshIndexParams(kLshTableNumber, kLshKeySize, kLshMultiProbeLevel);
Updated by Vadim Pisarevsky over 12 years ago
so, was the problem solved? in any case, we lower priority of the bug.
- Priority changed from Blocker to Normal
Updated by Marius Muja about 12 years ago
- Status changed from Open to Done
Updated by Andrey Kamaev about 12 years ago
- Target version set to 2.4.4
- Status changed from Done to Cancelled