Fast Template Evaluation with Vector Quantization

Mohammad Amin Sadeghi, David A. ForsythNeurIPS 2013

TL;DR

This paper introduces a novel method for significantly accelerating object detection by approximating linear template evaluations using Vector Quantization (VQ). By trading a small amount of accuracy for massive speedups, their approach achieves up to two orders of magnitude faster detection without requiring model retraining, making it a plug-and-play solution for existing systems.

What Problem Does This Paper Address?

Modern object detection systems, particularly those relying on linear templates like Deformable Part Models (DPM) and Exemplar SVMs, face a significant computational bottleneck: evaluating these templates across numerous locations and scales within an image. This "template evaluation" step consumes the vast majority of processing time, hindering real-time applications. While existing methods offer speedups through techniques like cascades or fast Fourier transforms, they often come with accuracy trade-offs, require retraining, or are not easily integrated into existing pipelines. This paper aims to provide a method that drastically reduces this computation time without sacrificing accuracy and can be readily applied to pre-trained models.

Methods

The core of the proposed method is Vector Quantization (VQ) applied to the feature vectors within image windows. Instead of performing exact dot products between template weights and image features, the method quantizes the image features into a set of representative "clusters." The score is then approximated by looking up pre-computed partial dot products between template cells and these cluster centroids. This drastically reduces the per-window computation from a series of multiplications and additions to a simple table lookup.

To further enhance speed, the authors combine VQ with other techniques:

  • Cascades: The VQ-based approximate scoring is used in a cascade framework. This means cheap, fast VQ scores are used to quickly discard unpromising locations, and only a subset of these are then re-evaluated with the more accurate, but slower, original template scoring.
  • Fast Deformation Estimates: For deformable part models, instead of exhaustive search for optimal part deformations, a hill-climbing approach is used, starting from the center and moving to the highest-scoring neighbor until a local maximum is found.
  • Packed Lookup Tables: To optimize memory access and leverage SIMD instructions, lookup tables for multiple templates or multiple locations are packed together.
  • Padding Templates: Templates are zero-padded to create multiple translated versions, allowing for the evaluation of several locations in a single pass.

The key novelty lies in applying VQ during evaluation rather than quantizing the feature space and retraining a new model, as done in some prior work. This allows the method to be applied to legacy models.

Datasets

The paper evaluates its method on the PASCAL VOC 2007 dataset, a standard benchmark for object detection. They use legacy models trained on this dataset for both Deformable Part Models and Exemplar SVM detectors.

Key Insights and Ideas

  • VQ as a plug-and-play speedup: The most significant insight is that VQ can be used as a direct replacement for exact score computation during inference, offering substantial speedups without the need for retraining. This makes it highly practical for deploying existing models.
  • Trade-off flexibility: The number of VQ clusters ($c$) directly controls the trade-off between speed and accuracy. More clusters mean higher accuracy but slower computation, while fewer clusters offer greater speed at the cost of some accuracy.
  • VQ outperforms PCA for feature approximation: The paper argues that VQ is generally more effective than Principal Component Analysis (PCA) for approximating dot products in this context, especially when feature distributions are "blobby."
  • Cascades amplify VQ benefits: Combining VQ with cascade detection significantly amplifies the speedup, as the fast approximate scores can prune a much larger portion of the search space.
  • Impact on training: The paper notes that VQ could also have implications for training by reducing the memory footprint of features, potentially enabling faster training algorithms.

Key Results

The proposed method achieves dramatic speedups:

  • Deformable Part Models (DPM): Two orders of magnitude speedup compared to the original implementation.
  • Exemplar SVM detectors: An order of magnitude speedup.

Crucially, these speedups are achieved with no loss of accuracy when using a rescoring step, and only a small drop (around 3%) in mean average precision (mAP) for the "Our-rescoring" variant which relies solely on VQ. For example, their "Our+rescoring" method achieves an mAP of 0.331 with a running time of 21ms per image, compared to the original DPM V5's 0.330 mAP and 665ms per image.

Limitations and Future Work

  • Per-image penalty: The method incurs a per-image penalty for computing the VQ of HOG features, in addition to the HOG feature computation itself. The authors believe this VQ computation could be further sped up.
  • Generalizability of $c$: While $c=256$ clusters proved sufficient for preserving accuracy on PASCAL VOC, the authors suggest that more general applications might require a different number of clusters.
  • Training implications: The paper hints at future work related to how VQ could enable faster training by making feature storage more memory-efficient.

Summary updated

BibTeX
@inproceedings{sadeghi2013fast,
  author = {Mohammad Amin Sadeghi and David A. Forsyth},
  title = {{Fast Template Evaluation with Vector Quantization}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2013},
  url = {https://openreview.net/forum?id=SkVaoD-_WS},
}
Figure