Giter VIP home page Giter VIP logo

pyflann's People

Contributors

primetang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyflann's Issues

ImportError: No module named 'index'

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

Handling different dimensions of points for build_index()

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!

GPU support

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?

Error when importing pyflann in python.

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?

Python 3 support

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:

    • bindings/init.py
    • the pyflann imports in index.py
    • both imports in init.py
    • io/init.py
    • the _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:

  • I get an error about flann_parameters missing when __del is called. Apparently, they are deleted before the del call?

With these fixes, pyflann seems to work.

Maybe not working in python3, intermitant "Caught exception: Unknown algorithm for choosing inital centers" error

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]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.