# Deep Class-Guided Hashing for Multi-Label Cross-Modal Retrieval
## 3 Methodology
### Optimization
Initially, we randomly selected 5000 image-text pairs from a dataset as the query set, with the remainder serving as the database set. During the model training phase, we randomly chose 10,000 image-text pairs as the training set. To ensure consistency and fairness in the experiments, we performed the same preprocessing operations on the images and text for all datasets: the image sizes were adjusted to 224 \(\times\) 224, and the text was represented through BPE [44] encoding. To ease reading, we report the detailed configuration of each of the components in the proposed DCGH framework in Table 3. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Dataset** & **Total** & **Training** & **Query** & **Retrieval** & **Categories** & **CLIP Feature** \\ \hline MIRFLICKR-25K & 24,581 & 10,000 & 5000 & 19,581 & 24 & 512 \\ NUS-WIDE & 195,834 & 10,000 & 5000 & 190,834 & 21 & 512 \\ MS COCO & 123,289 & 10,000 & 5000 & 118,289 & 80 & 512 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Statistics of MIRFLICKR-25K, NUS-WIDE, and MS COCO. Experimental environment. We implemented our DCGH via Pytorch, with a GPU leveraging NVIDIA RTX 3090. For the network configuration, the two Transformer encoders of DCGH, ViT [40] and GPT-2 [45], were initialized using pre-trained CLIP (ViT-B/32) [46]. Our model employs an adaptive moment estimation (Adam) optimizer to update the network parameters until convergence [47]. The learning rate of two backbone Transformer encoders, ViT and GPT-2, was set as 0.00001, while the learning rate of the hash learning module in DCGH was set to 0.001. The two hyperparameters, \(\alpha\) and \(\beta\), were set to 0.05 and 0.8, respectively. The batch size was 128. Baseline methods. In our experiments, we selected 14 state-of-the-art deep cross-modal hashing methods for comparison, which contain Deep Cross-Modal Hashing [23], Self-Supervised Adversarial Hashing [25], Cross-Modal Hamming Hash [48], Adversary Guided Asymmetric Hashing [49], Deep Adversarial Discrete Hashing [31], Self-Constraining Attention Hashing Network [9], Multi-label Enhancement Self-supervised Deep Cross-modal Hashing [26], Differentiable Cross-modal Hashing via Multi-modal Transformers [27], Modality-Invariant Asymmetric Networks [50], Data-Aware Proxy Hashing [21], Deep Semantic-aware Proxy Hashing [4], Deep Neighborhood-aware Proxy Hashing [22], Deep Hierarchy-aware Proxy Hashing [33], and Semantic Channel Hash [29]. Due to some methods not being open source, we directly cite the results from the published papers. Evaluation protocols. In our experiments, we employed five commonly used evaluation metrics to assess the performance of cross-modal similarity searches, which include mean Average Precision (mAP), Normalized Discounted Cumulative Gain using the top 1000 returned samples (NDCG@1000), Precision with a Hamming radius of 2 (P@H \(\leq\) 2) curve, Precision-Recall (PR) curve, and Precision@Top N curve. The mAP is calculated as the average of the AP across all query samples. The PR curve represents the variation curve between recall and precision. Top-N Precision curve illustrates the proportion of truly relevant data among the top N results returned by the system. NDCG@1000 is a comprehensive metric that assesses the ranking performance of the top 1000 retrieval results. Precision with a Hamming radius of 2 describes the precision of the samples retrieved within the specified Hamming radius. The experimental results from the aforementioned evaluation metrics demonstrate that the DCGH method achieves excellent performance in cross-modal similarity searches. ### Performance Comparison

We validated the performance of DCGH by comparing it with state-of-the-art deep cross-modal hashing methods on image-text retrieval tasks across three public datasets. The mAP results are shown in Table 4, where \"Img2 txt\" indicates image-to-text retrieval, and \"Txt2 Img\" indicates text-to-image retrieval. In most cases, DCGH outperforms other baseline methods, achieving satisfactory performance.