# Deep Class-Guided Hashing for Multi-Label Cross-Modal Retrieval
## 3 Methodology
### Optimization  
The training algorithm is a critical component of our proposed DCGH framework and is presented in Algorithm 1. The DCGH model is optimized by standard backpropagation algorithms and mini-batch gradient descent methods. The algorithm for generating the hash code is shown in Algorithm 2. For a query sample, use the well-trained DCGH model to generate binary-like hash codes and then use the sign function to generate the final binary hash codes. \[\text{sign}(x)=\left\{ \begin{array}{l}+1,x>0\\ -1,x<0\end{array} \right. \tag{13}\]  
Specifically, when given the query data, \(x_{i}(y_{i})\), the compact hash code can be generated by Equation (14). \[ \begin{split} b_{i}^{x}&=\text{sign}(H^{x}(x_{i}))\\ & b_{i}^{y}&=\text{sign}(H^{y}(y_{i}))\end{split}  \tag{14}\]  
```
0: Training dataset \(D\); Binary codes length \(K\); Hyperparameters: \(\alpha\), \(\beta\). 0: Network Parameters: \(\theta_{x}\), \(\theta_{y}\). 1: Initialize network parameters \(\theta_{x}\) and \(\theta_{y}\), maximum iteration number \(epoch\), mini-batch size 128, proxies \(P=\{p_{1},p_{2},\ldots p_{C}\}\). 2: Construct a similarity matrix \(S\) from multi-label set \(\{I_{i}\}_{i=1}^{N}\);
3:while\(iter<epoch\)do
4: Capture feature vector \(F^{x}\) and \(F^{y}\) by forward propagation. 5: Compute proxy loss \(\mathcal{L}_{\text{proxy}}\) by Equation (4). 6: Compute pairwise loss \(\mathcal{L}_{\text{pair}}\) by Equation (9). 7: Compute Variance Constraint \(\mathcal{L}_{\text{var}}\) by Equation (12). 8: Update proxies \(P=\{p_{1},p_{2},\ldots p_{C}\}\) by back propagations. 9: Update the network parameters \(\theta_{x}\) and \(\theta_{y}\) by back propagations. 10:endwhile
11:return The trained DCGH model. ```  
**Algorithm 1** Learning algorithm for DCGH```
0: Query samples \(q_{i}\), Parameters for DCGH. 0: Binary hash code for \(q_{i}\). 1: Calculating binary-like hash codes by feeding the query data \(q_{i}\) into the trained DCGH model. 2: Calculating hash codes by using the sign function. ```

**Algorithm 2** Learning hash codes for DCGH

## 4 Experiments

In this section, we will present and analyze the experimental results of the proposed method alongside those of several state-of-the-art competitors. Firstly, the details of the experimental setting are introduced in Section 4.1. We then proceed to discuss performance comparison, ablation studies, sensitivity to parameters, training and encoding time, and visualization in Section 4.2, Section 4.3, Section 4.4, Section 4.5 and Section 4.6, respectively. ### Experimental Setting

Datasets. Our experiments were conducted on three commonly used benchmark datasets, i.e., MIRFLICKR-25K [41], NUS-WIDE [42], and MS COCO [43]. A brief introduction to them is listed here:

* MIRFLICKR-25K: This is a small-scale cross-modal multi-label dataset collected from the Flickr website. It includes 24,581 image-text pairs corresponding to 24 classes, in which each sample pair belongs to at least one category. * NUS-WIDE: This dataset contains 269,648 image-text pairs, and each of them belongs to at least 1 of the 81 categories. To enhance the dataset's practicality and compatibility with other research methods, we conducted a selection process, removing categories with fewer samples and choosing 21 common categories. This subset contains 195,834 image-text pairs, with each pair belonging to at least one of the categories. * MS COCO: This dataset is a highly popular large-scale dataset in computer vision research. Comprising 82,785 training images and 40,504 validation images, each image is accompanied by corresponding textual descriptions and labels. It covers 80 different categories. In our study, the training and validation sets were combined, with each sample containing both image and text modalities, and each sample belongs to at least one category. The statistics of these three datasets are reported in Table 2.

Implementation details. In our experiments, we implemented a unified sampling strategy across the three datasets.