All Projects → chrischoy → Knn_cuda

chrischoy / Knn_cuda

Fast K-Nearest Neighbor search with GPU

Labels

Projects that are alternatives of or similar to Knn cuda

Extending Jax
Extending JAX with custom C++ and CUDA code
Stars: ✭ 98 (-17.65%)
Mutual labels:  cuda
Torch Mesh Isect
Stars: ✭ 107 (-10.08%)
Mutual labels:  cuda
Pytorch spn
Extension package for spatial propagation network in pytorch.
Stars: ✭ 114 (-4.2%)
Mutual labels:  cuda
Deepnet
Deep.Net machine learning framework for F#
Stars: ✭ 99 (-16.81%)
Mutual labels:  cuda
Dace
DaCe - Data Centric Parallel Programming
Stars: ✭ 106 (-10.92%)
Mutual labels:  cuda
Futhark
💥💻💥 A data-parallel functional programming language
Stars: ✭ 1,641 (+1278.99%)
Mutual labels:  cuda
Pynvvl
A Python wrapper of NVIDIA Video Loader (NVVL) with CuPy for fast video loading with Python
Stars: ✭ 95 (-20.17%)
Mutual labels:  cuda
Spoc
Stream Processing with OCaml
Stars: ✭ 115 (-3.36%)
Mutual labels:  cuda
Hashcat
World's fastest and most advanced password recovery utility
Stars: ✭ 11,014 (+9155.46%)
Mutual labels:  cuda
Tensorflow Object Detection Tutorial
The purpose of this tutorial is to learn how to install and prepare TensorFlow framework to train your own convolutional neural network object detection classifier for multiple objects, starting from scratch
Stars: ✭ 113 (-5.04%)
Mutual labels:  cuda
Pygraphistry
PyGraphistry is a Python library to quickly load, shape, embed, and explore big graphs with the GPU-accelerated Graphistry visual graph analyzer
Stars: ✭ 1,365 (+1047.06%)
Mutual labels:  cuda
Chamferdistancepytorch
Chamfer Distance in Pytorch with f-score
Stars: ✭ 105 (-11.76%)
Mutual labels:  cuda
Adacof Pytorch
Official source code for our paper "AdaCoF: Adaptive Collaboration of Flows for Video Frame Interpolation" (CVPR 2020)
Stars: ✭ 110 (-7.56%)
Mutual labels:  cuda
Dpp
Detail-Preserving Pooling in Deep Networks (CVPR 2018)
Stars: ✭ 99 (-16.81%)
Mutual labels:  cuda
Cltune
CLTune: An automatic OpenCL & CUDA kernel tuner
Stars: ✭ 114 (-4.2%)
Mutual labels:  cuda
Supra
SUPRA: Software Defined Ultrasound Processing for Real-Time Applications - An Open Source 2D and 3D Pipeline from Beamforming to B-Mode
Stars: ✭ 96 (-19.33%)
Mutual labels:  cuda
Cuhe
CUDA Homomorphic Encryption Library
Stars: ✭ 109 (-8.4%)
Mutual labels:  cuda
Tensorflow Optimized Wheels
TensorFlow wheels built for latest CUDA/CuDNN and enabled performance flags: SSE, AVX, FMA; XLA
Stars: ✭ 118 (-0.84%)
Mutual labels:  cuda
Mtensor
A C++ Cuda Tensor Lazy Computing Library
Stars: ✭ 115 (-3.36%)
Mutual labels:  cuda
Pytorch Unflow
a reimplementation of UnFlow in PyTorch that matches the official TensorFlow version
Stars: ✭ 113 (-5.04%)
Mutual labels:  cuda

K-Nearest Neighbor GPU

This repository contains a GPU version of K-Nearest Neighbor search. It also provides a python wrapper for the ease of use. The main CUDA code is modified from the K Nearest Neighbor CUDA library. Along with the K-NN search, the code provides feature extraction from a feature map using a bilinear interpolation.

Installation

Please modify the Makefile.config to make sure all the dependencies are set correctly.

git clone https://github.com/chrischoy/knn_cuda.git
cd knn_cuda

Modify the Makefile.config file to set PYTHON_INCLUDE, PYTHON_LIB, CUDA_DIR correctly. By default, The variables are set to the default python and CUDA installation directories.

Then

make

Example

Once you build the wrapper, run

python example.py
[[3367 2785 1523 ..., 1526  569 3616]
 [1929 3353  339 ...,  690  463 2972]]
[[3413 3085 1528 ...,  608 2258  733]
 [1493 3849 1616 ...,  743 2012 1786]]
[[2446 3320 2379 ..., 2718  598 1854]
 [1348 3857 1393 ..., 3258 1642 3436]]
[[3044 2604 3972 ..., 3968 1710 2916]
 [ 812 1090  355 ...,  699 3231 2302]]

Usage

In python, after you import knn, you can access the knn function.

distances, indices = knn.knn(query_points, reference_points, K)

Both query_points and reference_points must be numpy arrays with float32 format. For both query and reference, the first dimension is the dimension of the vector and the second dimension is the number of vectors. K is the number of nearest neighbors.

For each vector in the query_points, the function returns the distance from the query and the K-NNs and the 1-based indices of the K nearest neighbors. Both distances and indices have the same dimensions and the first dimension has size K and the size the second dimension is equal to the number of vectors in the query_points.

extracted_features = knn.extract_feature(activations, coordinates)

Extract features from the activation maps using bilinear interpolation. The activations is a 4D (N, C, H, W) tensor from which we extract features. N is the number of feature maps; C is the number of channels; H and W are height and width respectively. The coordinates is a 3D (N, M, 2) tensor which contains the coordinates which we use to extract features. N is the number of feature maps; M is the number of coordinates; The last 2 is for x and y coordinate.

Warning

The returned index is 1-base.

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].