# Deep Unsupervised Hashing for Large-Scale Cross-Modal Retrieval Using Knowledge Distillation Model

Authors: Mingyong Li; Qiqi Li; Lirong Tang; Shuang Peng; Yan Ma; Degang Yang
Journal: Computational Intelligence and Neuroscience
 (2021)

---

## Abstract

Cross-modal hashing encodes heterogeneous multimedia data into compact binary code to achieve fast and flexible retrieval across different modalities. Due to its low storage cost and high retrieval efficiency, it has received widespread attention. Supervised deep hashing significantly improves search performance and usually yields more accurate results, but requires a lot of manual annotation of the data. In contrast, unsupervised deep hashing is difficult to achieve satisfactory performance due to the lack of reliable supervisory information. To solve this problem, inspired by knowledge distillation, we propose a novel unsupervised knowledge distillation cross-modal hashing method based on semantic alignment (SAKDH), which can reconstruct the similarity matrix using the hidden correlation information of the pretrained unsupervised teacher model, and the reconstructed similarity matrix can be used to guide the supervised student model. Specifically, firstly, the teacher model adopted an unsupervised semantic alignment hashing method, which can construct a modal fusion similarity matrix. Secondly, under the supervision of teacher model distillation information, the student model can generate more discriminative hash codes. Experimental results on two extensive benchmark datasets (MIRFLICKR-25K and NUS-WIDE) show that compared to several representative unsupervised cross-modal hashing methods, the mean average precision (MAP) of our proposed method has achieved a significant improvement. It fully reflects its effectiveness in large-scale cross-modal data retrieval.


---

## Body

## 1. Introduction

At present, the mobile Internet and social networks are developing rapidly, and smart terminals, video surveillance, etc., are widely used, so massive multimedia data (images, texts, videos, audios, etc.) are generated every day. Therefore, cross-modal retrieval [1–5] has received extensive attention and applications. The goal of cross-modal retrieval is to search for semantically related instances from different modalities, for example, using text instances as query points to find images with the same semantics. In order to meet the retrieval requirements of fast retrieval speed and small storage space in the real world, the hashing method uses binary hash code to represent the original data, and the time complexity can reach constant or sublinear in the application of approximate nearest neighbor search. It is widely used for cross-modal retrieval.Cross-modal hashing [1, 5–8] is one of the most popular retrieval methods, which maps large-scale high-dimensional cross-modal data to a common binary hash space. By compressing each instance into a short binary code, the cross-modal hash method greatly improves retrieval speed and storage efficiency. According to whether to use supervised information, cross-modal hashing can be divided into two methods: unsupervised and supervised methods. Supervised methods’ [3, 6, 9] manual labeling requires expensive labor costs and calculations, and semantic labels can be further used to learn more consistent hash codes for semantically related cross-modal data, which usually produces more accurate results. The unsupervised method [7, 10, 11] greatly reduces the computational cost and is easier to deploy to actual scenarios, while achieves lower performance.In recent years, due to the excellent performance of deep neural network in many classical scenarios [12, 13], it can be used as a nonlinear hash function to realize end-to-end feature representation and hashing coding, so deep cross-modal hashing has attracted more and more attention and gained great development. Compared with the shallow method using manually extracted features to learn the hash code, the deep cross-modal hash method [2, 5, 14, 15] directly learns the mapping function from the original data to the hamming space, which is more effective in finding the potential relationship between the original data and the hashing code.Although unsupervised cross-modal hashing has advantages in reducing the burden of manual annotation of data and is more widely used in real-world scenarios, its accuracy is often less than satisfactory, especially when compared with supervised methods. The main reason is the lack of pairwise similarity knowledge of training data pairs. The output of unsupervised models usually contains some inaccurate semantic information. Therefore, we focus on improving the accuracy of unsupervised learning methods, which have a wider range of applications in the real world.In this paper, we propose a novel unsupervised cross-modal hashing method based on semantic alignment using knowledge distillation (SAKDH), which solves the problem of lack of supervised information by distilling data pairs with reliable semantic similarity. Specifically, our approach consists of two modules: the teacher module is an unsupervised module, and the student module is a supervised module; the teacher module gets the distillation data, which is then used to supervise the training of the student module.Drawing on the idea of knowledge distillation, we use the teacher and student model to combine the advantages of both approaches (supervised and unsupervised). In the supervised methods, the most important information is the similarity between each pair of cross-modal data. After training, the unsupervised teacher model can output the feature vectors of each instance, and the similar information can be obtained by calculating the distance between their feature vectors. In short, the main contributions of this paper are as follows:(1)
We migrated knowledge distillation into the CMH scenario and proposed a novel unsupervised deep cross-modal hashing approach, which can reconstruct the similarity matrix using the hidden correlation information of the pretrained unsupervised teacher model, and the reconstructed similarity matrix can be used to guide the supervised student model. This is a novel method of using unsupervised methods to guide supervised CMH.(2)
An unsupervised semantic alignment hashing method is adopted for the teacher model, which can enhance the discrimination ability of the hash code. The student model adopts the joint loss of pairwise and triplet; these loss functions apply not only to intermodal, but also to intramodal. This can make the original semantically related instances, and its hash code also retains the semantic relevance well.(3)
Experimental results on two extensive benchmark datasets (MIRFLICKR-25K and NUS-WIDE) show that compared to several representative unsupervised cross-modal hashing methods, the Mean Average Precision (MAP) of our proposed method has achieved a significant improvement. It fully reflects its effectiveness in large-scale cross-modal data retrieval.


## 2. Related Work

Cross-modal retrieval methods can be divided into two categories: unsupervised methods and supervised methods. Supervised CMH methods [9, 16–20] generally use the label information of the input image-text pair to maximize their semantic similarities in the hamming space and use some methods to make the difference modalities learn a unified hash code, which is effective in cross-modal retrieval, and has been extensively studied. Because of the excellent performance of deep neural networks in nonlinear representation learning, many supervised deep cross-modal hashing methods [15, 21] have achieved excellent performance in cross-modal retrieval tasks. These supervised methods can obtain relevant information from semantic labels of images and text, thus achieving better performance. However, obtaining large numbers of such labels is often expensive and tricky, making the supervised approach impractical in real-world applications. Compared with the supervised method, the unsupervised cross-modal methods [10, 22, 23] does not rely on semantic tags during the training process, making it easier to deploy to actual scenarios. However, it is more difficult to learn, and related research is relatively insufficient.


### 2.1. Unsupervised Shallow Cross-Modal Hashing

Unsupervised cross-modal hashing methods can be divided into shallow methods and deep methods. CVH [7] is a representative of the early shallow unsupervised methods, using cross-view hashing to learn shallow hash functions. IMH [11] uses spectral hashing to transform heterogeneous cross-modal data into hamming space for unified learning. CMFH [24] learns a unified hash code by collaboratively decomposing the feature matrix of cross-modal data. CCQ [25] jointly finds the correlation maximum mapping that transforms different modalities into isomorphic potential spaces and learns the compound quantizer that transforms isomorphic potential features into compact binary codes. LSSH [26] uses sparse coding to capture the salient structure of the image and obtains the underlying concepts of the text through matrix decomposition, exploring the semantic information hidden in the data. These methods cannot effectively capture the complex nonlinear mapping of different modal data to the hamming space, so many unsupervised cross-modal methods introduce deep neural networks into the learning of hash codes to construct a nonlinear mapping from data to hash codes.


### 2.2. Unsupervised Deep Cross-Modal Hashing

