Skip to content

Merge develop #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ include_directories("${PROJECT_BINARY_DIR}")



project(hello_world)

set(SOURCE_EXE main.cpp)

set(SOURCE_LIB1 sift_test.cpp)
set(SOURCE_LIB2 sift_1b.cpp)
set(SOURCE_LIB sift_1b.cpp)

add_library(sift_test STATIC ${SOURCE_LIB})

add_library(sift_test STATIC ${SOURCE_LIB1} ${SOURCE_LIB2})

add_executable(main ${SOURCE_EXE})
add_executable(main ${SOURCE_EXE})
SET( CMAKE_CXX_FLAGS "-Ofast -lrt -DNDEBUG -std=c++11 -DHAVE_CXX0X -openmp -march=native -fpic -w -fopenmp -ftree-vectorize -ftree-vectorizer-verbose=0" )
target_link_libraries(main sift_test)
233 changes: 0 additions & 233 deletions L2space.h

This file was deleted.

35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Hnsw - Approximate nearest neighbor search
Hnsw paper code for the 200M SIFT experiment.

NEW: Added simple python bindings with incremental construction(reusing some nmslib code, only L2 is now supported)


####Test reproduction steps:
To download and extract the bigann dataset:
```bash
python3 download_bigann.py
Expand All @@ -18,6 +22,37 @@ To run the test on 200M SIFT subset:

The size of the bigann subset (in millions) is controlled by the variable **subset_size_milllions** hardcoded in **sift_1b.cpp**.


#### Python bindings example
```python
import hnswlib
import numpy as np

dim = 128
num_elements = 10000

data=np.float32(np.random.random((num_elements,dim)))
data_labels=np.arange(num_elements)

p = hnswlib.Index(space='l2', dim=dim) #Only l2 is supported currently
p.init_index(max_elements=10000, ef_construction=200, M=16)

# Element insertion be called several times:
int_labels = p.add_items(data, data_labels)


p.set_ef(50)
# Query dataset, k - number of closest elements
# Return numpy arrays
labels, distances = p.knn_query(data, k=1)

```
To compile run:
```bash
cd python_bindings
python3 setup.py install
```

The repo contrains some parts of the Non-Metric Space Library's code https://github.com/searchivarius/nmslib

References:
Expand Down
63 changes: 0 additions & 63 deletions brutoforce.h

This file was deleted.

Loading