primetang / pyflann Goto Github PK
View Code? Open in Web Editor NEWpython bindings for FLANN - Fast Library for Approximate Nearest Neighbors.
License: Other
python bindings for FLANN - Fast Library for Approximate Nearest Neighbors.
License: Other
Hello!
Is there a way to feed pyflann.FLANN() with points of different dimensions? For example it could be SURF descriptors of images.
What is the most appropriate way to handle this?
Would it be right to get the maximum length of dataset points and fill with zeros points of smaller dimension? I assume that it is ok, because it doesn`t change the euclidean norm and distance as well.
Thank you!
I installed pyflann [on Ubuntu 16.04 python 2.7] using pip but when import pyflann in python, I get the following error:
import pyflann
/usr/local/lib/python2.7/dist-packages/pyflann/init.py in ()
25 #THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
---> 27 from index import *
28 from io.dataset import load, save
29 try:
/usr/local/lib/python2.7/dist-packages/pyflann/index.py in ()
25 #THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
---> 27 from bindings.flann_ctypes import *
28 from io.dataset import *
29 import numpy.random as _rn
/usr/local/lib/python2.7/dist-packages/pyflann/bindings/init.py in ()
28 #from pyflann_parameters import parameter_list, algorithm_names
29 #from pyflann_parameters import centers_init_names, log_level_names
---> 30 from flann_ctypes import *
/usr/local/lib/python2.7/dist-packages/pyflann/bindings/flann_ctypes.py in ()
171 flannlib = load_flann_library()
172 if flannlib == None:
--> 173 raise ImportError('Cannot load dynamic library. Did you compile FLANN?')
174
175
ImportError: Cannot load dynamic library. Did you compile FLANN?
Hi, I use pip to install pyflann and my environment is python3.5
when I compile "from pyflann import *", I got an error like this:
from pyflann import *
File "/.../anaconda3/lib/python3.5/site-packages/pyflann/init.py", line 27, in
from index import *
ImportError: No module named 'index'
so what I do next is pip install index, but I found the information: only these python versions are supported: [(2, 6), (2, 7), (3, 2), (3, 3), (3, 4)]
is there any way to use pyflann in python3.5?
Thank a lot
Hi,
I'm getting some errors when using Python 3 (3.4.3) (and installing from pip, pyflann 1.6.12).
I'm getting import errors due to relative imports. The solution is to replace various from foo import *
with from .foo import *
.
See also here
(This should also work in Python 2.)
specifically:
_dataset
imports in io/dataset.py need to be relative as well, e.g from . import binary_dataset
after fixing these, I get invalid syntax in find_ctypes.py, line 151. The reason is that the except Exception, e
syntax was replaced by except Exception as e:
.
In this case, it could just be except Exception:
same in io/dataset.py, line 61 and hdf5_dataset, line 34+67
in flann_ctypes, line 201, the exec
call needs brackets
Python 3 no longer contains dict.iteritems
and should be replaced by dict.items (in flann_ctypes, l.53 and 78)
(Not sure if this is the right place for these issues, I just followed the pip package to its source.)
Some additional errors which I'm not sure are the fault of Python 3:
With these fixes, pyflann seems to work.
Does pyflann support multithreads?
If yes how?
Thanks.
You should probably remove the *.pyc
files from your git repo.
Anybody knows if it supports gpu-acceleration?
(since it only has one static libflann.so, I guess the answer is probably "no")
Maybe the difference is not that much, so it won't be worth it?
So I don't really know what I'm doing with this package, apologies if this is a error on my end. The error message "Caught exception: Unknown algorithm for choosing initial centers." seems to appear intermittently when trying to chose an algorithm with a string, and no matter what I put in the result is [0, 0]
.
I am using python 3.6.7 with ipython 7.1.1.
Here is an example;
testset = np.random.rand(1000, 128)
...: flann = pyflann.FLANN()
...: result, dists = flann.nn(
...: dataset, testset, 5, algorithm="kmeans", branching=32, iterations=7, checks=16)
Caught exception: Unknown algorithm for choosing initial centers.
#^^ Error here!!!!!!!
In [31]: dataset = np.random.rand(10000, 128)
...: testset = np.random.rand(1000, 128)
...: flann = pyflann.FLANN()
...: result, dists = flann.nn(
...: dataset, testset, 5, algorithm=0, branching=32, iterations=7, checks=16)
In [32]: results
Out[32]: array([0, 0], dtype=int32)
In [33]: dataset = np.random.rand(10000, 128)
...: testset = np.random.rand(1000, 128)
...: flann = pyflann.FLANN()
...: result, dists = flann.nn(
...: dataset, testset, 5, branching=32, iterations=7, checks=16)
In [34]: results
Out[34]: array([0, 0], dtype=int32)
In [35]: dataset = np.random.rand(10000, 128)
...: testset = np.random.rand(1000, 128)
...: flann = pyflann.FLANN()
...: result, dists = flann.nn(
...: dataset, testset, 5, algorithm=0, branching=32, iterations=7, checks=16)
In [36]: dataset = np.random.rand(10000, 128)
...: testset = np.random.rand(1000, 128)
...: flann = pyflann.FLANN()
...: result, dists = flann.nn(
...: dataset, testset, 5, algorithm="kmeans", branching=32, iterations=7, checks=16)
#^^ Same code no error!!!!!!!
In [37]: print(results)
[0 0]
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.