With the development of deep learning, deep cross-modal hashing methods have become mainstream in recent years [10, 22, 23, 27–30]. DBRC [31] proposes deep binary reconstruction cross-modal hashing to maintain consistency within and between modalities. UDCMH [28] jointly optimizes the feature learning and binarization process and learns a unified binary code. DJSRH [29] constructs a joint semantic similarity matrix based on the neighborhood information of different modalities and proposes deep joint semantic reconstruction hashing for cross-modal retrieval. JDSH [27] fully preserves the cross-modal semantic association between instances by constructing the joint-modal similarity matrix and similarity decision and weighted method based on distribution. UKD [30] uses output generated by unsupervised methods to guide supervisory methods and make use of teacher-student optimization for propagating knowledge. UGACH [22] and UCH [32] train the networks in an adversarial learning manner, through the way of cross-modal adversary. MGAH [33] extends UGACH to multimodal retrieval among five modalities, but these adversarial methods have problems such as difficulty in training and high time complexity.Although unsupervised cross-modal hashing has advantages in reducing the burden of manual annotation of data and is more widely used in real-world scenarios, its accuracy is often less than satisfactory, especially when compared with supervised methods. The main reason is the lack of pairwise similarity knowledge of training data pairs. The output of unsupervised models usually contains some inaccurate semantic information. Therefore, we focus on improving the accuracy of unsupervised learning methods, which have wider applications in real-world scenarios. Inspired by the idea of knowledge distillation, we use the output of the unsupervised model to guide the supervised model. That is, we use distilled knowledge to aid model training.


## 2.1. Unsupervised Shallow Cross-Modal Hashing

Unsupervised cross-modal hashing methods can be divided into shallow methods and deep methods. CVH [7] is a representative of the early shallow unsupervised methods, using cross-view hashing to learn shallow hash functions. IMH [11] uses spectral hashing to transform heterogeneous cross-modal data into hamming space for unified learning. CMFH [24] learns a unified hash code by collaboratively decomposing the feature matrix of cross-modal data. CCQ [25] jointly finds the correlation maximum mapping that transforms different modalities into isomorphic potential spaces and learns the compound quantizer that transforms isomorphic potential features into compact binary codes. LSSH [26] uses sparse coding to capture the salient structure of the image and obtains the underlying concepts of the text through matrix decomposition, exploring the semantic information hidden in the data. These methods cannot effectively capture the complex nonlinear mapping of different modal data to the hamming space, so many unsupervised cross-modal methods introduce deep neural networks into the learning of hash codes to construct a nonlinear mapping from data to hash codes.


## 2.2. Unsupervised Deep Cross-Modal Hashing

With the development of deep learning, deep cross-modal hashing methods have become mainstream in recent years [10, 22, 23, 27–30]. DBRC [31] proposes deep binary reconstruction cross-modal hashing to maintain consistency within and between modalities. UDCMH [28] jointly optimizes the feature learning and binarization process and learns a unified binary code. DJSRH [29] constructs a joint semantic similarity matrix based on the neighborhood information of different modalities and proposes deep joint semantic reconstruction hashing for cross-modal retrieval. JDSH [27] fully preserves the cross-modal semantic association between instances by constructing the joint-modal similarity matrix and similarity decision and weighted method based on distribution. UKD [30] uses output generated by unsupervised methods to guide supervisory methods and make use of teacher-student optimization for propagating knowledge. UGACH [22] and UCH [32] train the networks in an adversarial learning manner, through the way of cross-modal adversary. MGAH [33] extends UGACH to multimodal retrieval among five modalities, but these adversarial methods have problems such as difficulty in training and high time complexity.Although unsupervised cross-modal hashing has advantages in reducing the burden of manual annotation of data and is more widely used in real-world scenarios, its accuracy is often less than satisfactory, especially when compared with supervised methods. The main reason is the lack of pairwise similarity knowledge of training data pairs. The output of unsupervised models usually contains some inaccurate semantic information. Therefore, we focus on improving the accuracy of unsupervised learning methods, which have wider applications in real-world scenarios. Inspired by the idea of knowledge distillation, we use the output of the unsupervised model to guide the supervised model. That is, we use distilled knowledge to aid model training.


## 3. Proposed Method

Knowledge distillation can use a more complex model (teacher) that has been trained to guide a lighter model (student) training, so as to reduce the size of the model and computational resources, while trying to maintain the accuracy of the original large model. Our proposed SAKDH method, summarized in one sentence, is to train a student network with the soft label output of teacher network. In this work, we use the output of the unsupervised method to guide the supervised cross-modal hashing method. Figure1 shows the proposed SAKDH framework.Figure 1
The proposed SAKDH framework consists of two modules: unsupervised teacher model (a) and supervised student model (b). The teacher model is trained in an unsupervised way. By distilling the knowledge from the teacher model, the similarity matrixSv,tO (soft similarity) is established, and it is used to supervise the student model. The teacher model adopted an unsupervised semantic alignment hashing method, and the student model adopts the joint loss of pairwise and triplet; these loss functions apply not only to intermodal, but also to intramodal.


### 3.1. Soft Similarity

The key to CMH is to identify which image/text pairs are semantically relevant and which are semantically unrelated, enabling the model to learn to pull the features of the correlation pair closer together in the common space. A common method is to define a similarity matrixS∈0,1n×n, sij=1 indicates that these image/text pairs are positive sample pairs and vice versa. This way is called hard similarity. If S∈0,1n×n, sij is a real value between [0, 1]; this is what we call soft similarity. In our distillation model, the output is soft similarity. We can use the example in Figure 2 to understand the idea of soft similarity and hard similarity. In addition to positive tag, negative tags also carry a lot of information; for example, the corresponding probability of some negative tags is far greater than that of others. In the traditional training process (hard similarity), all negative tags are 0. In other words, the training way of SAKDH makes each sample bring more information to the student network than the traditional training method.Figure 2
Examples of soft similarity and hard similarity.


### 3.2. Problem Definition

Let us start with some of the notations used in this paper. Assume that we haven instances which can be denoted as O=oii=1n, and each instance can be described by an image-text pair oi∈vi,ti. We use F∗=fi∗i=1n∈ℝn×D∗, ∗∈v,t, to represent the feature vectors extracted from the ImageNet_T or TextNet_T, where D∗, ∗∈v,t, denotes the dimension of image or text modality feature space. In addition, B∗=bi∗i=1n∈−1,1n×c, ∗∈v,t, denotes the hash codes generated of image or text modality, where c denotes code length.


### 3.3. Unsupervised Knowledge Distillation

In the unsupervised teacher model, we shared the idea of DSAH [34]. In order to make full use of image-text pairs, we designed an unsupervised deep semantic alignment loss function, including similar semantic alignment loss and diagonal semantic alignment loss. It is possible to align the similarity between the features with the similarity between the hash codes at the same time.In unsupervised cross-modal hashing methods, the instance’s annotation is not available. The features extracted from the deep neural network contain rich semantic information, so we can construct the similarity matrix by using the features without annotation. In this paper, to describe the neighbor relations in the hamming space, we calculate the pairwise cosine similarity matrices and defineSv,vB for the image modality, St,tB for the text modality, and Sv,tB for the cross-modality of image-text between image modality and text modality. sv,vB=cosbiv,bjv=bivbjvT/biv2bjv2∈−1,+1. Similarly, st,tB=cosbit,bjt, sv,tB=cosbiv,bjt. We also measure the similarity of pairs of samples in the feature vectors space and define Sv,vF for the image modality, St,tF for the text modality, and Sv,tF for the cross-modality of image-text between image modality and text modality. We use the trained features (Fv=fivi=1n) to construct the image modal, where sv,vF=cosfiv,fjv. Similarly, st,tF=cosfit,fjt and sv,tF=cosfiv,fjt.


#### 3.3.1. Similarity Semantic Alignment

