Abstract
Large-scale image retrieval often relies on binary hashing to compress high-dimensional features into compact bitstrings for efficient search. However, binary quantization forces a hard threshold that can lead to neighborhood ambiguity for features near the decision boundary. This paper introduces "Ternary Hashing," a novel scheme that incorporates a third "UNKNOWN" state to handle ambiguous data points. By leveraging formal ternary logic (Kleene and Łukasiewicz), the proposed method significantly reduces quantization error and improves retrieval accuracy (mAP) by up to 5.9% on standard benchmarks like ImageNet100.
Introduction
In the domain of large-scale image retrieval, binary hashing has long been the standard for balancing search speed and memory efficiency. By mapping complex image features into strings of 0s and 1s, similarity search is reduced to calculating Hamming distances. However, this binary approach suffers from significant quantization error. Features that fall near the decision threshold are assigned disparate codes despite being nearly identical in the original feature space, leading to "neighborhood ambiguity."
Methodology: From Bits to Trits
The proposed Ternary Hashing framework addresses this by introducing a third state—UNKNOWN (0)—alongside the traditional -1 and 1. This creates a buffer zone for ambiguous features.
Double-Threshold Mapping
Instead of a single split point, the system employs a double-thresholding strategy ($t^1$ and $t^2$). Values falling between these thresholds are assigned the neutral state 0. This mapping, $\phi_t(u, t^1, t^2)$, effectively downweights the importance of bits that were uncertain during encoding.
Ternary Hamming Distance (THD)
To compare these ternary codes, the authors utilize axiomatic ternary logic, specifically Kleene and Łukasiewicz logic. These systems define operations like AND, OR, and EQUIVALENCE in the presence of a neutral state. Kleene logic, in particular, was found to be superior as it assigns a distance of 0.5 between two UNKNOWN states, avoiding overconfidence in ambiguous data.
Experimental Results
The effectiveness of ternary hashing was evaluated as a post-processing step across several deep hashing architectures, including HashNet and GreedyHash, using benchmarks such as CIFAR-10, NUS-WIDE, and ImageNet100.
Performance Gains
Ternary hashing consistently outperformed binary methods. The most notable improvements were observed on the ImageNet100 dataset, where mean Average Precision (mAP) increased by up to 5.9%, particularly for shorter code lengths (e.g., 16 bits).
Efficiency and Separability
Visualization of Hamming distance distributions confirms that ternary hashing reduces the overlap between positive and negative sample histograms, enhancing the system's discriminative power. Furthermore, the Ternary Hamming Distance can be computed efficiently on binary hardware using bitwise XOR and OR operations, maintaining the speed advantages of traditional hashing.
Conclusion
Ternary Hashing provides a principled, logic-based framework for reducing quantization error in image retrieval. By embracing the "UNKNOWN" state, the method achieves significant accuracy boosts with minimal computational overhead. Future work includes integrating threshold optimization directly into end-to-end neural network training and exploring native ternary hardware implementations like FPGAs.
Summary updated