OATM: Occlusion Aware Template Matching by Consensus Set Maximization

Simon Korman, Mark Milam, Stefano Soatto

Abstract

We present a novel approach to template matching that is efficient, can handle partial occlusions, and comes with provable performance guarantees. A key component of the method is a reduction that transforms the problem of searching a nearest neighbor among $N$ high-dimensional vectors, to searching neighbors among two sets of order $\sqrt{N}$ vectors, which can be found efficiently using range search techniques. This allows for a quadratic improvement in search complexity, and makes the method scalable in handling large search spaces. The second contribution is a hashing scheme based on consensus set maximization, which allows us to handle occlusions. The resulting scheme can be seen as a randomized hypothesize-and-test algorithm, which is equipped with guarantees regarding the number of iterations required for obtaining an optimal solution with high probability. The predicted matching rates are validated empirically and the algorithm shows a significant improvement over the state-of-the-art in both speed and robustness to occlusions.

Introduction

Template matching—finding a small template image within a larger target—is a cornerstone of computer vision. However, it faces a fundamental trade-off between discriminativity and occlusion tolerance. Large templates are easier to distinguish from background noise but are more likely to be partially covered. Furthermore, searching for templates under geometric transformations (rotation, scaling, affine warping) is computationally expensive, typically scaling linearly with the number of possible transformations $N$. OATM (Occlusion Aware Template Matching) addresses these challenges by providing a scalable, occlusion-robust solution with theoretical performance guarantees.

Methodology

Quadratic Complexity Reduction

OATM introduces a "meet-in-the-middle" approach to reduce search complexity. Instead of an exhaustive search over $N$ transformations, the transformation space is decomposed into a product of two smaller spaces. This transforms the problem into searching for neighbors between two sets of vectors, each of size approximately $O(\sqrt{N})$. This reduction is crucial for handling large images and complex affine search spaces efficiently.

Random Grid Hashing for Consensus

To handle occlusions, the algorithm employs a Consensus Set Maximization approach, similar to RANSAC. Rather than matching the entire template at once, it samples a small number of random pixels and uses them to index into a hash table.

Illustration of the grid-based hashing mechanism used for consensus set maximization.

If multiple transformed templates fall into the same bin, they are considered candidate matches. Because the algorithm only requires a small subset of pixels to collide in the hash table, it can successfully find the template even if the majority of its pixels are occluded. The authors provide a statistical analysis to determine the exact number of iterations needed to find the optimal match with high probability given an expected inlier rate.

Evaluation and Results

The paper evaluates OATM using synthetic occlusion experiments on high-resolution images and the HPatches benchmark for viewpoint and illumination changes.

Robustness to Occlusion

OATM demonstrates remarkable resilience to partial occlusions. While competing methods like Fast-Match (FM) and Best Buddies Similarity (BBS) fail once occlusions exceed 25-30%, OATM maintains high accuracy even when the inlier rate drops to 0.25 (75% occlusion).

Qualitative comparison of OATM against state-of-the-art methods across various challenging scenarios including occlusion and viewpoint changes.

Speed and Benchmark Performance

OATM is typically an order of magnitude faster than the state-of-the-art Fast-Match algorithm. In scalability tests, OATM's runtime grew linearly with $\sqrt{N}$, while FM grew linearly with $N$. On the HPatches "Tough" viewpoint tasks, OATM achieved a Mean Average Precision (mAP) of 32.1%, significantly outperforming SIFT (15.3%) and deep-learning-based descriptors like DDESC (20.2%).

Conclusion

OATM represents a significant advancement in template matching, offering a combination of high speed, high robustness, and certifiable performance. While currently designed for rigid or semi-rigid objects, its underlying principles of geometric decomposition and consensus-based hashing provide a strong foundation for future work in non-rigid registration and more complex projections.

Summary updated

BibTeX
@inproceedings{korman2018oatm,
  author = {Simon Korman and Mark Milam and Stefano Soatto},
  title = {{OATM: Occlusion Aware Template Matching by Consensus Set Maximization}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2018},
  url = {https://openreview.net/forum?id=rJVkqaWO-B},
}
Figure