Because of the difference in the features distribution of cross-modal instances, the semantic description corresponding to the binary hash code often deviates from the semantic description of the feature, leading to some deviations in the search results. However, the original neighborhood relationship of different corresponding modalities are retained for the similarity information of hash codes or features. Although the similarity information is calculated in different modalities, we need to measure it in a common space. Therefore, the core of cross-modal retrieval is to solve the measurement and alignment of similarity information between different modalities.To solve this problem, we propose to align the similarity information of different modalities. We calculate the similarity matrix using the cosine similarity function cos (). Firstly, in order to align the similarity information of the hash code from the intramodality with the similarity information of the semantic feature, the defined loss function is as follows:(1)Lintra=∑Sv,vB−μSv,vF2+∑St,tB−μSt,tF2,where μ is a trade-off parameter to improve the flexibility of our similarity alignment. Secondly, in order to further align similarity information, we not only align semantic information from intramodality, but also align from intermodality. We align the similarity of instance features with the similarity of hash codes between different modalities:(2)Linter=∑Sv,vB−μSv,tF2+∑St,tB−μSv,tF2+∑Sv,tB−μSv,tF2,where Sv,tFi,j represents the similarity between i−th and j−th instance, which is obtained by a weighted sum of Sv,vF and St,tF:(3)Sv,tF=αSv,vF+βSt,tF+γ2cosSv,vF,St,tF+cosSv,vF,St,tFT,s.t.α,β,γ≥0,α+β+γ=1,where α, β, and γ are trade-off parameters, which are used to adjust the similarity relationship of different modalities. Finally, we merge the similarity alignment loss of the intermodality and that of the intramodality:(4)LS=Linter+Lintra.


#### 3.3.2. Diagonal Semantic Alignment

Looking closely at the cross-modal similarity matrix, we find that the diagonal elements of the matrixSv,tB are calculated between the image-text pair hash code, so any diagonal member of the matrix should be equal to 1. In order to minimize the quantization error of diagonal elements and increase the similarity between hash codes of the same label, we can define the following formula:(5)Ldiag=minBv,Bt∑i=1n1−Sv,tBi,i2.In addition, the image-text pairs of off-diagonal elements in a matrix are the same as those of its symmetric elements. For example, the symmetric element ofSv,tB1,2 is Sv,tB2,1, both of whose label-pairs consist of the label of the 1st image-text pair and the label of the 2nd image-text pair. Therefore, we can unify off-diagonal elements by minimizing symmetric loss:(6)Loff−diag=minBv,Bt12∑i=1n∑jnSv,tBi,j−Sv,tBj,i2.Finally, the diagonal alignment loss is formulated as(7)LD=Ldiag+Loff−diag.We combine the similarity alignment loss and diagonal alignment loss in the teacher module to get the final unsupervised teacher model loss, as shown below:(8)minBv,BtL=LS+LD,where LS and LD are the similarity alignment loss and the diagonal alignment loss, respectively.


### 3.4. Supervised Student Model

After unsupervised training of teacher model, we obtained soft similarity matrixSO. In order to maintain the semantic correlation of the different modalities, the learning process of the two modals (image and text) is supervised by the similarity matrix SO. Firstly, a good hash code should have good discriminative ability in intramodal to retain semantic information. On the contrary, effective hash codes in each modality can improve the performance of cross-mode retrieval. Therefore, our objective function includes two types: intramodality similarity preservation (intramodality triplet loss) and intermodal similarity preservation (intermodal pairwise and triplet loss).Inspired by DTSH [5], we use the triplet label as the supervision information to describe the relative semantic relationship between three data to construct the triplet network and to dig out more semantic information and improve the retrieval accuracy. During triplet sampling, it is not feasible to sample all triples at once due to memory size and computational resource constraints. To overcome this problem, we used mini-batch method for triplet sampling. The triplet form of image mode is constructed as follows: vi,tj+,tk−; text instance tk− is semantically unrelated to image vi, while tj+ is the opposite. Similarly, the text modality triplet form ti,vj+,vk−. In order to better retain the semantic similarity of training samples in hamming space and enhance the discriminability of learned hash codes, the objective function is divided into two parts: (1) the intramodal triplet loss and (2) the intermodal triplet loss.


#### 3.4.1. Intramodal Triplet Loss

In order to further make the generated hash code more accurate, it is necessary to not only retain the semantic similarity across modalities, but also to mine the essential semantic information in each modal to enhance the discriminability of the hash code, thereby improving the retrieval performance of cross-modal retrieval. Therefore, we introduce the intramodal triplet loss as part of the objective function. The intramodal triplet loss in the image modal can be obtained as follows:(9)Ltri−intrav=−logpT|Hv=−∑i,j,klogpvi,vj+,vk−|Hv=−∑i,j,kθvivj+−θvivk−−ω−log1+eθvivj+−θvivk−−α,where θvivj+=1/2H∗vivTH∗vj+v and θvivk−=1/2H∗vivTH∗vk−v. Similarly, the intramodal triplet loss in the text modal can be obtained as follows:(10)Ltri−intrat=−∑i,j,kθtitj+−θtitk−−ω−log1+eθtitj+−θtitk−−α=−∑i,j,kθtitj+−θtitk−−ω−log1+eθtitj+−θtitk−−α,where θtitj+=1/2H∗titTH∗tj+t and θtitk−=1/2H∗titTH∗tk−t. By adding equations (9) and (10), the intramodal triplet loss can be obtained as follows:(11)Ltri−intra=Ltri−intrav+Ltri−intrat.


#### 3.4.2. Intermodal Triplet Loss

In order to achieve effective cross-modal hashing retrieval, we add the intermodal triplet loss to the objective loss function to effectively capture the heterogeneous correlation cross modal. Therefore, the intermodal triplet loss from image to text is as follows:(12)Ltri−interv=−logpT|Hv,Ht,Ht=−∑i,j,klogpvi,tj+,tk−|Hv,Ht,Ht=−∑i,j,kθvitj+−θvitk−−ω−log1+eθvitj+−θvitk−−α,where θvitj+=1/2H∗vivTH∗tj+t and θvitk−=1/2H∗vivTH∗tk−t. Similarly, the intermodal triplet loss from text to image is as follows:(13)Ltri−intert=−∑i,j,klogpti,vj+,vk−|Ht,Hv,Hv=−∑i,j,kθtivj+−θtivk−−ω−log1+eθtivj+−θtivk−−α,where θtivj+=1/2H∗titTH∗vj+v and θtivk−=1/2H∗titTH∗vk−v. By adding equations (12) and (13), the intermodal triplet loss can be obtained as follows:(14)Ltri−inter=Ltri−interv+Ltri−intert.Obviously, the optimization of formula (14) can reduce the hamming distance between the anchor sample and the positive sample while increasing the hamming distance between the anchor sample and the negative sample, so as to retain as much higher-order semantic information of the sample as possible. By adding the intermodal triplet loss and the intramodal triplet loss, the total triplet loss can be obtained as follows:(15)Ltriplet=Ltri−inter+Ltri−intra.


#### 3.4.3. Intermodal Pairwise Loss

The hash codes from different modalities can effectively preserve semantic similarity. It is a very natural choice to use intermodal pairwise loss in cross-modal retrieval. The intermodal likelihood of pairwise labels is expressed as(16)pSij|H∗iv,H∗jt=σΩijv,t,sij=1,1−σΩijv,t,sij=0.where Ωijv,t=1/2H∗ivH∗jt and σΩijv,t=1/1+e−Ωijv,t ; hash codes of text modality output from TextNet_S are H∗iv=fvvi,θv and H∗jt=fttj,θt. Therefore, the intermodal pairwise loss is expressed as(17)Lpairwise=−logpSo|Hv,Ht=−∑sijo∈SosijoΩijv,t−log1+eΩijv,t.Optimization formula (17) can reduce the hamming distance between two similar instances with different modalities and expand the hamming distance between two different instances. Thus, semantic similarity between different modalities instances can be preserved. The overall objective function is written as below:(18)Lstudent=Lpairwise+Ltriplet+λB−HvF2+B−HtF2s.t.B∈−1,+1k×n,where B−HvF2andB−HtF2 are the regularization terms and λ are trade-off parameters.


### 3.5. Models and Implementation Details

