Is the Game worth the Candle? - Evaluation of OpenCL for Object Detection Algorithm Optimization

Floris De Smedt, Lars Struyf, Sander Beckers, Joost Vennekens, Gorik De Samblanx, Toon GoedeméPECCS 2012

TL;DR

This paper explores the optimization of a robust object detection algorithm (Felzenszwalb et al.'s HOG-based method) by implementing it on GPUs using OpenCL. The authors demonstrate significant speedups, achieving a four-fold improvement in feature pyramid construction time compared to a CPU implementation, highlighting OpenCL's potential for accelerating computationally intensive computer vision tasks.

What Problem Does This Paper Address?

Object detection is a crucial task in computer vision, enabling applications like surveillance, autonomous driving, and image retrieval. While state-of-the-art object detection algorithms offer high accuracy, they are often computationally expensive, hindering real-time performance. This paper addresses the challenge of accelerating these powerful but slow algorithms by leveraging the parallel processing capabilities of GPUs through the OpenCL framework. The authors specifically focus on optimizing the feature pyramid construction, a computationally intensive part of the Felzenszwalb et al. object detection method.

Methods

The core of the paper lies in the implementation of the Felzenszwalb et al. object detection algorithm's feature pyramid construction using OpenCL. This algorithm is based on Histograms of Oriented Gradients (HOG) and incorporates deformable part models for improved robustness. The authors' implementation breaks down the feature pyramid construction into several stages:

  • Rescale: Creating a scale-space pyramid by resizing the input image to different resolutions using linear interpolation. This is parallelized by assigning one thread per destination pixel.
  • Histogram: Calculating HOGs by computing gradients and then creating orientation histograms for each pixel. This step presents a challenge due to potential simultaneous write operations to the same memory locations, which the authors address by carefully managing thread execution and memory access.
  • Features: Calculating various feature types (contrast-sensitive, contrast-insensitive, texture, and truncation) from the HOGs. This involves operations like summing squared opposite orientations and multiplying with pre-calculated values.

The authors emphasize that their OpenCL implementation is designed for heterogeneity, allowing it to run on different hardware platforms with minimal code changes. They also discuss the memory model of GPUs and how it influences performance.

Datasets

The paper does not explicitly mention specific datasets used for training the object detection models. However, the experiments for timing results were conducted using 795 images with a resolution of 600x480, processed three times each. The PETS2010 dataset is referenced in the context of vulnerable road user detection, but not directly for the experiments presented in this paper.

Key Insights and Ideas

  • OpenCL for Heterogeneous Computing: The paper strongly advocates for OpenCL as a flexible and portable standard for leveraging heterogeneous hardware (CPUs, GPUs) for computationally intensive tasks.
  • GPU Acceleration of Feature Pyramid: The feature pyramid construction, a bottleneck in many object detection algorithms, can be significantly accelerated by parallelizing its stages on GPUs.
  • Challenges in Parallel Memory Access: Handling simultaneous write operations to the same memory locations in parallel kernels is a significant challenge. The authors' approach to managing this for histogram creation is a key aspect of their implementation.
  • Trade-offs in Implementation: While OpenCL offers flexibility, it requires a substantial number of function calls to set up the execution environment, which can be seen as a disadvantage but is offset by reusability.
  • Ease of Use vs. Performance: Achieving optimal performance with OpenCL requires a deep understanding of the algorithm and hardware, going beyond simple copy-pasting of code.

Key Results

  • Significant Speedup: The OpenCL implementation of the feature pyramid construction achieved a speedup of approximately four times compared to the CPU implementation for images of 600x480 resolution.
  • Bottleneck Identification: The rescaling and histogram calculation stages were identified as the most computationally intensive parts on the CPU and also yielded the most significant speedups when parallelized on the GPU.
  • Quantitative Timing Breakdown: The paper provides detailed tables and figures showing the distribution of calculation time across different functions and implementations (CPU vs. various OpenCL stages), illustrating the impact of GPU acceleration. For instance, the rescale function on GPU took only 48.41% of the time compared to its CPU counterpart.

Limitations and Future Work

  • Limitations:
    • The paper acknowledges the challenge of simultaneous write operations to memory locations, which required specific approaches to manage.
  • Debugging OpenCL on Linux was noted as more difficult due to the lack of readily available debugging environments compared to Windows.
  • The current implementation focuses only on feature pyramid construction, not the full object detection pipeline (i.e., the search for models).
  • Future Work:
    • Texture Memory: Integrating texture memory for more efficient random access patterns, potentially leading to a 3-4 times speedup in access speed.
  • Vectorization: Utilizing vector operations to process multiple elements simultaneously, which may require memory padding.
  • Model Search Implementation: Implementing the model search part of the algorithm in OpenCL, which involves convolutions, to avoid transferring the entire feature pyramid back to host memory.

Summary updated

BibTeX
@inproceedings{smedt2012is,
  author = {Floris De Smedt and Lars Struyf and Sander Beckers and Joost Vennekens and Gorik De Samblanx and Toon Goedemé},
  title = {{Is the Game worth the Candle? - Evaluation of OpenCL for Object Detection Algorithm Optimization}},
  booktitle = {PECCS},
  year = {2012},
}
Figure