We provide an efficient method for high-dimensional nearest neighbor search, especially for image data.
FNN is fast in query, very fast in preprocessing.
These codes are distributed under GPL3.0 license.
These codes are written in C++ without any system dependent functions, or dependencies to other libraries. We checked it works on Linux/Windows machines. Maybe, it works also on other machines, too.
To use as a library
Download core code, simply copy to your project directory, and just attach it to your own code.
You may only need to use the following two functions.
void _fnnne::fnn_preprocessing(_image* data,int datanum,int width,int height)
_image* data: data images. _image is a 'struct' contains 3-dimensional pixel array in p[RGB][height][width] order. pixel value can be on any range.(0~255 or 0~1 or any)
int datanum: number of data.
int width: image width.
int height: image height.
*Currently, width and height should be dividable by 4.
_result _fnnne::fnn_query(_image* q)
image* q: a query image. _image is a 'struct' contains 3-dimensional pixel array in p[RGB][height][width] order.
return value is _result contains this result of nearest neighbor search.
By need, you can release all memory allocated by this library using following function.
Download example code with dataset.
The experiment on paper was done one windows machine with vs2010.
(vs2010 express is free and you can download here)
Open the solution file, build and run.
It finds nearest neighbors from 100 queries, among included dataset(CIFAR) as experiments in paper.
For the comparison and proof of returned nearest neighbor, test code also includes optimized brute-force algorithm.
The results are written on "out.txt" file.