libHOG icon indicating copy to clipboard operation
libHOG copied to clipboard

fast and energy-efficient computation of HOG features

libHOG

About

libHOG is a library that computes Histogram of Oriented Gradient feature pyramids. The benefit of libHOG over other HOG implementations is speed. On an Intel i7-3930k 6-core CPU, we measured the following results:

Frame Rate Speedup Energy per frame (Joules)
voc-release5 2.44 fps 1.0x 57.4 J/frame
Dollar 5.88 fps 2.4x 26.4 J/frame
FFLD-serial 4.59 fps 1.9x 29.9 J/frame
FFLD-OpenMP 19.6 fps 8.0x 9.44 J/frame
libHOG (this codebase) 58.8 fps 24.1x 3.15 J/frame

The output of libHOG is numerically equivalent to the HOG features in the Deformable Model Parts model (voc-release5) codebase, with a 24x speedup. For further speedups (over 70fps), we also offer the option to use L1-norm (instead of the traditional L2-norm) when calculating the gradients. If you find libHOG useful, please consider citing the libHOG paper:

@inproceedings{libHOG,
    Author = {Forrest N. Iandola and Matthew W. Moskewicz and Kurt Keutzer},
    Title = {libHOG: Energy-Efficient Histogram of Oriented Gradient Computation},
    Booktitle = {ITSC},
    Year = {2015}
}

Getting Started

  1. install OpenCV
  2. point Makefile to OpenCV
  3. mkdir tests_output; mkdir build;
  4. make

basic example on how to use libHOG in C++:

//computing HOG features on my_image.jpg
cv::Mat img = cv::imread("my_image.jpg");
libHOG lHOG();
lHOG.compute_pyramid(img);
//HOG pyramid is located here: lHOG.hogBuffer_blocks[scale]
//pyramid dimensions: lHOG.hogHeight[scale], lHOG.hogWidth[scale]
//number of scales: lHOG.hogHeight.size()

see src/libHOG_cli.cpp for an additional example of how to use libHOG

linking your project with libHOG: include libHOG.h, and dynamically link with libHOG.so