This is currently a work in progress. If this works out of the box, good. Otherwise it would be worth noting that it's work in progress.
This is a fork of the abandoned pyflann project, which is a Python wrapper for Marius Muja's excellent FLANN - Fast Library for Approximate Nearest Neighbors.
Improvements over the original project:
- Python 3.x compatibility.
- Pre-built libraries bundled are optimized with the Intel compiler and performance libraries.
Packages are not provided via PyPI, for the following reasons:
-
Intel library dependencies.
-
To prevent pollution of PyPI with half baked, abandoned forks.
-
Pre-built binaries only have 64-bit support.
git clone https://github.com/cynthia/pyflann3.git pip install -e pyflann3
Examples have been taken from the original documentation:
from pyflann import *
import numpy as np
dataset = np.array(
[[1., 1, 1, 2, 3],
[10, 10, 10, 3, 2],
[100, 100, 2, 30, 1]
])
testset = np.array(
[[1., 1, 1, 1, 1],
[90, 90, 10, 10, 1]
])
flann = FLANN()
result, dists = flann.nn(
dataset, testset, 2, algorithm="kmeans", branching=32, iterations=7, checks=16)
print(result)
print(dists)
dataset = np.random.rand(10000, 128)
testset = np.random.rand(1000, 128)
flann = FLANN()
result, dists = flann.nn(
dataset, testset, 5, algorithm="kmeans", branching=32, iterations=7, checks=16)
print(result)
print(dists)