Automatic Feature Selection
C++ Cuda QMake CMake
Latest commit 1fd540a Feb 22, 2016 canerhazirbas minor error: missing deallocation of gpu memory fixed.
Failed to load latest commit information.


Automatic Feature Selection is a code framework for the feature selection method introduced in

Caner Hazirbas, Julia Diebold, Daniel Cremers, Optimizing the Relevance-Redundancy Tradeoff for Efficient Semantic Segmentation, In Scale Space and Variational Methods in Computer Vision, 2015.

Framework Structure

    -- build            ; build directories for CMake and QtCreator projects
    -- cuda             ; cuda source/header files
    -- doc              ; code documentation and related conference paper
        -- html         ; html documentation (double-click on **index.html**)
        -- latex        ; PDF documentation             
    -- include          ; header files
    -- misc             ; miscellaneous source files and mrmr
        -- mrmr         ; folder to store mrmr executable file
    -- src              ; source files
    --          ; QtCreator Project File
    -- CMakeLists.txt   ; CMake Project File

How To Build

Required Hardware/Software

To be able to compile and run the code you need a computer with

  • Ubuntu OS (12.04/14.04)
  • NVidia GPU with CUDA support

You need to install the following libraries (I recommend you to download and compile the libraries from source):

Along with these libraries, you need to install CUDA drivers on your machine:

Once libraries are installed, you can download the source from github:

        git clone

This framework requires mrmr method to be compiled. Please download the source files inside the folder misc/mrmr/ and compile the code with make command.

Build from CMake

  1. Please export the following paths in your .bashrc if you built libraries from source.

    • OpenCV 2.4.10
    export OPENCV_DIR=<path to OpenCV>/OpenCV/2.4.10/share/OpenCV
    export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:<path to OpenCV>/OpenCV/2.4.10/lib/pkgconfig
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<path to OpenCV>/OpenCV/2.4.10/lib  
    • Boost 1.54.0
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<path to Boost>/Boost/1.54/build/lib
  2. Change the following lines in CMakeLists.txt

    • Line 13 : Set path to the OpenCVConfig.cmake
    • Line 23 : Set CUDA Compute Capability in arch=compute_??,code=sm_??
  3. Run console in AFS/build/CMake and type:

    cmake ../../
    make install
    make clean (to clean the project)

Build from QtCreator(qmake)

  1. Set INCLUDEPATH and LIBS path in (qmake project file) for :
    • OpenCV 2.4.10: Lines 71, 73
    • Boost 1.54.0 : Lines 89, 91
    • CUDA 6.5 : Lines 104, 106
  2. Set CUDA installation directory(CUDA_DIR) and CUDA compute capability(CUDA_ARCH) in Lines 101, 102

  3. You can use build/QtCreator/Debug and build/QtCreator/Release folders to compile the project with QtCreator

Both builds will copy the executable file (AFS) into the main project folder. You can run the executable as ./AFS.