HHF: Hashing-Guided Hinge Function for Deep Hashing Retrieval

Chengyin Xu, Zenghao Chai, Zhengzhuo Xu, Hongjia Li, Qiruyi Zuo, Lingyu Yang, Chun YuanIEEE Trans. Multimedia 2021

Abstract

Deep hashing has shown promising performance in large-scale image retrieval. However, latent codes extracted by Deep Neural Networks (DNNs) will inevitably lose semantic information during the binarization process, which damages retrieval accuracy. Although many existing approaches use regularization to alleviate quantization errors, there exists an incompatible conflict between metric learning and quantization learning. Metric loss penalizes inter-class distances to push different classes unconstrainedly far away, often mapping latent codes away from ideal binarization points and generating ambiguity. Based on the minimum distance of binary linear codes, we propose the Hashing-guided Hinge Function (HHF) to avoid such conflict. By using a carefully designed inflection point based on hash bit length and category numbers, HHF balances metric and quantization terms, preventing the network from falling into local metric optimal minima. Extensive experiments on CIFAR-10, CIFAR-100, ImageNet, and MS-COCO demonstrate that HHF consistently outperforms existing techniques and is highly flexible.

The Conflict in Deep Hashing

In large-scale image retrieval, representing images as short binary strings (hash codes) is essential for efficiency. Standard training typically involves two competing objectives:

  1. Metric Loss: Ensures semantic similarity by pulling same-class images together and pushing different classes apart.
  2. Quantization Loss: Forces continuous latent codes toward discrete binary values (e.g., -1 or +1).

The authors identify a fundamental conflict: metric losses often attempt to push different classes infinitely far apart. In a bounded binary space, this "tug-of-war" can push features away from ideal binary corners, leading to "error hashed" results where semantically distinct images are assigned incorrect codes despite being well-separated in the latent space.

Overview of the HHF pipeline and the conflict between metric and quantization losses.

Hashing-guided Hinge Function (HHF)

The core innovation is the Hashing-guided Hinge Function (HHF). Instead of standard linear or exponential penalties for class separation, HHF introduces a "hinge" at a specific inflection point $\zeta$.

The Inflection Point ($\zeta$)

Using the mathematical theory of binary linear codes, the authors calculate the minimum distance required to keep $C$ classes distinct in a $K$-bit space. Once two classes are separated by this distance $\zeta$, the metric loss stops pushing. This allows the quantization loss to take over and pull features into the nearest binary "corners" without interference from the repulsive forces of other classes.

Relaxation Margin ($\delta$)

To prevent intra-class collapse (overfitting), where the model tries to collapse all images of one class into a single point, a small margin $\delta$ is added to maintain a healthy distribution within each class.

Visualization of the HHF hinge function for negative and positive pairs, showing the inflection point $\zeta$ and margin $\delta$.

HHF is designed as a plug-and-play loss modification, compatible with existing state-of-the-art frameworks like Proxy-Anchor, Proxy-NCA, and DHN.

Experimental Results

The effectiveness of HHF was evaluated on standard benchmarks including CIFAR-10, CIFAR-100, ImageNet, and MS-COCO.

  • Significant Accuracy Gains: HHF consistently improved mean Average Precision (mAP). On CIFAR-100, it provided a 5.78% boost over previous methods. On ImageNet, adding HHF to the DHN baseline resulted in a staggering 21.33% mAP improvement.
  • Reduced Quantization Error: The Hash Position Error (HPE)—measuring the distance of latent codes from binary targets—dropped significantly. For instance, on ImageNet (16 bits), Proxy-NCA's HPE decreased from 1.858 to 1.334 when HHF was added.
  • Better Visual Separation: t-SNE visualizations confirm that HHF produces cleaner, better-separated clusters aligned with hashing targets compared to standard methods that often leave clusters "entangled."

Conclusion

HHF resolves the inherent conflict between metric and quantization learning by grounding the limits of class separation in coding theory. By preventing the "repulsive force" of metric loss from interfering with quantization once a sufficient distance is reached, HHF enables more accurate and robust deep hashing. Future work may explore dynamic adaptation of the inflection point $\zeta$ during the training process.

Summary updated

BibTeX
@article{xu2021hhf,
  author = {Chengyin Xu and Zenghao Chai and Zhengzhuo Xu and Hongjia Li and Qiruyi Zuo and Lingyu Yang and Chun Yuan},
  title = {{HHF: Hashing-Guided Hinge Function for Deep Hashing Retrieval}},
  journal = {IEEE Trans. Multimedia},
  year = {2021},
  url = {https://openreview.net/forum?id=7uZVK8UO2M},
}
Figure