Deep Supervised Hashing for Fast Image Retrieval

Haomiao Liu, Ruiping Wang, Shiguang Shan, Xilin Chen

Introduction

In the era of large-scale visual data, efficient image retrieval is a critical challenge. Standard real-valued features extracted from Convolutional Neural Networks (CNNs), while semantically rich, are computationally expensive and memory-intensive for searching through millions of images. Hashing techniques address this by mapping images to compact binary strings, enabling rapid searches using Hamming distance. However, traditional hashing often relies on hand-crafted features that fail to capture complex semantic relationships. While deep hashing methods have emerged, they frequently struggle with the "quantization" problem—training a continuous network to produce discrete binary outputs without inducing vanishing gradients.

Methodology

The authors propose Deep Supervised Hashing (DSH), an end-to-end framework that learns image representations and hash functions simultaneously.

Architecture

The DSH architecture consists of three convolutional layers followed by two fully connected layers. It is designed to take pairs of images as input and produce compact binary codes directly from raw pixels.

Overview of the Deep Supervised Hashing (DSH) architecture.

Loss Function and Relaxation Strategy

The core innovation of DSH lies in its specialized loss function, which combines pairwise supervision with a novel regularization term:

  1. Pairwise Supervision: The network is trained using pairs of images labeled as "similar" or "dissimilar." The loss function minimizes the distance between codes of similar images while enforcing a margin between dissimilar ones.
  2. The Binary-like Regularizer: To avoid the vanishing gradient issues associated with saturating non-linearities like sigmoid or tanh, the authors allow the network to output real values. They introduce an L1-norm regularizer, $\alpha(|| |b| - 1 ||_1)$, which penalizes outputs that deviate from $+1$ or $-1$. This "nudges" continuous values toward discrete bits during training while maintaining healthy gradients for backpropagation.
Effect of the regularizer on the distribution of output values. Top row (a-d) shows the proposed regularizer with increasing $\alpha$; bottom row (e-h) shows traditional sigmoid activations.

Online Pair Generation

To enhance training efficiency, DSH employs online pair generation. Instead of pre-calculating static image pairs, the model generates all possible pairs within each mini-batch on the fly. This approach provides denser supervision and significantly faster convergence compared to traditional Siamese methods.

Experimental Evaluation

DSH was evaluated on two benchmark datasets: CIFAR-10 (60,000 images, 10 categories) and NUS-WIDE (~270,000 images, 81 concepts).

Performance and Accuracy

DSH demonstrated superior accuracy across both datasets. On CIFAR-10, DSH achieved a Mean Average Precision (mAP) of 0.6755 for 48-bit codes, significantly outperforming traditional methods like Locality Sensitive Hashing (LSH, 0.1492) and competing deep methods like DNNH (0.5904). Precision-recall curves further indicated that DSH maintains high precision even at high recall levels, suggesting a well-structured Hamming space.

Computational Efficiency

By integrating feature extraction and hashing into a single pass, DSH is approximately 10x faster than methods requiring separate hand-crafted feature computation (e.g., GIST). On a GPU, the encoding process takes roughly 0.1 milliseconds per image.

Conclusion

Deep Supervised Hashing (DSH) effectively bridges the gap between continuous deep learning and discrete binary encoding. By replacing saturating activations with a simple L1 penalty, DSH avoids the "sigmoid trap" and achieves state-of-the-art retrieval performance. Future work may explore deeper architectures like ResNet or the integration of triplet loss to further refine semantic rankings in the Hamming space.

Summary updated

BibTeX
@inproceedings{liu2016deep,
  author = {Haomiao Liu and Ruiping Wang and Shiguang Shan and Xilin Chen},
  title = {{Deep Supervised Hashing for Fast Image Retrieval}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2016},
  doi = {10.1109/cvpr.2016.227},
}
Figure