For the unsupervised teacher model, suggested by [28–30], we use the VGG19 [35] network as the backbone network to extract image feature, and the last classification layer fc8 is replaced by a hashing layer. In particular, we extract the 4,096-dimensional vectors from the fc7 layer after ReLU activation as the original image features. Meanwhile, for the text modality, we use BoW to embed textual features. TextNet_T consists of two fully connected layers and generates continuous features.On the other hand, for the supervised student model, inspired by SSAH [15], we use part of its network structure, retaining the image network and the text network, but discarding its discriminative module. The model consists of two deep neural networks, which are used for image modality and text modality, respectively. The batch size of ImageNet_S and TextNet_S is fixed at 128. The dimension of the feature space of the two networks is 4096, and the dimension of the hash space is the same as the length of the hash code. We analyze the hyperparameters sensitivity as reported in Figure 3. In addition, the deep learning framework used in the experiment was TensorFlow V1.15, and the deep learning acceleration card was NVIDIA GTX 1070TI GPU.Figure 3
Precision@top-K curves on MIRFLICKR and NUS-WIDE with 128-bit code length. (a) Image-to-text. (b) Text-to-image. (c) Image-to-text. (d) Text-to-image.
(a)(b)(c)(d)


## 3.1. Soft Similarity

The key to CMH is to identify which image/text pairs are semantically relevant and which are semantically unrelated, enabling the model to learn to pull the features of the correlation pair closer together in the common space. A common method is to define a similarity matrixS∈0,1n×n, sij=1 indicates that these image/text pairs are positive sample pairs and vice versa. This way is called hard similarity. If S∈0,1n×n, sij is a real value between [0, 1]; this is what we call soft similarity. In our distillation model, the output is soft similarity. We can use the example in Figure 2 to understand the idea of soft similarity and hard similarity. In addition to positive tag, negative tags also carry a lot of information; for example, the corresponding probability of some negative tags is far greater than that of others. In the traditional training process (hard similarity), all negative tags are 0. In other words, the training way of SAKDH makes each sample bring more information to the student network than the traditional training method.Figure 2
Examples of soft similarity and hard similarity.


## 3.2. Problem Definition

Let us start with some of the notations used in this paper. Assume that we haven instances which can be denoted as O=oii=1n, and each instance can be described by an image-text pair oi∈vi,ti. We use F∗=fi∗i=1n∈ℝn×D∗, ∗∈v,t, to represent the feature vectors extracted from the ImageNet_T or TextNet_T, where D∗, ∗∈v,t, denotes the dimension of image or text modality feature space. In addition, B∗=bi∗i=1n∈−1,1n×c, ∗∈v,t, denotes the hash codes generated of image or text modality, where c denotes code length.


## 3.3. Unsupervised Knowledge Distillation

In the unsupervised teacher model, we shared the idea of DSAH [34]. In order to make full use of image-text pairs, we designed an unsupervised deep semantic alignment loss function, including similar semantic alignment loss and diagonal semantic alignment loss. It is possible to align the similarity between the features with the similarity between the hash codes at the same time.In unsupervised cross-modal hashing methods, the instance’s annotation is not available. The features extracted from the deep neural network contain rich semantic information, so we can construct the similarity matrix by using the features without annotation. In this paper, to describe the neighbor relations in the hamming space, we calculate the pairwise cosine similarity matrices and defineSv,vB for the image modality, St,tB for the text modality, and Sv,tB for the cross-modality of image-text between image modality and text modality. sv,vB=cosbiv,bjv=bivbjvT/biv2bjv2∈−1,+1. Similarly, st,tB=cosbit,bjt, sv,tB=cosbiv,bjt. We also measure the similarity of pairs of samples in the feature vectors space and define Sv,vF for the image modality, St,tF for the text modality, and Sv,tF for the cross-modality of image-text between image modality and text modality. We use the trained features (Fv=fivi=1n) to construct the image modal, where sv,vF=cosfiv,fjv. Similarly, st,tF=cosfit,fjt and sv,tF=cosfiv,fjt.


### 3.3.1. Similarity Semantic Alignment

Because of the difference in the features distribution of cross-modal instances, the semantic description corresponding to the binary hash code often deviates from the semantic description of the feature, leading to some deviations in the search results. However, the original neighborhood relationship of different corresponding modalities are retained for the similarity information of hash codes or features. Although the similarity information is calculated in different modalities, we need to measure it in a common space. Therefore, the core of cross-modal retrieval is to solve the measurement and alignment of similarity information between different modalities.To solve this problem, we propose to align the similarity information of different modalities. We calculate the similarity matrix using the cosine similarity function cos (). Firstly, in order to align the similarity information of the hash code from the intramodality with the similarity information of the semantic feature, the defined loss function is as follows:(1)Lintra=∑Sv,vB−μSv,vF2+∑St,tB−μSt,tF2,where μ is a trade-off parameter to improve the flexibility of our similarity alignment. Secondly, in order to further align similarity information, we not only align semantic information from intramodality, but also align from intermodality. We align the similarity of instance features with the similarity of hash codes between different modalities:(2)Linter=∑Sv,vB−μSv,tF2+∑St,tB−μSv,tF2+∑Sv,tB−μSv,tF2,where Sv,tFi,j represents the similarity between i−th and j−th instance, which is obtained by a weighted sum of Sv,vF and St,tF:(3)Sv,tF=αSv,vF+βSt,tF+γ2cosSv,vF,St,tF+cosSv,vF,St,tFT,s.t.α,β,γ≥0,α+β+γ=1,where α, β, and γ are trade-off parameters, which are used to adjust the similarity relationship of different modalities. Finally, we merge the similarity alignment loss of the intermodality and that of the intramodality:(4)LS=Linter+Lintra.


### 3.3.2. Diagonal Semantic Alignment

Looking closely at the cross-modal similarity matrix, we find that the diagonal elements of the matrixSv,tB are calculated between the image-text pair hash code, so any diagonal member of the matrix should be equal to 1. In order to minimize the quantization error of diagonal elements and increase the similarity between hash codes of the same label, we can define the following formula:(5)Ldiag=minBv,Bt∑i=1n1−Sv,tBi,i2.In addition, the image-text pairs of off-diagonal elements in a matrix are the same as those of its symmetric elements. For example, the symmetric element ofSv,tB1,2 is Sv,tB2,1, both of whose label-pairs consist of the label of the 1st image-text pair and the label of the 2nd image-text pair. Therefore, we can unify off-diagonal elements by minimizing symmetric loss:(6)Loff−diag=minBv,Bt12∑i=1n∑jnSv,tBi,j−Sv,tBj,i2.Finally, the diagonal alignment loss is formulated as(7)LD=Ldiag+Loff−diag.We combine the similarity alignment loss and diagonal alignment loss in the teacher module to get the final unsupervised teacher model loss, as shown below:(8)minBv,BtL=LS+LD,where LS and LD are the similarity alignment loss and the diagonal alignment loss, respectively.


## 3.3.1. Similarity Semantic Alignment

Because of the difference in the features distribution of cross-modal instances, the semantic description corresponding to the binary hash code often deviates from the semantic description of the feature, leading to some deviations in the search results. However, the original neighborhood relationship of different corresponding modalities are retained for the similarity information of hash codes or features. Although the similarity information is calculated in different modalities, we need to measure it in a common space. Therefore, the core of cross-modal retrieval is to solve the measurement and alignment of similarity information between different modalities.To solve this problem, we propose to align the similarity information of different modalities. We calculate the similarity matrix using the cosine similarity function cos (). Firstly, in order to align the similarity information of the hash code from the intramodality with the similarity information of the semantic feature, the defined loss function is as follows:(1)Lintra=∑Sv,vB−μSv,vF2+∑St,tB−μSt,tF2,where μ is a trade-off parameter to improve the flexibility of our similarity alignment. Secondly, in order to further align similarity information, we not only align semantic information from intramodality, but also align from intermodality. We align the similarity of instance features with the similarity of hash codes between different modalities:(2)Linter=∑Sv,vB−μSv,tF2+∑St,tB−μSv,tF2+∑Sv,tB−μSv,tF2,where Sv,tFi,j represents the similarity between i−th and j−th instance, which is obtained by a weighted sum of Sv,vF and St,tF:(3)Sv,tF=αSv,vF+βSt,tF+γ2cosSv,vF,St,tF+cosSv,vF,St,tFT,s.t.α,β,γ≥0,α+β+γ=1,where α, β, and γ are trade-off parameters, which are used to adjust the similarity relationship of different modalities. Finally, we merge the similarity alignment loss of the intermodality and that of the intramodality:(4)LS=Linter+Lintra.


