Hadamard Matrix Guided Online Hashing

Mingbao Lin, Rongrong Ji, Hong Liu, Xiaoshuai Sun, Shen Chen, Qi Tian

Abstract

Online hashing is a critical technique for efficient image retrieval in dynamic environments where data arrives in continuous streams. Traditional supervised online hashing methods often suffer from high optimization complexity and significant training overhead due to the relaxation of discrete constraints. This paper introduces Hadamard Matrix Guided Online Hashing (HMOH), a novel framework that simplifies the hashing process by utilizing the columns of a Hadamard matrix as pre-defined target codes. By reformulating hashing as a series of independent binary classification tasks and employing an ensemble strategy to preserve historical knowledge, HMOH achieves state-of-the-art retrieval accuracy and training efficiency across multiple benchmark datasets.

Introduction

In the era of visual big data, the ability to retrieve relevant images quickly from massive, ever-growing datasets is paramount. Image hashing, which maps high-dimensional visual features to compact binary codes, has emerged as a standard solution. However, most existing hashing algorithms are designed for static datasets. In real-world scenarios, data is often generated as a stream, necessitating online hashing methods that can update models incrementally without retraining from scratch.

The primary challenge in online hashing lies in balancing learning timeliness with model accuracy. Many supervised methods attempt to optimize complex objectives involving orthogonality or similarity preservation. These constraints are often mathematically intractable, leading researchers to use "relaxed" versions that result in significant quantization errors and accuracy loss. Furthermore, the computational burden of processing large batches of streaming data can hinder real-time performance.

Methodology

The proposed HMOH framework addresses these challenges by decoupling the generation of hash codes from the learning of hash functions.

Hadamard Matrix Guidance

The core innovation of HMOH is the use of a Hadamard matrix to provide optimal target codes. A Hadamard matrix is a square matrix with entries of +1 or -1 where every row and column is orthogonal. By assigning a unique column of this matrix as the target code for each class label, the model is provided with "perfect" targets from the outset. These codes are naturally balanced (containing equal numbers of +1s and -1s) and maximally distinct due to their orthogonality, which are ideal properties for discriminative hashing.

Hashing as Binary Classification

Unlike traditional methods that rely on complex regression to fit continuous values to binary targets, HMOH treats the learning of hash functions as a series of independent binary classification problems.

Regression vs. Classification

As illustrated above, a classifier is inherently more robust at finding a hyperplane to separate discrete binary data than linear regression. Regression attempts to minimize the distance to points, which is ill-suited for discrete +1/-1 values and often leads to higher quantization errors. By using classification, HMOH simplifies the optimization process and improves the discriminative power of the resulting hash codes.

The HMOH Framework and Ensemble Learning

To handle streaming data effectively, HMOH integrates these components into a unified pipeline that avoids the need for large-batch updates.

The HMOH Framework

As shown in the framework overview, as streaming data arrives (a), it is assigned target codes derived from the Hadamard matrix (b). Independent binary classifiers are then trained to predict each bit of the hash code (c). To prevent the model from "forgetting" past data—a common issue in online learning—HMOH utilizes an ensemble strategy. It maintains a weighted average of models learned at every time step, effectively integrating knowledge across the entire data stream without the overhead of re-processing old data.

Experimental Evaluation

The authors evaluated HMOH on four benchmark datasets: CIFAR-10, Places205, MNIST, and the multi-label NUS-WIDE dataset.

Performance and Efficiency

HMOH consistently outperformed state-of-the-art (SOTA) methods, including MIHash and BSODH. On CIFAR-10, HMOH achieved an average mean Average Precision (mAP) increase of 7.48% over the best baseline. The performance gains were particularly notable in low-bit scenarios (e.g., 8-bit), where the structural integrity of the Hadamard-guided codes provided a significant advantage.

In terms of efficiency, HMOH demonstrated a substantial reduction in training time. For instance, on CIFAR-10, HMOH processed the data stream in just 9.29 seconds, whereas MIHash required 120.10 seconds. This speedup is attributed to the simplicity of the independent binary classification tasks compared to the complex joint optimization required by other methods.

Conclusion

Hadamard Matrix Guided Online Hashing (HMOH) represents a significant advancement in supervised online hashing. By leveraging the mathematical properties of Hadamard matrices to pre-define optimal target codes, the method bypasses the optimization complexities that plague traditional approaches. The shift from regression to classification, combined with an effective ensemble strategy, allows HMOH to deliver superior retrieval accuracy and exceptional training efficiency, making it highly suitable for real-time visual search applications.

Summary updated

BibTeX
@article{lin2020hadamard,
  author = {Mingbao Lin and Rongrong Ji and Hong Liu and Xiaoshuai Sun and Shen Chen and Qi Tian},
  title = {{Hadamard Matrix Guided Online Hashing}},
  journal = {Int. J. Comput. Vis.},
  year = {2020},
  url = {https://openreview.net/forum?id=gM8sX8ocJ7},
}
Figure