Image Hashing by Minimizing Independent Relaxed Wasserstein Distance

Khoa D. Doan, Amir Kimiyaie, Saurav Manchanda, Chandan K. ReddyarXiv 2020

Abstract

Image hashing is one of the fundamental problems that demand both efficient and effective solutions for various practical scenarios. Adversarial autoencoders are shown to be able to implicitly learn a robust, locality-preserving hash function that generates balanced and high-quality hash codes. However, the existing adversarial hashing methods are inefficient to be employed for large-scale image retrieval applications. Specifically, they require an exponential number of samples to be able to generate optimal hash codes and a significantly high computational cost to train. In this paper, we show that the high sample-complexity requirement often results in sub-optimal retrieval performance of the adversarial hashing methods. To address this challenge, we propose a new adversarial-autoencoder hashing approach that has a much lower sample requirement and computational cost. Specifically, by exploiting the desired properties of the hash function in the low-dimensional, discrete space, our method efficiently estimates a better variant of Wasserstein distance by averaging a set of easy-to-compute one-dimensional Wasserstein distances. The resulting hashing approach has an order-of-magnitude better sample complexity, thus better generalization property, compared to the other adversarial hashing methods. In addition, the computational cost is significantly reduced using our approach. We conduct experiments on several real-world datasets and show that the proposed method outperforms the competing hashing methods, achieving up to 10% improvement over the current state-of-the-art image hashing methods. The code accompanying this paper is available on Github (https://github.com/khoadoan/adversarial-hashing).

Introduction

In the era of massive visual databases, finding similar images quickly requires efficient hashing: projecting high-dimensional images into short, binary codes (e.g., 32 or 64 bits). This allows for lightning-fast searches using Hamming distance. Recently, researchers have used Adversarial Autoencoders (AAEs) to learn these hash functions by forcing the autoencoder's latent space to match a discrete prior distribution.

However, existing AAE methods struggle with two primary issues. First, standard distance metrics like Wasserstein distance (Optimal Transport) require an exponential number of samples to accurately estimate the target distribution in high dimensions, leading to poor generalization. Second, solving the Optimal Transport problem is mathematically expensive, making training slow for large-scale applications. This paper introduces the Discrete Component-wise Wasserstein Autoencoder (DCW-AE) to address these challenges.

The DCW-AE Framework

The core innovation of DCW-AE is the Component-wise Wasserstein Distance ($L_G$). Instead of calculating a complex distance in high-dimensional space, the model projects the data onto each individual dimension (axis) and calculates the 1D Wasserstein distance for each, then averages them. This is particularly effective for hashing, where the target is a hypercube with independent bits.

Overview of the DCW-AE architecture during training and hashing phases.

As shown in the architecture, the model utilizes a standard feature extractor followed by an encoder $f$ to produce continuous probabilities, which are later thresholded into bits. A decoder $g$ ensures that the hash codes preserve the original image's content through a reconstruction loss $L_A$. The adversarial matching loss $L_G$ ensures the latent distribution $P_b$ matches the discrete Bernoulli prior $P_z$.

Theoretical Insights: The Axis-Aligned Advantage

While methods like Sliced Wasserstein Distance (SWD) use many random projections, DCW-AE uses fixed, axis-aligned projections. Because the target distribution in hashing is a discrete hypercube, these axes are naturally the most discriminative directions for separating points toward the "corners" of the discrete space.

Visualization of the axis-aligned advantage in 1-D Wasserstein distance estimation.

This approach offers a significant advantage in sample complexity. Because 1D distances are easier to estimate than high-dimensional ones, the model requires an order-of-magnitude fewer samples to understand the target distribution. Furthermore, calculating 1D Wasserstein distance is computationally efficient, reducing complexity from roughly $O(N^{2.5})$ to $O(N \log N)$.

Experimental Results

The model was evaluated on four standard benchmarks: MNIST, CIFAR10, FLICKR25K, and the massive PLACE365 dataset.

  • Retrieval Accuracy: DCW-AE consistently outperformed baselines (including WGAN-AE and OT-AE), achieving a relative improvement of over 10% in Mean Average Precision (MAP) on CIFAR10 and FLICKR25K.
  • Training Speed: On the PLACE365 dataset, DCW-AE was roughly 3x faster to train than OT-AE.
  • Stability: Unlike standard GANs that use unstable discriminators, DCW-AE directly minimizes a distance, leading to more stable training and predictable loss descent.

Conclusion

DCW-AE provides a highly efficient and effective solution for unsupervised image hashing. By leveraging axis-aligned 1D Wasserstein distances, it achieves superior retrieval accuracy and significantly faster training times than existing adversarial methods. Future work may explore incorporating supervision or more complex priors to further improve performance.

Summary updated

BibTeX
@misc{doan2020image,
  author = {Khoa D. Doan and Amir Kimiyaie and Saurav Manchanda and Chandan K. Reddy},
  title = {{Image Hashing by Minimizing Independent Relaxed Wasserstein Distance}},
  year = {2020},
  eprint = {2003.00134},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2003.00134},
}
Figure