## 3.3.2. Diagonal Semantic Alignment

Looking closely at the cross-modal similarity matrix, we find that the diagonal elements of the matrixSv,tB are calculated between the image-text pair hash code, so any diagonal member of the matrix should be equal to 1. In order to minimize the quantization error of diagonal elements and increase the similarity between hash codes of the same label, we can define the following formula:(5)Ldiag=minBv,Bt∑i=1n1−Sv,tBi,i2.In addition, the image-text pairs of off-diagonal elements in a matrix are the same as those of its symmetric elements. For example, the symmetric element ofSv,tB1,2 is Sv,tB2,1, both of whose label-pairs consist of the label of the 1st image-text pair and the label of the 2nd image-text pair. Therefore, we can unify off-diagonal elements by minimizing symmetric loss:(6)Loff−diag=minBv,Bt12∑i=1n∑jnSv,tBi,j−Sv,tBj,i2.Finally, the diagonal alignment loss is formulated as(7)LD=Ldiag+Loff−diag.We combine the similarity alignment loss and diagonal alignment loss in the teacher module to get the final unsupervised teacher model loss, as shown below:(8)minBv,BtL=LS+LD,where LS and LD are the similarity alignment loss and the diagonal alignment loss, respectively.


## 3.4. Supervised Student Model

After unsupervised training of teacher model, we obtained soft similarity matrixSO. In order to maintain the semantic correlation of the different modalities, the learning process of the two modals (image and text) is supervised by the similarity matrix SO. Firstly, a good hash code should have good discriminative ability in intramodal to retain semantic information. On the contrary, effective hash codes in each modality can improve the performance of cross-mode retrieval. Therefore, our objective function includes two types: intramodality similarity preservation (intramodality triplet loss) and intermodal similarity preservation (intermodal pairwise and triplet loss).Inspired by DTSH [5], we use the triplet label as the supervision information to describe the relative semantic relationship between three data to construct the triplet network and to dig out more semantic information and improve the retrieval accuracy. During triplet sampling, it is not feasible to sample all triples at once due to memory size and computational resource constraints. To overcome this problem, we used mini-batch method for triplet sampling. The triplet form of image mode is constructed as follows: vi,tj+,tk−; text instance tk− is semantically unrelated to image vi, while tj+ is the opposite. Similarly, the text modality triplet form ti,vj+,vk−. In order to better retain the semantic similarity of training samples in hamming space and enhance the discriminability of learned hash codes, the objective function is divided into two parts: (1) the intramodal triplet loss and (2) the intermodal triplet loss.


### 3.4.1. Intramodal Triplet Loss

In order to further make the generated hash code more accurate, it is necessary to not only retain the semantic similarity across modalities, but also to mine the essential semantic information in each modal to enhance the discriminability of the hash code, thereby improving the retrieval performance of cross-modal retrieval. Therefore, we introduce the intramodal triplet loss as part of the objective function. The intramodal triplet loss in the image modal can be obtained as follows:(9)Ltri−intrav=−logpT|Hv=−∑i,j,klogpvi,vj+,vk−|Hv=−∑i,j,kθvivj+−θvivk−−ω−log1+eθvivj+−θvivk−−α,where θvivj+=1/2H∗vivTH∗vj+v and θvivk−=1/2H∗vivTH∗vk−v. Similarly, the intramodal triplet loss in the text modal can be obtained as follows:(10)Ltri−intrat=−∑i,j,kθtitj+−θtitk−−ω−log1+eθtitj+−θtitk−−α=−∑i,j,kθtitj+−θtitk−−ω−log1+eθtitj+−θtitk−−α,where θtitj+=1/2H∗titTH∗tj+t and θtitk−=1/2H∗titTH∗tk−t. By adding equations (9) and (10), the intramodal triplet loss can be obtained as follows:(11)Ltri−intra=Ltri−intrav+Ltri−intrat.


### 3.4.2. Intermodal Triplet Loss

In order to achieve effective cross-modal hashing retrieval, we add the intermodal triplet loss to the objective loss function to effectively capture the heterogeneous correlation cross modal. Therefore, the intermodal triplet loss from image to text is as follows:(12)Ltri−interv=−logpT|Hv,Ht,Ht=−∑i,j,klogpvi,tj+,tk−|Hv,Ht,Ht=−∑i,j,kθvitj+−θvitk−−ω−log1+eθvitj+−θvitk−−α,where θvitj+=1/2H∗vivTH∗tj+t and θvitk−=1/2H∗vivTH∗tk−t. Similarly, the intermodal triplet loss from text to image is as follows:(13)Ltri−intert=−∑i,j,klogpti,vj+,vk−|Ht,Hv,Hv=−∑i,j,kθtivj+−θtivk−−ω−log1+eθtivj+−θtivk−−α,where θtivj+=1/2H∗titTH∗vj+v and θtivk−=1/2H∗titTH∗vk−v. By adding equations (12) and (13), the intermodal triplet loss can be obtained as follows:(14)Ltri−inter=Ltri−interv+Ltri−intert.Obviously, the optimization of formula (14) can reduce the hamming distance between the anchor sample and the positive sample while increasing the hamming distance between the anchor sample and the negative sample, so as to retain as much higher-order semantic information of the sample as possible. By adding the intermodal triplet loss and the intramodal triplet loss, the total triplet loss can be obtained as follows:(15)Ltriplet=Ltri−inter+Ltri−intra.


### 3.4.3. Intermodal Pairwise Loss

The hash codes from different modalities can effectively preserve semantic similarity. It is a very natural choice to use intermodal pairwise loss in cross-modal retrieval. The intermodal likelihood of pairwise labels is expressed as(16)pSij|H∗iv,H∗jt=σΩijv,t,sij=1,1−σΩijv,t,sij=0.where Ωijv,t=1/2H∗ivH∗jt and σΩijv,t=1/1+e−Ωijv,t ; hash codes of text modality output from TextNet_S are H∗iv=fvvi,θv and H∗jt=fttj,θt. Therefore, the intermodal pairwise loss is expressed as(17)Lpairwise=−logpSo|Hv,Ht=−∑sijo∈SosijoΩijv,t−log1+eΩijv,t.Optimization formula (17) can reduce the hamming distance between two similar instances with different modalities and expand the hamming distance between two different instances. Thus, semantic similarity between different modalities instances can be preserved. The overall objective function is written as below:(18)Lstudent=Lpairwise+Ltriplet+λB−HvF2+B−HtF2s.t.B∈−1,+1k×n,where B−HvF2andB−HtF2 are the regularization terms and λ are trade-off parameters.


## 3.4.1. Intramodal Triplet Loss

In order to further make the generated hash code more accurate, it is necessary to not only retain the semantic similarity across modalities, but also to mine the essential semantic information in each modal to enhance the discriminability of the hash code, thereby improving the retrieval performance of cross-modal retrieval. Therefore, we introduce the intramodal triplet loss as part of the objective function. The intramodal triplet loss in the image modal can be obtained as follows:(9)Ltri−intrav=−logpT|Hv=−∑i,j,klogpvi,vj+,vk−|Hv=−∑i,j,kθvivj+−θvivk−−ω−log1+eθvivj+−θvivk−−α,where θvivj+=1/2H∗vivTH∗vj+v and θvivk−=1/2H∗vivTH∗vk−v. Similarly, the intramodal triplet loss in the text modal can be obtained as follows:(10)Ltri−intrat=−∑i,j,kθtitj+−θtitk−−ω−log1+eθtitj+−θtitk−−α=−∑i,j,kθtitj+−θtitk−−ω−log1+eθtitj+−θtitk−−α,where θtitj+=1/2H∗titTH∗tj+t and θtitk−=1/2H∗titTH∗tk−t. By adding equations (9) and (10), the intramodal triplet loss can be obtained as follows:(11)Ltri−intra=Ltri−intrav+Ltri−intrat.


