menpo/menpo — pull request #422 by dubzzz (2014-08-31 21:45:31+00:00)
Title: CUDA implementation of Dalal-Triggs HOG

Thanks to its CUDA implementation, Dalal-Triggs HOG algorithm benefits from a speed-up of around 17x compared to its serial version (depending on the machine).

In order to activate and use CUDA on Dalal-Triggs HOG, it is necessary to add an extra parameter in the usual set of parameters of HOG. By default this parameter is set to `False`. The parameter that enables CUDA is `use_cuda`. The following example have been adapted from menpo-notebooks (Images/Features.ipynb) and shows how to use it:
```Python
cuhog = breaking_bad.features.hog(mode='dense',
algorithm='dalaltriggs',
cell_size=8,
block_size=2,
num_bins=9,
signed_gradient=True,
l2_norm_clip=0.2,
window_height=1, window_width=1, window_unit='blocks',
window_step_vertical=1, window_step_horizontal=1, window_step_unit='pixels',
padding=True,
verbose=True,
constrain_landmarks=True, use_cuda=True)
```

Furthermore it is quite straightforward to check whether or not CUDA is available on the current machine:
```Python
import menpo.cuda as cuda
if not cuda.is_cuda_available():
raise Exception("""/!\ CUDA is not available on your machine""")
```