All Projects → matsui528 → Nanopq

matsui528 / Nanopq

Licence: mit
Pure python implementation of product quantization for nearest neighbor search

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Nanopq

Pynndescent
A Python nearest neighbor descent for approximate nearest neighbors
Stars: ✭ 377 (+160%)
Mutual labels:  nearest-neighbor-search
Falconn
FAst Lookups of Cosine and Other Nearest Neighbors (based on fast locality-sensitive hashing)
Stars: ✭ 919 (+533.79%)
Mutual labels:  nearest-neighbor-search
Gann
gann(go-approximate-nearest-neighbor) is a library for Approximate Nearest Neighbor Search written in Go
Stars: ✭ 75 (-48.28%)
Mutual labels:  nearest-neighbor-search
Lopq
Training of Locally Optimized Product Quantization (LOPQ) models for approximate nearest neighbor search of high dimensional data in Python and Spark.
Stars: ✭ 530 (+265.52%)
Mutual labels:  nearest-neighbor-search
Ngt
Nearest Neighbor Search with Neighborhood Graph and Tree for High-dimensional Data
Stars: ✭ 636 (+338.62%)
Mutual labels:  nearest-neighbor-search
Fast Near Duplicate Image Search
Fast Near-Duplicate Image Search and Delete using pHash, t-SNE and KDTree.
Stars: ✭ 54 (-62.76%)
Mutual labels:  nearest-neighbor-search
lbvh
an implementation of parallel linear BVH (LBVH) on GPU
Stars: ✭ 67 (-53.79%)
Mutual labels:  nearest-neighbor-search
Knn Matting
Source Code for KNN Matting, CVPR 2012 / TPAMI 2013. MATLAB code ready to run. Simple and robust implementation under 40 lines.
Stars: ✭ 130 (-10.34%)
Mutual labels:  nearest-neighbor-search
Pointcloudutilities
Utilities for point cloud processing. read ply, write ply, search nearest neighbors using octree ...
Stars: ✭ 17 (-88.28%)
Mutual labels:  nearest-neighbor-search
Annoy
Approximate Nearest Neighbors in C++/Python optimized for memory usage and loading/saving to disk
Stars: ✭ 9,262 (+6287.59%)
Mutual labels:  nearest-neighbor-search
Soundfingerprinting
Open source audio fingerprinting in .NET. An efficient algorithm for acoustic fingerprinting written purely in C#.
Stars: ✭ 554 (+282.07%)
Mutual labels:  nearest-neighbor-search
Milvus
An open-source vector database for embedding similarity search and AI applications.
Stars: ✭ 9,015 (+6117.24%)
Mutual labels:  nearest-neighbor-search
Awesome Cbir Papers
📝Awesome and classical image retrieval papers
Stars: ✭ 1,114 (+668.28%)
Mutual labels:  nearest-neighbor-search
N2
TOROS N2 - lightweight approximate Nearest Neighbor library which runs fast even with large datasets
Stars: ✭ 457 (+215.17%)
Mutual labels:  nearest-neighbor-search
Rii
Fast and memory-efficient ANN with a subset-search functionality
Stars: ✭ 96 (-33.79%)
Mutual labels:  nearest-neighbor-search
Mlpack
mlpack: a scalable C++ machine learning library --
Stars: ✭ 3,859 (+2561.38%)
Mutual labels:  nearest-neighbor-search
Deep Mihash
Code for papers "Hashing with Mutual Information" (TPAMI 2019) and "Hashing with Binary Matrix Pursuit" (ECCV 2018)
Stars: ✭ 13 (-91.03%)
Mutual labels:  nearest-neighbor-search
Elastiknn
Elasticsearch plugin for nearest neighbor search. Store vectors and run similarity search using exact and approximate algorithms.
Stars: ✭ 139 (-4.14%)
Mutual labels:  nearest-neighbor-search
Neighbor
Nearest neighbor search for Rails and Postgres
Stars: ✭ 114 (-21.38%)
Mutual labels:  nearest-neighbor-search
Ggnn
GGNN: State of the Art Graph-based GPU Nearest Neighbor Search
Stars: ✭ 63 (-56.55%)
Mutual labels:  nearest-neighbor-search

nanopq

Build Status Documentation Status PyPI version Downloads

Nano Product Quantization (nanopq): a vanilla implementation of Product Quantization (PQ) and Optimized Product Quantization (OPQ) written in pure python without any third party dependencies.

Installing

You can install the package via pip. This library works with Python 3.5+ on linux.

pip install nanopq

Documentation

Example

import nanopq
import numpy as np

N, Nt, D = 10000, 2000, 128
X = np.random.random((N, D)).astype(np.float32)  # 10,000 128-dim vectors to be indexed
Xt = np.random.random((Nt, D)).astype(np.float32)  # 2,000 128-dim vectors for training
query = np.random.random((D,)).astype(np.float32)  # a 128-dim query vector

# Instantiate with M=8 sub-spaces
pq = nanopq.PQ(M=8)

# Train codewords
pq.fit(Xt)

# Encode to PQ-codes
X_code = pq.encode(X)  # (10000, 8) with dtype=np.uint8

# Results: create a distance table online, and compute Asymmetric Distance to each PQ-code 
dists = pq.dtable(query).adist(X_code)  # (10000, ) 

Author

Reference

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].