Coder Social home page Coder Social logo

xuqinhaow / ggnn Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cgtuebingen/ggnn

0.0 0.0 0.0 67 KB

GGNN: Graph-based GPU Nearest Neighbor Search

License: MIT License

CMake 0.84% Shell 0.18% C++ 20.06% Dockerfile 0.42% Makefile 0.06% Cuda 78.44%

ggnn's Introduction

GGNN: Graph-based GPU Nearest Neighbor Search

*Fabian Groh, Lukas Ruppert, Patrick Wieschollek, Hendrik P.A. Lensch

Approximate nearest neighbor (ANN) search in high dimensions is an integral part of several computer vision systems and gains importance in deep learning with explicit memory representations. Since PQT and FAISS started to leverage the massive parallelism offered by GPUs, GPU-based implementations are a crucial resource for today’s state-of-the-art ANN methods. While most of these methods allow for faster queries, less emphasis is devoted to accelerate the construction of the underlying index structures. In this paper, we propose a novel search structure based on nearest neighbor graphs and information propagation on graphs. Our method is designed to take advantage of GPU architectures to accelerate the hierarchical building of the index structure and for performing the query. Empirical evaluation shows that GGNN significantly surpasses the state-of-the-art GPU- and CPU-based systems in terms of build-time, accuracy and search speed.


How to run the code?

# Get the repository and dependencies
git clone --recursive https://github.com/cgtuebingen/ggnn.git
cd ggnn

# get the SIFT1M data
cd data
./get_sift1m
cd ..

# Build the demo
mkdir build_local
cd build_local
cmake ..
make

# Usage of demo:
./demo --base_filename ../data/sift/sift_base.fvecs                 \
        --query_filename ../data/sift/sift_query.fvecs              \
        --groundtruth_filename ../data/sift/sift_groundtruth.ivecs  \
        --graph_filename ./tmp/graph_cache.ggnn  \
        --gpu_id 0  \
        --logtostderr=1

Native build

Requirements:

  • CUDA (>10.2)
  • libgflags-dev (sudo apt install libgflags-dev)

Docker build

An alternative to the native build is to use nvidia-docker. Follow instruction on https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#installing-docker-ce

Prepare the docker image by

cd docker
make
cd ../

Make sure you can run

sudo docker run --gpus all cgtuebingen/ggnn:v1 nvidia-smi

Now build the code via

user@host $ sudo docker run --rm -it --user "$(id -u):$(id -g)" -v ${PWD}:/ggnn:rw --gpus all cgtuebingen/ggnn:v1 bash
user@container $ ./build.sh

cd build_docker
make
./demo ../data/sift/sift_base.fvecs ../data/sift/sift_query.fvecs ../data/sift/sift_groundtruth.ivecs 0.5 2 0 --v 0

More Resources

ggnn's People

Contributors

grohf avatar lukasruppert avatar patwie avatar

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.