## 3.4.2. Intermodal Triplet Loss

In order to achieve effective cross-modal hashing retrieval, we add the intermodal triplet loss to the objective loss function to effectively capture the heterogeneous correlation cross modal. Therefore, the intermodal triplet loss from image to text is as follows:(12)Ltri−interv=−logpT|Hv,Ht,Ht=−∑i,j,klogpvi,tj+,tk−|Hv,Ht,Ht=−∑i,j,kθvitj+−θvitk−−ω−log1+eθvitj+−θvitk−−α,where θvitj+=1/2H∗vivTH∗tj+t and θvitk−=1/2H∗vivTH∗tk−t. Similarly, the intermodal triplet loss from text to image is as follows:(13)Ltri−intert=−∑i,j,klogpti,vj+,vk−|Ht,Hv,Hv=−∑i,j,kθtivj+−θtivk−−ω−log1+eθtivj+−θtivk−−α,where θtivj+=1/2H∗titTH∗vj+v and θtivk−=1/2H∗titTH∗vk−v. By adding equations (12) and (13), the intermodal triplet loss can be obtained as follows:(14)Ltri−inter=Ltri−interv+Ltri−intert.Obviously, the optimization of formula (14) can reduce the hamming distance between the anchor sample and the positive sample while increasing the hamming distance between the anchor sample and the negative sample, so as to retain as much higher-order semantic information of the sample as possible. By adding the intermodal triplet loss and the intramodal triplet loss, the total triplet loss can be obtained as follows:(15)Ltriplet=Ltri−inter+Ltri−intra.


## 3.4.3. Intermodal Pairwise Loss

The hash codes from different modalities can effectively preserve semantic similarity. It is a very natural choice to use intermodal pairwise loss in cross-modal retrieval. The intermodal likelihood of pairwise labels is expressed as(16)pSij|H∗iv,H∗jt=σΩijv,t,sij=1,1−σΩijv,t,sij=0.where Ωijv,t=1/2H∗ivH∗jt and σΩijv,t=1/1+e−Ωijv,t ; hash codes of text modality output from TextNet_S are H∗iv=fvvi,θv and H∗jt=fttj,θt. Therefore, the intermodal pairwise loss is expressed as(17)Lpairwise=−logpSo|Hv,Ht=−∑sijo∈SosijoΩijv,t−log1+eΩijv,t.Optimization formula (17) can reduce the hamming distance between two similar instances with different modalities and expand the hamming distance between two different instances. Thus, semantic similarity between different modalities instances can be preserved. The overall objective function is written as below:(18)Lstudent=Lpairwise+Ltriplet+λB−HvF2+B−HtF2s.t.B∈−1,+1k×n,where B−HvF2andB−HtF2 are the regularization terms and λ are trade-off parameters.


## 3.5. Models and Implementation Details

For the unsupervised teacher model, suggested by [28–30], we use the VGG19 [35] network as the backbone network to extract image feature, and the last classification layer fc8 is replaced by a hashing layer. In particular, we extract the 4,096-dimensional vectors from the fc7 layer after ReLU activation as the original image features. Meanwhile, for the text modality, we use BoW to embed textual features. TextNet_T consists of two fully connected layers and generates continuous features.On the other hand, for the supervised student model, inspired by SSAH [15], we use part of its network structure, retaining the image network and the text network, but discarding its discriminative module. The model consists of two deep neural networks, which are used for image modality and text modality, respectively. The batch size of ImageNet_S and TextNet_S is fixed at 128. The dimension of the feature space of the two networks is 4096, and the dimension of the hash space is the same as the length of the hash code. We analyze the hyperparameters sensitivity as reported in Figure 3. In addition, the deep learning framework used in the experiment was TensorFlow V1.15, and the deep learning acceleration card was NVIDIA GTX 1070TI GPU.Figure 3
Precision@top-K curves on MIRFLICKR and NUS-WIDE with 128-bit code length. (a) Image-to-text. (b) Text-to-image. (c) Image-to-text. (d) Text-to-image.
(a)(b)(c)(d)


## 4. Experiment

We conducted adequate experiments on two popular benchmark datasets NUS-WIDE [36] and MIRFLICKR-25K [37] to prove its performance.


### 4.1. Datasets

MIRFLICKR-25K contains 25015 images, each of which has a corresponding text description, so each instance sample is an image-text pair. There are 24 categories in this dataset, and each instance sample is marked by at least one tag. We used 20,015 samples, of which 2,000 were used as query sets and the rest were used for retrieval. We extracted a 4096-dimensional feature vector from the pretrained 19-layer VGGNet to represent each image and represented each text sample as a 1386-dimensional BoW vector.NUS-WIDE dataset is a relatively large dataset with 269,498 images and 81 labels. Each image corresponds to some text description. We kept the 10 most common concepts, so we ended up with 186,577 text-image pairs. We retain 1% (1865) of the data as a query database and the rest as a retrieval set. Each image is represented by 4096-dimensional feature vector, and each text is represented by 1000-dimensional BoW vector. In our experiment, the specific implementation details of the two cross-modal datasets are shown in Table1.Table 1
Setup of the two cross-modal datasets.
DatasetTotalTraining setTest setLabelsImage featureText featureMIRFLICKR-25k20,01518,0152,000244,096d VGGNet1,386d BoWNUS-WIDE186,57715,0001865104,096d VGGNet1,000d BoW


### 4.2. Evaluation Metric

In order to verify the feasibility of our method, we use two evaluation criteria to evaluate the proposed method: mean average precision (MAP) and top-K precision curve. MAP is one of the most commonly used indicators to jointly evaluate search accuracy and ranking. The top-K precision represents the accuracy under different numbers of retrieval instances. In the experiment, we use two retrieval tasks for cross-modal retrieval: image-query-text (to retrieve text through image query) and text-query-image (to retrieve image through text query).


### 4.3. Experiment Results

We have selected some representative methods for comparison to verify the effectiveness of the proposed SAKDH method. There are a total of 8 unsupervised hashing methods, including four shallow cross-modal hashing methods and four deep cross-modal hashing methods. CVH [7], IMH [11], CMFH [24], and LSSH [26] are shallow methods, while DBRC [31], UDCMH [28], DJSRH [29], and JDSH [27] are deep methods. For fairness, the comparison method applies the same settings as in the original work.


#### 4.3.1. Results on MIRFLICKR

Table2 shows the results of MAP@50 on MIRFLICKR, including two cross-mode retrieval tasks with four different length hash codes. The top-K precision curves are shown in Figures 3(a) and 3(b). It can be seen from the table that compared to all comparison methods, SAKDH is always the best. In particular, compared to the best unsupervised shallow method CMFH, our method improved by more than 23.3% and 19.5% for different hash code lengths in two retrieval tasks on MIRFLICKR. Compared to the previous best model (JDSH), our method still gets the best results; we achieve improvements of 2.2%, 2.3%, 1.1%, and 1.3% in image-to-text retrieval tasks for different bits, respectively. We plotted the top-K precision curves for all the methods. We observed that SAKDH maintained optimal performance throughout for both the image-to-text task and text-to-image tasks. This suggests that our approach improves accuracy through semantic alignment and knowledge distillation.Table 2
The MAP@50 results of two retrieval tasks on MIRFLICKR with various code lengths.
MethodsImage-query-textText-query-image163264128163264128CVH [7]0.6060.5990.5960.5980.5910.5830.5760.576IMH [11]0.6120.6010.5920.5790.6030.5950.5890.580CMFH [24]0.6210.6240.6250.6270.6420.6620.6760.685LSSH [26]0.5840.5990.6020.6140.6180.6260.6260.628DBRC [31]0.6170.6190.6200.6210.6180.6260.6260.628UDCMH [28]0.6890.6980.7140.7170.6920.7040.7180.733DJSRH [29]0.8100.8430.8620.8760.7860.8220.8350.847JDSH [27]0.8320.8530.8820.8920.8250.8640.8780.880Ours0.8540.8760.8930.9050.8370.8670.8820.884


