Abstract
Due to its low storage cost and fast query speed, hashing has been widely used in large-scale image retrieval tasks. Hash bucket search returns data points within a given Hamming radius to each query, which can enable search at a constant or sub-linear time cost. However, existing hashing methods cannot achieve satisfactory retrieval performance for hash bucket search in complex scenarios, since they learn only one hash code for each image. More specifically, by using one hash code to represent one image, existing methods might fail to put similar image pairs to the buckets with a small Hamming distance to the query when the semantic information of images is complex. As a result, a large number of hash buckets need to be visited for retrieving similar images, based on the learned codes. This will deteriorate the efficiency of hash bucket search. In this paper, we propose a novel hashing framework, called multiple code hashing (MCH), to improve the performance of hash bucket search. The main idea of MCH is to learn multiple hash codes for each image, with each code representing a different region of the image. Furthermore, we propose a deep reinforcement learning algorithm to learn the parameters in MCH. To the best of our knowledge, this is the first work that proposes to learn multiple hash codes for each image in image retrieval. Experiments demonstrate that MCH can achieve a significant improvement in hash bucket search, compared with existing methods that learn only one hash code for each image.
Introduction: The Limitation of Single-Code Hashing
In large-scale image retrieval, efficiency is paramount. Hashing techniques address this by mapping high-dimensional image features into compact binary codes, enabling "hash bucket search." This process allows systems to retrieve images within a small Hamming radius of a query in constant or sub-linear time.
However, a fundamental bottleneck exists in current state-of-the-art methods: the "one-code-fits-all" approach. Most existing algorithms assign exactly one hash code to an entire image. While this works for simple subjects, it fails for semantically complex scenes containing multiple objects (e.g., a dog and a cat). If an image is represented by a single code that leans toward one semantic cluster, it may become unreachable for queries targeting other objects in the scene unless the search radius is expanded significantly, which destroys retrieval efficiency.
Methodology: Multiple Code Hashing (MCH)
To overcome this, we propose Multiple Code Hashing (MCH). Instead of compressing an entire image into one code, MCH learns multiple hash codes per image, where each code represents a distinct semantic region. This ensures that a multi-object image can reside in multiple hash buckets, making it easily discoverable by diverse queries.
The Two-Step Learning Framework
The MCH framework consists of two primary stages:
- Base Hashing Model Learning: MCH is designed as a flexible wrapper. It can utilize various existing hashing models (such as HashNet or ADSH) to generate initial codes for both the global image and candidate local regions.
- Agent Learning Step: Not every region of an image provides useful semantic information. To optimize storage and efficiency, we employ Deep Reinforcement Learning (DRL) to select which regions deserve their own hash codes. A policy network (agent) analyzes the features and codes of the global image and a candidate region to decide whether to keep or discard the region's code based on a reward function that prioritizes similarity preservation.
Experimental Results
We evaluated MCH on three benchmark datasets: NUS-WIDE, MS-COCO, and MIR FLICKR. By integrating MCH with five different state-of-the-art hashing algorithms, we observed consistent performance gains across the board.
- Improved Recall: On MS-COCO, MCH-based methods achieved significantly higher recall at a Hamming radius of 0 compared to their single-code counterparts.
- Search Efficiency: The F1-bucket curves demonstrate that MCH reaches peak retrieval performance while visiting far fewer hash buckets. This indicates that MCH effectively places complex images into the most relevant buckets for their constituent objects.
- Qualitative Success: Visualizations confirm that for images with multiple labels (e.g., "bird" and "airplane"), MCH allows the image to be retrieved at a Hamming distance of 0 for both categories, whereas single-code methods typically fail on at least one.
Conclusion
Multiple Code Hashing represents a paradigm shift in image retrieval by acknowledging that a single binary string cannot capture the full semantic breadth of complex scenes. By leveraging Deep Reinforcement Learning to selectively hash image regions, MCH significantly improves the efficiency and accuracy of hash bucket searches. While this approach introduces a trade-off in storage overhead, the resulting gains in query-time performance make it a compelling solution for real-world, large-scale retrieval systems.
Summary updated