Cross-Modal Hamming Hashing

Yue Cao, Bin Liu, Mingsheng Long, Jianmin Wang

Introduction

Cross-modal retrieval, such as finding images based on text queries, is a fundamental challenge in large-scale data management. Hashing techniques are typically employed to map high-dimensional data into compact binary codes, aiming for efficient search. Ideally, this allows for constant-time $O(1)$ retrieval within a small Hamming radius (typically $r \le 2$). However, existing methods often fail to concentrate semantically similar items within this searchable "Hamming ball" due to the heterogeneity gap between modalities and the limitations of standard loss functions. Cross-Modal Hamming Hashing (CMHH) addresses this by introducing a novel framework centered on exponential focal loss.

Methodology

The CMHH architecture consists of two primary branches: a Convolutional Neural Network (CNN) for image feature extraction and a Multilayer Perceptron (MLP) for text features. These features are mapped into a shared binary space through a series of fully connected layers.

The CMHH architecture featuring image and text branches with specialized loss functions.

The framework introduces two key loss functions to optimize the binary mapping:

  1. Exponential Focal Loss: Unlike traditional sigmoid-based losses, this function uses an exponential distribution to penalize similar pairs more aggressively when their Hamming distance exceeds the target radius. It also incorporates a focal element to prioritize "hard" pairs during training.
  2. Exponential Quantization Loss: This ensures that continuous network outputs are effectively mapped to discrete binary values (-1 or 1) with minimal information loss.

The Sigmoid Bottleneck and Exponential Solution

A critical insight of the paper is the failure of the sigmoid function in hashing. The sigmoid's gradient vanishes at small distances, failing to provide the necessary signal to push codes into the $r \le 2$ radius required for $O(1)$ lookup.

Analysis of Focal Loss and the comparison between Sigmoid and Exponential distributions in terms of probability and loss.

As shown in the loss analysis above, the exponential distribution (blue curve in plot b) provides a much sharper probability drop-off compared to the sigmoid (red curve), leading to a loss function (plot c) that forces a higher concentration of similar items within the searchable Hamming space. This concentration is what makes constant-time retrieval a reality.

Evaluation and Results

CMHH was evaluated on NUS-WIDE, MIRFlickr-25K, and IAPR TC-12 datasets. It achieved state-of-the-art results in both general retrieval (linear scan) and Hamming space retrieval.

  • General Retrieval: CMHH outperformed previous deep methods like DCMH by up to 5.0% in Mean Average Precision (MAP) on the IAPR TC-12 dataset.
  • Hamming Space Retrieval: On NUS-WIDE, CMHH maintained high precision and recall within a Hamming radius of 2, whereas competing methods saw recall drop to near zero as code lengths increased.

This demonstrates CMHH's ability to learn a truly isomorphic mapping between modalities that preserves semantic density in the binary space, even as the dimensionality of the hash codes grows.

Conclusion

CMHH significantly improves the feasibility of constant-time cross-modal retrieval. By rethinking the loss function through the lens of exponential distributions and focal learning, the model overcomes the "sigmoid bottleneck" that plagues traditional hashing methods. Future work may extend this approach to temporal modalities like video or explore unsupervised learning variants where labeled data is unavailable.

Summary updated

BibTeX
@inproceedings{cao2018cross,
  author = {Yue Cao and Bin Liu and Mingsheng Long and Jianmin Wang},
  title = {{Cross-Modal Hamming Hashing}},
  booktitle = {European Conference on Computer Vision},
  year = {2018},
  doi = {10.1007/978-3-030-01246-5\_13},
}
Figure