#### 4.3.2. Results on NUS-WIDE

Table3 lists the MAP@50 results of all methods on NUS-WIDE. We further plotted the top-K precision curves in Figures 3(c) and 3(d). NUS-WIDE is a difficult and challenging dataset. Compared with MIRFLICKR, which has more samples and more complex contents, our approach still leads, but by a smaller margin than MIRFLICKR. Compared with JDSH, our approach still holds the lead. It is important to note that only SAKDH can distill and retain the similarity of different instances, resulting in better performance than other methods. In addition, SAKDH can further improve performance by distilling some data pairs to learn more accurate similarity relationships. From Figure 3, the accuracy of our method remains relatively stable, unlike other methods, when the number of retrieval points is large, the accuracy decreases obviously.Table 3
The MAP@50 results of two retrieval tasks on NUS-WIDE with various code lengths.
MethodsImage-query-textText-query-image163264128163264128CVH [7]0.3720.3620.4060.3900.4010.3840.4420.432IMH [11]0.4700.4730.4760.4590.4780.4830.4720.462CMFH [24]0.4550.4590.4650.4670.5290.5770.6140.645LSSH [26]0.4810.4890.5070.5070.4550.4590.4160.473DBRC [31]0.4240.4590.4470.4470.4550.4590.4160.473UDCMH [28]0.5110.5190.5240.5580.6370.6530.6950.716DJSRH [29]0.7240.7730.7980.8170.7120.7440.7710.789JDSH [27]0.7360.7930.8320.8350.7210.7850.7940.804Ours0.7640.8090.8370.8360.7590.7960.8080.819The above experimental results on these two datasets verify the superiority of SAKDH and indicate that our method can confirm its effectiveness for cross-modal retrieval and bridge modality gap better than other comparison methods.


### 4.4. Ablation Study

In order to further prove the effectiveness of each part of SAKDH, we designed several variants to evaluate the impact of different modules and prove the superiority of SAKDH. The three variants are listed as follows:(1)
SAKDH-1 is the variant without diagonal alignment module.(2)
SAKDH-2 is the variant without similarity alignment module.(3)
SAKDH-3 is the variant without the student module.We take the MIRFLICKR-25K dataset as an example to show the results of each module, as shown in Table4. It can be seen that each module plays a certain role in SAKDH. Specifically, the results of SAKDH-1 show that the diagonal alignment module can reduce errors and deviations caused by the asymmetry between the similarity matrices of I2T and T2I. The results of SAKDH-2 indicate the importance of the similarity alignment module, which can align hash codes and features from different modalities. Besides, the performance of SAKDH-3 shows that the student module will significantly improve the MAP results, so the student module is a very important component.Table 4
The MAP@50 results at 128 bits for ablation analysis on MIRFLICKR.
MethodConfigurationI2TT2ISAKDHTeacher (LS+LD) + student0.9050.884SAKDH-1Teacher (LS) + student0.8930.879SAKDH-2Teacher (LD) + student0.8760.861SAKDH-3Teacher (LS+LD)0.8510.842


### 4.5. Parameter Sensitivity

In deep learning, the adjustment of hyperparameters may have a very important impact on the system. In this section, we evaluated the impact of several trade-off parameters on the results. Taking the results of MAP@50 on MIRFLICKR as an example, Figures4(a)–4(c) show the results of precision@top-K. The parameter μ can greatly improve the flexibility of our similarity alignment. We adjusted the parameter μ and got the best results at μ=2.5. At the same time, we also observed the impact of parameters α, β, and γ on performance. These three parameters adjust the importance of neighborhood relations in different ways. We cross-validated the hyperparameters α, β, and γ and experimented with the degree of weighing the parameters from 0 to 1. Finally, set α=0.5, β=0.1, and γ=0.4 for MIRFLICKR and set α=0.4, β=0.3, and γ=0.3 for NUS-WIDE.Figure 4
Parameters’ sensitivity analysis on MIRFLICKR. (a) The parameterμ. (b) The parameter α. (c) The parameter β.
(a)(b)(c)


## 4.1. Datasets

MIRFLICKR-25K contains 25015 images, each of which has a corresponding text description, so each instance sample is an image-text pair. There are 24 categories in this dataset, and each instance sample is marked by at least one tag. We used 20,015 samples, of which 2,000 were used as query sets and the rest were used for retrieval. We extracted a 4096-dimensional feature vector from the pretrained 19-layer VGGNet to represent each image and represented each text sample as a 1386-dimensional BoW vector.NUS-WIDE dataset is a relatively large dataset with 269,498 images and 81 labels. Each image corresponds to some text description. We kept the 10 most common concepts, so we ended up with 186,577 text-image pairs. We retain 1% (1865) of the data as a query database and the rest as a retrieval set. Each image is represented by 4096-dimensional feature vector, and each text is represented by 1000-dimensional BoW vector. In our experiment, the specific implementation details of the two cross-modal datasets are shown in Table1.Table 1
Setup of the two cross-modal datasets.
DatasetTotalTraining setTest setLabelsImage featureText featureMIRFLICKR-25k20,01518,0152,000244,096d VGGNet1,386d BoWNUS-WIDE186,57715,0001865104,096d VGGNet1,000d BoW


## 4.2. Evaluation Metric

In order to verify the feasibility of our method, we use two evaluation criteria to evaluate the proposed method: mean average precision (MAP) and top-K precision curve. MAP is one of the most commonly used indicators to jointly evaluate search accuracy and ranking. The top-K precision represents the accuracy under different numbers of retrieval instances. In the experiment, we use two retrieval tasks for cross-modal retrieval: image-query-text (to retrieve text through image query) and text-query-image (to retrieve image through text query).


## 4.3. Experiment Results

We have selected some representative methods for comparison to verify the effectiveness of the proposed SAKDH method. There are a total of 8 unsupervised hashing methods, including four shallow cross-modal hashing methods and four deep cross-modal hashing methods. CVH [7], IMH [11], CMFH [24], and LSSH [26] are shallow methods, while DBRC [31], UDCMH [28], DJSRH [29], and JDSH [27] are deep methods. For fairness, the comparison method applies the same settings as in the original work.


### 4.3.1. Results on MIRFLICKR

Table2 shows the results of MAP@50 on MIRFLICKR, including two cross-mode retrieval tasks with four different length hash codes. The top-K precision curves are shown in Figures 3(a) and 3(b). It can be seen from the table that compared to all comparison methods, SAKDH is always the best. In particular, compared to the best unsupervised shallow method CMFH, our method improved by more than 23.3% and 19.5% for different hash code lengths in two retrieval tasks on MIRFLICKR. Compared to the previous best model (JDSH), our method still gets the best results; we achieve improvements of 2.2%, 2.3%, 1.1%, and 1.3% in image-to-text retrieval tasks for different bits, respectively. We plotted the top-K precision curves for all the methods. We observed that SAKDH maintained optimal performance throughout for both the image-to-text task and text-to-image tasks. This suggests that our approach improves accuracy through semantic alignment and knowledge distillation.Table 2
The MAP@50 results of two retrieval tasks on MIRFLICKR with various code lengths.
MethodsImage-query-textText-query-image163264128163264128CVH [7]0.6060.5990.5960.5980.5910.5830.5760.576IMH [11]0.6120.6010.5920.5790.6030.5950.5890.580CMFH [24]0.6210.6240.6250.6270.6420.6620.6760.685LSSH [26]0.5840.5990.6020.6140.6180.6260.6260.628DBRC [31]0.6170.6190.6200.6210.6180.6260.6260.628UDCMH [28]0.6890.6980.7140.7170.6920.7040.7180.733DJSRH [29]0.8100.8430.8620.8760.7860.8220.8350.847JDSH [27]0.8320.8530.8820.8920.8250.8640.8780.880Ours0.8540.8760.8930.9050.8370.8670.8820.884


