Push for Quantization: Deep Fisher Hashing

Yunqiang Li, Wenjie Pei, Yufei Zha, Jan van Gemert · OpenReview

Deep learning models for image hashing typically train in a continuous space and round to binary codes later, a process that can accidentally destroy class separability. This paper introduces Deep Fisher Hashing, a novel approach that optimizes class separability directly in the discrete binary space using a Fisher LDA-inspired objective and a pairwise margin loss, resulting in highly accurate and compact hash codes.

What Problem Does This Paper Address?

Image hashing maps high-dimensional images into compact binary codes (e.g., 12 or 32 bits) so they can be stored efficiently and searched rapidly using Hamming distance. To get the best representations, we want to use deep neural networks. However, neural networks rely on gradient descent, which requires continuous derivatives. Binary codes are discrete (e.g., -1 or 1) and non-differentiable.

The standard workaround is to "relax" the problem: train the network to output continuous values, and then apply a sign() function at the very end to quantize them into binary codes. The fatal flaw here is that two classes might be perfectly separable in a continuous space, but once forced into a rigid binary grid, they can collapse into the same bins and become inseparable. This paper tackles the challenge of incorporating the quantization step directly into the optimization process so that the final binary codes remain strictly separable.

Fisher LDA-inspired class separation

Methods

The authors propose a joint framework with two main modules, optimized in an alternating fashion to handle both continuous network weights and discrete binary codes:

The Deep Fisher Hashing framework
  1. Pairwise Similarity Learning: This module preserves semantic similarity between image pairs. It uses a symmetric large-margin logistic loss to pull similar images together and push dissimilar images apart. Crucially, this margin is explicitly measured in the binary space, ensuring that dissimilar images don't just differ slightly, but differ by a robust number of bit flips.
  2. Quantized Center Learning: Inspired by Fisher’s Linear Discriminant Analysis (LDA), this module learns a distinct binary center for each class. It enforces two rules:
  3. Minimize intra-class distance: Force the binary codes of images to be as close to their respective binary class center as possible.
  4. Maximize inter-class distance: Push the binary class centers as far apart from each other as possible.
  5. Alternating Optimization: Because the loss functions contain both continuous variables (CNN outputs) and discrete variables (the binary codes and class centers), the authors use an alternating optimization strategy. They freeze the discrete variables to update the CNN via standard backpropagation, and then freeze the CNN to update the discrete codes and centers using closed-form mathematical solutions.

Datasets

The authors evaluated their method on three standard image retrieval benchmarks:

  • CIFAR-10: 60,000 images across 10 mutually exclusive classes.
  • NUS-WIDE: A multi-label dataset of ~270,000 Flickr images (using a 21-concept subset for evaluation).
  • ImageNet100: A subset of the massive ImageNet database containing 130,000 single-labeled images across 100 categories.

Key Insights and Ideas

  • Quantization is not an afterthought: By forcing the network to care about the discrete grid during training, the model learns to translate continuous feature clusters directly onto distinct binary vertices. The shape of the class distribution remains intact, but it is safely anchored to a specific binary code.
  • Fisher LDA works beautifully for hashing: The classic Fisher criterion (tight clusters, far apart) is highly effective for binary spaces. By learning explicit binary centers for each class, the model gains a global view of the data distribution, which prevents the collapse of different classes into the same hash buckets.
  • Local + Global Supervision: The Pairwise module handles local relationships (image A is similar to image B), while the Center module handles global structure (Class A is far from Class B).

Key Results

Deep Fisher Hashing outperforms several state-of-the-art methods (like DSDH, Greedy Hash, and DPSH), particularly when the hash codes are very short (e.g., 12 or 16 bits).

  • On CIFAR-10 (12 bits), the method achieved a Mean Average Precision (MAP) of 0.803, compared to the previous best of 0.774 (Greedy Hash).
  • On NUS-WIDE (12 bits), it achieved a MAP of 0.795, beating DSDH's 0.776.
  • On ImageNet100 (32 bits), it achieved a MAP@1K of 0.697, outperforming Greedy Hash's 0.662.

Limitations and Future Work

  • Diminishing returns at higher bit lengths: The approach truly shines in highly constrained environments where only tiny bit codes (12-16 bits) are permissible. For larger hash codes (e.g., 48+ bits), the performance gains are less significant.
  • Pairwise sampling sensitivity: While the Quantized Center module helps mitigate it, the Pairwise Similarity module is still fundamentally sensitive to the balance between positive and negative training pairs.

Summary updated

BibTeX
@inproceedings{li2019push,
  author = {Yunqiang Li and Wenjie Pei and Yufei Zha and Jan van Gemert},
  title = {{Push for Quantization: Deep Fisher Hashing}},
  booktitle = {BMVC},
  year = {2019},
  url = {https://openreview.net/forum?id=Qf-JeCoTS2k},
}
Figure