[Paper Review] One Loss for All: Deep Hashing with a Single Cosine Similarity based Learning Objective
The paper introduces OrthoHash, a deep hashing model that uses a single cosine-similarity-based objective to jointly achieve discriminative hash codes and minimized quantization error, with BN for code balance and label smoothing for multi-labels.
A deep hashing model typically has two main learning objectives: to make the learned binary hash codes discriminative and to minimize a quantization error. With further constraints such as bit balance and code orthogonality, it is not uncommon for existing models to employ a large number (>4) of losses. This leads to difficulties in model training and subsequently impedes their effectiveness. In this work, we propose a novel deep hashing model with only a single learning objective. Specifically, we show that maximizing the cosine similarity between the continuous codes and their corresponding binary orthogonal codes can ensure both hash code discriminativeness and quantization error minimization. Further, with this learning objective, code balancing can be achieved by simply using a Batch Normalization (BN) layer and multi-label classification is also straightforward with label smoothing. The result is an one-loss deep hashing model that removes all the hassles of tuning the weights of various losses. Importantly, extensive experiments show that our model is highly effective, outperforming the state-of-the-art multi-loss hashing models on three large-scale instance retrieval benchmarks, often by significant margins. Code is available at https://github.com/kamwoh/orthohash
Motivation & Objective
- Motivate simplifying deep hashing optimization by unifying objectives into one learning signal.
- Show that maximizing cosine similarity between continuous codes and binary orthogonal targets can achieve discriminativeness and quantization minimization.
- Demonstrate that code balancing can be achieved via Batch Normalization and that multi-label learning can use label smoothing within a single loss.
- Evaluate the proposed approach on large-scale category-level and instance-level retrieval benchmarks to establish state-of-the-art performance.
Proposed method
- Reformulate hashing as maximizing cosine similarity between continuous codes and binary orthogonal targets under a cross-entropy loss.
- Use L2 normalization on continuous codes so the cosine similarity governs retrieval and quantization behavior.
- Employ binary orthogonal targets (Hadamard-like) to maximize inter-class Hamming distance.
- Incorporate label smoothing to adapt cross-entropy to multi-label settings.
- Add a Batch Normalization layer after the continuous codes to enforce code balance without extra loss terms.
- Optionally apply cosine or angular margin to tighten intra-class variance (CosFace/ArcFace-inspired).
Experimental results
Research questions
- RQ1Can a single cosine-similarity-based objective jointly ensure hash code discriminativeness and low quantization error without multiple loss terms?
- RQ2How do binary orthogonal targets and BN affect code balance and retrieval performance across category- and instance-level tasks?
- RQ3What is the impact of cosine/angular margins and label smoothing on multi-label hashing performance?
- RQ4Do the proposed OrthoHash variants outperform state-of-the-art multi-loss hashing methods on large-scale benchmarks?
Key findings
- OrthoCos+BN and OrthoArc+BN achieve competitive to state-of-the-art results on ImageNet100, NUS-WIDE, and MS-COCO for category-level retrieval.
- On large-scale instance-level retrieval (GLDv2, R@Oxf Hard, R@Paris Hard), OrthoCos+BN outperforms previous deep hashing methods across all three datasets and bit lengths tested, with notable gains (e.g., up to 0.6%, 9.1%, and 17.1% for 128-bit codes).
- Code balancing via Batch Normalization yields substantial improvements (5-20%) over basic CE-based models across datasets and bit-lengths.
- Cosine margin provides slight gains over angular margin in most settings.
- Using BN after the continuous codes enables end-to-end training without modifying the computation graph, simplifying optimization.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.