### 4.3.2. Results on NUS-WIDE

Table3 lists the MAP@50 results of all methods on NUS-WIDE. We further plotted the top-K precision curves in Figures 3(c) and 3(d). NUS-WIDE is a difficult and challenging dataset. Compared with MIRFLICKR, which has more samples and more complex contents, our approach still leads, but by a smaller margin than MIRFLICKR. Compared with JDSH, our approach still holds the lead. It is important to note that only SAKDH can distill and retain the similarity of different instances, resulting in better performance than other methods. In addition, SAKDH can further improve performance by distilling some data pairs to learn more accurate similarity relationships. From Figure 3, the accuracy of our method remains relatively stable, unlike other methods, when the number of retrieval points is large, the accuracy decreases obviously.Table 3
The MAP@50 results of two retrieval tasks on NUS-WIDE with various code lengths.
MethodsImage-query-textText-query-image163264128163264128CVH [7]0.3720.3620.4060.3900.4010.3840.4420.432IMH [11]0.4700.4730.4760.4590.4780.4830.4720.462CMFH [24]0.4550.4590.4650.4670.5290.5770.6140.645LSSH [26]0.4810.4890.5070.5070.4550.4590.4160.473DBRC [31]0.4240.4590.4470.4470.4550.4590.4160.473UDCMH [28]0.5110.5190.5240.5580.6370.6530.6950.716DJSRH [29]0.7240.7730.7980.8170.7120.7440.7710.789JDSH [27]0.7360.7930.8320.8350.7210.7850.7940.804Ours0.7640.8090.8370.8360.7590.7960.8080.819The above experimental results on these two datasets verify the superiority of SAKDH and indicate that our method can confirm its effectiveness for cross-modal retrieval and bridge modality gap better than other comparison methods.


## 4.3.1. Results on MIRFLICKR

Table2 shows the results of MAP@50 on MIRFLICKR, including two cross-mode retrieval tasks with four different length hash codes. The top-K precision curves are shown in Figures 3(a) and 3(b). It can be seen from the table that compared to all comparison methods, SAKDH is always the best. In particular, compared to the best unsupervised shallow method CMFH, our method improved by more than 23.3% and 19.5% for different hash code lengths in two retrieval tasks on MIRFLICKR. Compared to the previous best model (JDSH), our method still gets the best results; we achieve improvements of 2.2%, 2.3%, 1.1%, and 1.3% in image-to-text retrieval tasks for different bits, respectively. We plotted the top-K precision curves for all the methods. We observed that SAKDH maintained optimal performance throughout for both the image-to-text task and text-to-image tasks. This suggests that our approach improves accuracy through semantic alignment and knowledge distillation.Table 2
The MAP@50 results of two retrieval tasks on MIRFLICKR with various code lengths.
MethodsImage-query-textText-query-image163264128163264128CVH [7]0.6060.5990.5960.5980.5910.5830.5760.576IMH [11]0.6120.6010.5920.5790.6030.5950.5890.580CMFH [24]0.6210.6240.6250.6270.6420.6620.6760.685LSSH [26]0.5840.5990.6020.6140.6180.6260.6260.628DBRC [31]0.6170.6190.6200.6210.6180.6260.6260.628UDCMH [28]0.6890.6980.7140.7170.6920.7040.7180.733DJSRH [29]0.8100.8430.8620.8760.7860.8220.8350.847JDSH [27]0.8320.8530.8820.8920.8250.8640.8780.880Ours0.8540.8760.8930.9050.8370.8670.8820.884


## 4.3.2. Results on NUS-WIDE

Table3 lists the MAP@50 results of all methods on NUS-WIDE. We further plotted the top-K precision curves in Figures 3(c) and 3(d). NUS-WIDE is a difficult and challenging dataset. Compared with MIRFLICKR, which has more samples and more complex contents, our approach still leads, but by a smaller margin than MIRFLICKR. Compared with JDSH, our approach still holds the lead. It is important to note that only SAKDH can distill and retain the similarity of different instances, resulting in better performance than other methods. In addition, SAKDH can further improve performance by distilling some data pairs to learn more accurate similarity relationships. From Figure 3, the accuracy of our method remains relatively stable, unlike other methods, when the number of retrieval points is large, the accuracy decreases obviously.Table 3
The MAP@50 results of two retrieval tasks on NUS-WIDE with various code lengths.
MethodsImage-query-textText-query-image163264128163264128CVH [7]0.3720.3620.4060.3900.4010.3840.4420.432IMH [11]0.4700.4730.4760.4590.4780.4830.4720.462CMFH [24]0.4550.4590.4650.4670.5290.5770.6140.645LSSH [26]0.4810.4890.5070.5070.4550.4590.4160.473DBRC [31]0.4240.4590.4470.4470.4550.4590.4160.473UDCMH [28]0.5110.5190.5240.5580.6370.6530.6950.716DJSRH [29]0.7240.7730.7980.8170.7120.7440.7710.789JDSH [27]0.7360.7930.8320.8350.7210.7850.7940.804Ours0.7640.8090.8370.8360.7590.7960.8080.819The above experimental results on these two datasets verify the superiority of SAKDH and indicate that our method can confirm its effectiveness for cross-modal retrieval and bridge modality gap better than other comparison methods.


## 4.4. Ablation Study

In order to further prove the effectiveness of each part of SAKDH, we designed several variants to evaluate the impact of different modules and prove the superiority of SAKDH. The three variants are listed as follows:(1)
SAKDH-1 is the variant without diagonal alignment module.(2)
SAKDH-2 is the variant without similarity alignment module.(3)
SAKDH-3 is the variant without the student module.We take the MIRFLICKR-25K dataset as an example to show the results of each module, as shown in Table4. It can be seen that each module plays a certain role in SAKDH. Specifically, the results of SAKDH-1 show that the diagonal alignment module can reduce errors and deviations caused by the asymmetry between the similarity matrices of I2T and T2I. The results of SAKDH-2 indicate the importance of the similarity alignment module, which can align hash codes and features from different modalities. Besides, the performance of SAKDH-3 shows that the student module will significantly improve the MAP results, so the student module is a very important component.Table 4
The MAP@50 results at 128 bits for ablation analysis on MIRFLICKR.
MethodConfigurationI2TT2ISAKDHTeacher (LS+LD) + student0.9050.884SAKDH-1Teacher (LS) + student0.8930.879SAKDH-2Teacher (LD) + student0.8760.861SAKDH-3Teacher (LS+LD)0.8510.842


## 4.5. Parameter Sensitivity

In deep learning, the adjustment of hyperparameters may have a very important impact on the system. In this section, we evaluated the impact of several trade-off parameters on the results. Taking the results of MAP@50 on MIRFLICKR as an example, Figures4(a)–4(c) show the results of precision@top-K. The parameter μ can greatly improve the flexibility of our similarity alignment. We adjusted the parameter μ and got the best results at μ=2.5. At the same time, we also observed the impact of parameters α, β, and γ on performance. These three parameters adjust the importance of neighborhood relations in different ways. We cross-validated the hyperparameters α, β, and γ and experimented with the degree of weighing the parameters from 0 to 1. Finally, set α=0.5, β=0.1, and γ=0.4 for MIRFLICKR and set α=0.4, β=0.3, and γ=0.3 for NUS-WIDE.Figure 4
Parameters’ sensitivity analysis on MIRFLICKR. (a) The parameterμ. (b) The parameter α. (c) The parameter β.
(a)(b)(c)


## 5. Conclusions

This work presented a novel unsupervised semantic alignment cross-modal hashing method based on knowledge distillation (SAKDH), which can learn a distilled confidence similarity signals. The method guides the supervised method by the distillation information obtained from the unsupervised method. Under the supervision of teacher model distillation information, student model can generate more discriminative hash codes. Compared with several typical unsupervised cross-modal retrieval methods, SAKDH achieves better retrieval performance on two widely used cross-modal datasets.



---

*Source: 5107034-2021-07-17.xml*