• Stars
    star
    220
  • Rank 180,422 (Top 4 %)
  • Language
    Rust
  • License
    MIT License
  • Created over 5 years ago
  • Updated 12 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

HNSW ANN from the paper "Efficient and robust approximate nearest neighbor search using Hierarchical Navigable Small World graphs"

hnsw

Discord Crates.io MIT/Apache docs.rs LoC

Hierarchical Navigable Small World Graph for fast ANN search

Enable the serde feature to serialize and deserialize HNSW.

Tips

A good default for M and M0 parameters is 12 and 24 respectively. According to the paper, M0 should always be double M, but you can change both of them freely.

Example

To see how this might be used with hamming space, see tests/simple_discrete.rs. To see how this might be used with euclidean space, see tests/simple.rs.

Note that the euclidean implementation in the test may have some numerical errors and fail to implement the triangle inequality, especially on high dimensionality. Use a Kahan sum instead for proper usage. It also may not utilize SIMD, but using an array may help with that.

Please refer to the space documentation for the trait and types regarding distance. It also contains special Bits128 - Bits4096 tuple structs that wrap an array of bytes and enable SIMD capability. Benchmarks provided use these SIMD impls.

Benchmarks

Here is a recall graph that you can compare to its alternatives:

Recall Graph

For more benchmarks and how to benchmark, see benchmarks.md.

Implementation

This is based on the paper "Efficient and robust approximate nearest neighbor search using Hierarchical Navigable Small World graphs" by Yu. A. Malkov and D. A. Yashunin. This paper builds on the original paper for NSW. There are multiple papers written by the authors on NSW, which preceeded HNSW.

For more details about parameters and details of the implementation, see implementation.md.

Credit

This is in no way a direct copy or reimplementation of the original implementation. This was made purely based on the paper without reference to the original headers. The paper is very well written and easy to understand, with some minor exceptions. Thank you to the authors for your valuble contribution.

Questions? Contributions? Excited?

Please visit the Rust CV Discord.

More Repositories

1

cv

Rust CV mono-repo. Contains pure-Rust dependencies which attempt to encapsulate the capability of OpenCV, OpenMVG, and vSLAM frameworks in a cohesive set of APIs.
Rust
834
star
2

ndarray-vision

Computer vision library built on top of ndarray
Rust
64
star
3

levenberg-marquardt

Provides abstractions to run Levenberg-Marquardt optimization
Rust
50
star
4

nshare

Provides an interface layer to convert between n-dimensional types in different Rust crates
Rust
46
star
5

space

Spatial library for Rust
Rust
39
star
6

cv-core

Rust computer vision core crate
Rust
27
star
7

p3p

Camera pose estimation given 3D points and corresponding pixel coordinates
Rust
18
star
8

arrsac

Implements ARRSAC from the paper "A Comparative Analysis of RANSAC Techniques Leading to Adaptive Real-Time Random Sample Consensus"
Rust
17
star
9

meetups

16
star
10

rust-cv

A repository to hold information and issues about the rust-cv project as a whole
15
star
11

hgg

Hierarchical Greedy Graph
Rust
14
star
12

ndarray-image

Allows conversion between ndarray's types and image's types
Rust
13
star
13

vslam

An attempt to create a full abstraction of simultaneous localization and mapping in Rust
Rust
11
star
14

bitarray

A compile time sized array of bits
Rust
10
star
15

hwt

Hamming Weight Tree from the paper "Online Nearest Neighbor Search in Hamming Space"
Rust
7
star
16

ennona

Reconstruction Tool for Rust CV
Rust
6
star
17

hamming-lsh

Generates and utilizes deterministic dictionaries to generate balanced locality-sensitive hashes (similar to simhash) for arbitrary hamming space features
Rust
5
star
18

header-vec

Allows one to store a header struct and a vector all inline in the same memory on the heap and share weak versions for minimizing random lookups in data structures
Rust
5
star
19

sample-consensus

Provides abstractions for sample consensus algorithms such as RANSAC
Rust
3
star
20

rfcs

RFCs for designing components of rust computer vision ecosystem
3
star
21

akaze

Implementation of AKAZE based on the one originally by indianajohn
Rust
3
star
22

rust-cv.github.io

Website and resources for Rust CV
HTML
2
star
23

pnp

Perspective-n-Point algorithm
Rust
2
star
24

nister-stewenius

Essential matrix estimation from 5 normalized image coordinate correspondences from the paper "Recent developments on direct relative orientation"
Rust
2
star
25

eight-point

Implements the eight-point algorithm for estimating the essential matrix
Rust
1
star
26

hamming-dict

Generates codeword dictionaries for hamming-space BoW algorithms
Rust
1
star
27

vslam-sandbox

A sandbox for integrating upstream vslam algorithms
Rust
1
star
28

kpshow

A tool to show keypoints in images using different keypoint detection algorithms
Rust
1
star
29

cv-pinhole

Pinhole camera model for Rust CV
Rust
1
star
30

ndarray-vision-benchmarking

Collection of comparative benchmarks between ndarray vision and other libraries
Rust
1
star