/RetinaCUDA

CUDA implementation of retina cortical transformation

Primary LanguagePython

RetinaCUDA

The repository contains a CUDA implementation of the Retinal-Cortical transformation. The CUDA implementation has been built into shared libraries, dll for Windows and so for Linux users. Python wrappers are provided to call the library functions. This project is based on Piotr Ozimek's work at the School of Computing Science at the University of Glasgow.

Repository structure

bin contains the precompiled shared objects for Linux and the dll for Windows in the Linux and Windows folder, respectively
cpp contains the CUDA code and the C wrappers
py contains the Python wrappers and Piotr's code in the Piotr_Ozimek_retina subfolder, used as reference
Retinas contains the locations and coefficients representing the retina as samplingfields
Tests contains two tests used to validate the results and measure the performance of the GPU implementation

Dependencies

The library was compiled only to 64-bit systems. To use it, an Nvidia CUDA capable GPU must be installed in the machine. Although the binaries should not depend on any libraries which have not been included, to use the Python wrappers and especially to run the tests the following software dependencies apply:
python 2.7 64-bit
opencv-python (2.4.13+) -> must be opencv version 2
numpy (1.11.1+)
scipy (0.18.1+)
NOTE: Tests are using camera stream as input
The easiest way to get rid of the dependency issues is to install the 64-bit Anaconda2.
Once Anaconda is installed, run
conda install -c menpo opencv
On Linux, after the installation, the libstdc++.so files from bin/Linux must be copied to CONDA_PATH/anaconda2/lib/ directory (it was shipped with an older version). On Windows, it should just work as it is once anaconda is installed.

Tests

Python tests are located in the Tests folder.
func_test.py contains a correctness test to prove the results are identical with Piotr's results
perf_test.py contains tests to measure the performance of the CUDA implementation, as well as to compare it with the former Python implementation. These tests are good starting point for the API.
perf_eval.py is used to evaluate the performance of the system.
demo.py is used to demonstrate the library in small application.

Recompile the binaries

Nvidia CUDA toolkit must be installed and a C++11 compatible compiler is needed. Use NSight or Visual Studio to build the code under ./cpp into a so or dll. Make sure to turn on Separate Compilation in NSight and Relocatable Device Code generation (-rdc=true) in Visual Studio.