Cross-modal hash retrieval method
Through the cross-modal feature fusion graph attention classification learning module and deep feature extraction, the problem of semantic gap and modal correlation loss in cross-modal hash retrieval is solved, and more efficient cross-modal feature representation and retrieval performance are achieved. .
Patent Information
- Application Number
- CN202311612523.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-29
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2043-11-29
AI Technical Summary
There are semantic gap problems, modal correlation loss and limited feature representation capabilities in existing cross-modal hash retrieval technology, resulting in semantic divergence and information loss of image and text features, affecting model performance.
The cross-modal feature fusion graph attention classification learning module is used, combined with the SwinT-S model and the deep feature extraction module, to optimize text hash code generation and enhance cross-modal features through graph attention feature fusion and multi-scale label feature fusion networks. Representation and robustness.
Effectively reduce the semantic gap, enhance cross-modal hash retrieval performance, improve modal feature fusion capabilities, and improve text feature utilization and retrieval accuracy.
Smart Images

Figure CN118643198A
Abstract
Description
Technical Field
[0001] The present invention mainly relates to the technical field of cross-modal learning, and specifically to a cross-modal hash retrieval method. Background Art
[0002] The cross-modal hash learning method is a data mining and retrieval technology that has emerged in recent years. It uses neural networks to extract effective representations of different modalities and establish semantic associations of different modalities at a high level. It has the advantages of small storage space and fast retrieval speed. At present, cross-modal hash learning aims to maintain the representation consistency and similarity of sample features. It is an intersection of computer vision and natural language processing and has important application value in speech-face matching and retrieval, sign language translation, material recognition and classification, e-commerce, health care, smart cities and other fields.
[0003] The existing technology has the following problems in cross-modal hash retrieval:
[0004] Semantic gap problem: There is a natural semantic difference between images and texts. There is information missing when text describes images, which causes the model to tend to learn the features of the image modality and ignore the text modality, exacerbating the semantic gap problem.
[0005] Modal correlation loss: Existing methods fail to fully consider the correlation between different modalities and lack an effective mechanism to fuse the feature representations of different modalities, leading to the problem of semantic divergence.
[0006] Limited feature representation capability: Some methods have limited representation capabilities for text features in the feature extraction stage. They use a simple fully connected layer to extract text information and are unable to capture deep semantic features. Summary of the invention
[0007] In order to address the deficiencies of the prior art, the present invention provides a cross-modal hash retrieval method, which can effectively reduce the semantic gap problem, integrate different modal features, and improve the performance of cross-modal hash retrieval.
[0008] In order to achieve the above object, the present invention is implemented through the following technical solutions:
[0009] A cross-modal hash retrieval method includes the following steps:
[0010] 1) First, a cross-modal feature learning network including an image network, a text network, and a label network is constructed. Each image-text-label triplet is mapped to a high-dimensional Hamming space through a cross-modal feature fusion graph attention classification learning module.
[0011] 2) As mentioned above, the SwinT-S (SwinT Small model) model is used to extract the semantic features of the image;
[0012] Design two deep feature extraction modules and automatic encoder-decoder as text networks to learn text features. Each text is converted into a bag-of-words (BOW) vector using the bag-of-words method.
[0013] Use the attention network that fuses multi-scale features to extract multi-scale label feature information;
[0014] 3) Use the graph attention feature fusion attention module to deeply fuse and align the acquired image semantic features and text semantic features;
[0015] 4) Use deep text feature extraction network to optimize the generation of text hash codes and generate better quality text hash codes.
[0016] 5) Use the linear layer (Linear) and Tanh (t) function to map the text features to the hash code length required by the present invention.
[0017] In step 1, the cross-modal feature fusion graph attention classification learning module assumes that the features extracted by the image feature extractor and the text feature extractor are and The features extracted by the label network are The adjacency matrix is defined as Where C represents the dimension of the label, that is, the number of categories; the present invention defines each layer of the GAT network symbol as G, and the feature fusion method of the present invention can be expressed as:
[0018]
[0019] F f It is the feature tensor of the present invention after concatenating the tensors of the two modes in dimension 1;
[0020] F stage1 =PReLU(RMSNorm(Linear(F f )))
[0021] where F stage1 It is the feature vector after the first feature depth fusion extraction layer of the present invention;
[0022] The present invention uses GRU to perform deeper cross-modal fusion, and the specific operations are as follows:
[0023] F g =GRU(F stage1 )
[0024] where F g The features extracted by GRU are used in the present invention;
[0025] Then, the present invention performs different forms of weighting operations on the features of different levels, as shown below:
[0026]
[0027]
[0028] in Represents F stage1 The attention generated, F g Attention generated after passing through GRU;
[0029] The present invention will obtain the attention and F g With F stage1 To multiply, the operation is as follows:
[0030]
[0031] Next, the present invention maps the obtained attention back to the original feature space dimension through a linear layer, and performs a residual link with the fused image-text features to enhance the robustness of the network module. The specific operation steps are as follows:
[0032] F att =PReLU(RMSNorm(Linear_Reg(att g )))+F f
[0033] where F att represents the fused attention feature obtained after residual connection, PReLU represents the use of PreLU activation function, RMSNorm represents Root Mean Square Layer Normalization; Linear_Reg represents the linear layer that maps the attention feature to the original feature dimension;
[0034] out f =GMP(ReLU(LKA(ReLU(Conv1D(F att )))))
[0035] Where GMP stands for global maximum pooling, the pooling window is (1,1), LKA stands for local kernel alignment module (LocalKernel Alignment), Conv1D stands for a one-dimensional convolution with a kernel size of 3x3, a stride of 1, and a padding of 1;
[0036] The LKA algorithm is as follows:
[0037] Assume the input tensor is x, whose shape is: [batch_size, d_model]
[0038] ① Create a copy tensor s of x;
[0039] ②, process x through the 1D convolutional layer proj_1, denoted as x′=proj_1(x);
[0040] ③. Apply the ReLU activation function to x′: x′ = ReLU(x′)
[0041] ④. Create variable u, which is a copy of x′: u = x′;
[0042] ⑤. Calculate the attention weight att through three different 1D convolutional layers conv0, conv2, conv1 lka :
[0043] att lka =conv1(conv2(conv0(x′)))
[0044] These convolutional layers are used to calculate attention weights;
[0045] ⑥、Use u and att lka Multiply to get the weighted eigenvector:
[0046] att lka =u·att lka
[0047] ⑦. Att lka After processing by 1D convolutional layer proj_2, the final output is obtained:
[0048] x″=proj_2(att lka )
[0049] ⑧. Add x″ to the copy tensor s to form the result of the residual connection:
[0050] out lka =x″+s
[0051] These formulas represent the LKA algorithm flow, where · represents element-wise multiplication, and ReLU represents the ReLU activation function;
[0052] In the GAT module, the present invention fuses the fusion features obtained by the above process with the features obtained by GAT to obtain a pseudo label. The specific process is as follows:
[0053]
[0054] e ij =LeakyReLU(a T [Wh i ‖Whj ])
[0055] h i represents the feature vector representing node i, which is the output of the previous layer; W represents the weight matrix; A represents the attention weight vector, which is the parameter to be learned; LeakyReLU represents the LeakyReLU activation function; ‖ represents the concatenation operation of the vector; N represents the number of nodes; in GAT, each node i has a corresponding attention weight e between other nodes j. ij to adjust the propagation of information; these attention weights are obtained by linear combination of a and node features, and then normalized to ensure that their sum is 1; finally, h i The new feature of the node ′ is the weighted sum of the features of all adjacent nodes, where the weight is determined by the attention weight e ij Decision; The operation rules of GAT can be expressed as follows:
[0056] G l+1 =g(AG l e ij )
[0057] We define the function output of the last layer of G as out G =g final (F att ,A), which accepts two inputs, F att represents the weighted fusion feature obtained by the above GRU module, and A represents the cosine adjacency matrix. The following process is described as follows:
[0058] M=out G *(h p ) T
[0059] M represents the pseudo label obtained by the GAT module and the fusion module, out G Representing the above attention fusion process, the present invention calculates the similarity probability score between the final pseudo-label and the real label, and the label calculation loss of the present invention is as follows:
[0060]
[0061] Where σ(t) represents the sigmoid function, which is expressed as:
[0062]
[0063] 3. A cross-modal hash retrieval method according to claim 2, characterized in that:
[0064] In step 2, a multi-level module is used to extract the multi-scale features of the label, and the multi-scale features of the label extracted by attention fusion are screened to generate the corresponding hash code. The specific algorithm is as follows:
[0065] K=AEMM1(Z i )
[0066] V=AEMM2(Z i )
[0067] Q = Concat(AEMM3(Z i ),AEMM4(Z i ))
[0068] Among them, AEMM1, AEMM2, AEMM3, and AEMM4 represent non-equal-span convolutions with the step size of the first convolution layer in AEMM being 10, 5, 3, and 1 respectively; the algorithm of AEMM is as follows:
[0069] AEMM j =GMP(ReLU(LKA(ReLU(Conv1D(Z i )))))j∈{1,2,3,4}
[0070] Where j represents the different one-dimensional convolution steps used, Z i Represents the use of different label samples; GMP represents global maximum pooling, and its pooling window size is (1,1);
[0071]
[0072]
[0073] Out labnel-att Represents the feature information extracted by multi-scale attention, AutoEncoder represents the automatic table decoder, and its structure is:
[0074] AutoEncoder label =ReLU(Conv1D2(ReLU(LN(Conv1D1(Out labnel-att )))))
[0075] Where LN stands for layer normalization (LayerNorm), Conv1D u represents the use of one-dimensional convolution, where u represents the dimensions used, 2048 and 8192 respectively;
[0076] The multi-scale label fusion features obtained above are mapped to the hash code length required by the present invention using the linear layer (Linear) and Tanh (t) function:
[0077]
[0078] Among them, H z k represents the text hash code, k represents the length of the hash code, and HashLayer represents the hash layer.
[0079] In step 2, a deep text feature extraction network is used to convert text tags into bag-of-words BoW vectors. The specific algorithm is as follows:
[0080] Out deep_txt_1 =GAP(ReLU(Conv1D txt_1 (Y i )))
[0081] AutoEncoder txt =ReLU(LN(Linear2(ReLU(LN(Linear1(Out deep-txt ))))))
[0082] Where Conv1D txt_1 It represents a one-dimensional convolution with a kernel size of 3x3, a stride of 1, and a padding of 1. Its input dimension is the dimension of the text bag-of-words vector, and its output dimension is 2048. GAP represents global average pooling, and its window size is (1, 1). Linear1 represents an input dimension and an output dimension of 2048 and 8192 respectively. Linear2 is the opposite, with an input dimension and an output dimension of 8192 and 2048 respectively.
[0083] In step 3, the features obtained by the automatic codec are fused using the deep module. The specific process is as follows:
[0084]
[0085] in Represents text features, k represents different feature dimensions, Conv1D txt_2 It represents a one-dimensional convolution with a kernel size of 3x3, a stride of 1, and a padding of 1. Its input dimension is 2048 and its output dimension is also 2048.
[0086] In step 4, the linear layer (Linear) and Tanh (t) function are as follows:
[0087]
[0088] Among them, H y k represents the text hash code, k represents the length of the hash code, and HashLayer represents the hash layer.
[0089] Compared with the prior art, the beneficial effects of the present invention are:
[0090] 1. The present invention proposes a cross-modal hash retrieval framework for heterogeneous network label fusion, which is used to solve the problem of semantic divergence in the network and to compensate for the semantic loss between modalities to a certain extent.
[0091] 2. Based on cross-modal feature fusion, the present invention proposes a graph attention module for modal feature fusion, which can better fuse the feature representations of different modalities to enhance the performance of the network.
[0092] 3. The label network has the effect of enhancing the semantic features of the text. Therefore, the present invention also regards the label information as a modality, and designs a multi-scale label feature fusion attention network, which can better extract label features. Different from the conventional use of a fully connected layer to extract text information, the text network is changed to use a deep feature extraction module and automatic encoding and decoding to extract text features, and the deep feature extraction module is used again before the hash function to better fuse deep text features, thereby improving the utilization rate of text features. BRIEF DESCRIPTION OF THE DRAWINGS
[0093] Attached Figure 1 It is a schematic diagram of the overall framework structure of the present invention;
[0094] Attached Figure 2 It is a schematic diagram of the structure of the attention module of the modal feature fusion graph of the present invention;
[0095] Attached Figure 3 It is a schematic diagram of the structure of the multi-scale label feature fusion attention network of the present invention;
[0096] Attached Figure 4 It is a schematic diagram of the deep feature text network structure of the present invention. DETAILED DESCRIPTION
[0097] The present invention will be further described with reference to the accompanying drawings and specific embodiments. It should be understood that these embodiments are only used to illustrate the present invention and are not intended to limit the scope of the present invention. In addition, it should be understood that after reading the content taught by the present invention, those skilled in the art may make various changes or modifications to the present invention, and these equivalent forms also fall within the scope limited by the application.
[0098] The present invention, like most other methods, uses image-text data pairs for cross-modal hash retrieval. Assuming that there are N pairs of image-text data and their labels, the image-text data and label data are defined using triples, which can be expressed as Where X represents the image, Y represents the text, Z represents the label, and N represents N pairs of image-text-label triplets. Here, the present invention uses a set to represent this relationship. Assume that the image set is defined as The text collection is and a collection of tags Among them, the label network uses One-Hot for encoding, Z n ∈{0,1} C , where C represents the number of label categories. When the image and text samples belong to this class, z nm =1, otherwise z nm =0. Then, the present invention can define a triple set S={(x j ,y j ,x j )|x j ∈X,y j ∈Y,z j ∈Z}. This set S contains all the triplets of images, texts and labels. The hash code is represented by b x ∈{-1,1} M , b y ∈{-1,1} M and b z ∈{-1,1} M , where M represents the length of the hash code, and a sign function is used to generate the corresponding binary hash code function, generally represented by sign(·). It is defined as follows:
[0099]
[0100] The present invention, like most other methods, uses image-text data pairs for cross-modal hash retrieval. Assuming that there are N pairs of image-text data and their labels, the image-text data and label data are defined using triples, which can be expressed as Where X represents the image, Y represents the text, Z represents the label, and N represents N pairs of image-text-label triplets. Here, the present invention uses a set to represent this relationship. Assume that the image set is defined as The text collection is and a collection of tags Among them, the label network uses One-Hot for encoding, Z n ∈{0,1} C , where C represents the number of label categories. When the image and text samples belong to this class, z nm =1, otherwise z nm =0. Then, the present invention can define a triple set S={(x j ,y j ,x j )|x j ∈X,y j ∈Y,z j∈Z}. This set S contains all the triplets of images, texts and labels. The hash code is represented by b x ∈{-1,1} M , b y ∈{-1,1} M and b z ∈{-1,1} M , where M represents the length of the hash code, and a sign function is used to generate the corresponding binary hash code function, generally represented by sign(·). It is defined as follows:
[0101]
[0102] Specifically, as attached Figure 2 As shown, the modal feature fusion graph attention module GAMMF, which is a feature weighted input into the GAT network through GRU and attention after the image and text features are fused to obtain the predicted pseudo-label. The attention network GAT is a graph neural network based on the self-attention mechanism. At present, there is no relevant application of GAT in cross-modal hash retrieval. More GCN is used for feature extraction or classification. The present invention introduces the GAT network into cross-modal hash retrieval, which can effectively learn the representation of graph structure data. GAT can use the structural information of heterogeneous graphs to construct image and text data in a unified space, so as to better capture the high-level semantic relationship between data. The neighbor features are aggregated through a multi-layer graph attention network to enhance the expression ability of each node, and different weights can be adaptively assigned to different neighbors. The model is trained by adversarial loss and triple loss to achieve personalized cross-modal retrieval and improve the accuracy and efficiency of retrieval. In summary, GAT is a method that can effectively fuse image features and text features, which can improve the performance of cross-modal hash retrieval. GAT can use the self-attention mechanism to adaptively weight different modal data to generate more accurate pseudo-labels. This helps solve the problem of insufficient annotation of cross-modal data and improves the generalization ability of the model.
[0103] Some methods use GCN as a feature extractor to extract different modal features, but this will make the retrieval effect worse, because it is impossible to construct a graph-structured retrieval data for each retrieval set. Therefore, the present invention performs weighted operations by fusing the features of different modalities, so that the predicted pseudo-labels can make up for the problem of the lack of text data to a certain extent, and play a complementary role in text data. In the method of the present invention, the present invention applies a cross-modal feature fusion graph attention classification learning module based on feature fusion in the retrieval framework. Although the GAT network requires co-occurrence matrix information, the present invention reuses the adjacency matrix as the co-occurrence matrix through cosine quantization weighted operations. The label information can be considered as a weight matrix to a certain extent in the present invention. By reusing labels and adjacency matrices, feature fusion can optimize the retrieval process, not just in the training stage.
[0104] The cross-modal feature fusion graph attention classification learning module of the feature fusion of the present invention is specifically composed as follows: Figure 2 As shown, it is assumed that the features extracted by the image feature extractor and the text feature extractor are and The features extracted by the label network are The adjacency matrix is defined as Where C represents the dimension of the label, that is, the number of categories. The present invention defines each layer of the GAT network symbol as G, and the feature fusion method of the present invention can be expressed as:
[0105]
[0106] F f It is the feature tensor of the present invention after concatenating the tensors of the two modes in dimension 1;
[0107] F stage1 =PReLU(RMSNorm(Linear(F f )))
[0108] where F stage1 This is the feature vector after the first feature deep fusion extraction layer of the present invention. In order to better fuse the feature representations of different modalities, the present invention uses GRU for deeper cross-modal fusion. The specific operations are as follows:
[0109] F g =GRU(F stage1 )
[0110] where F g The present invention uses GRU to extract the features. Then the present invention performs different forms of weighting operations on the features of different levels, as shown below:
[0111]
[0112]
[0113] in Represents F stage1 The attention generated, F g Attention generated after passing through GRU.
[0114] The present invention will obtain the attention and F g With F stage1 To multiply, the operation is as follows:
[0115]
[0116] Next, the present invention maps the obtained attention back to the original feature space dimension through a linear layer, and performs a residual link with the fused image-text features to enhance the robustness of the network module. The specific operation steps are as follows:
[0117] F att =PReLU(RMSNorm(Linear_Reg(att g )))+F f
[0118] where F att Represents the fused attention feature obtained after residual connection, PReLU represents the use of PreLU activation function, RMSNorm represents Root Mean Square Layer Normalization. Linear_Reg represents the linear layer that maps the attention feature to the original feature dimension.
[0119] out f =GMP(ReLU(LKA(ReLU(Conv1D(F att )))))
[0120] Among them, GMP stands for global maximum pooling, the pooling window is (1,1), LKA stands for local kernel alignment module (LocalKernel Alignment), and Conv1D stands for one-dimensional convolution with a convolution kernel size of 3x3, a stride of 1, and a padding of 1.
[0121] The LKA algorithm is as follows:
[0122] Assume the input tensor is x, whose shape is: [batch_size, d_model]
[0123] 1. Create a copy tensor s of x.
[0124] 2. Process x through the 1D convolutional layer proj_1, denoted as x′=proj_1(x).
[0125] 3. Apply the ReLU activation function to x′: x′ = ReLU(x′)
[0126] 4. Create variable u, which is a copy of x′: u = x′.
[0127] 5. Calculate the attention weight att through three different 1D convolutional layers conv0, conv2, conv1 lka :
[0128] att lka =conv1(conv2(conv0(x′)))
[0129] These convolutional layers are used to calculate attention weights.
[0130] 6. Replace u and att lka Multiply to get the weighted eigenvector:
[0131] att lka =u·att lka
[0132] 7. Att lka After processing by 1D convolutional layer proj_2, the final output is obtained:
[0133] x″=proj_2(att lka )
[0134] 8. Add x″ to the copy tensor s to form the result of the residual connection:
[0135] out lka =x″+s
[0136] These formulas represent the LKA algorithm flow, where · represents element-wise multiplication and ReLU represents the ReLU activation function.
[0137] In the GAT module, the present invention fuses the fusion features obtained by the above process with the features obtained by GAT to obtain a pseudo label. The specific process is as follows:
[0138]
[0139] e ij =LeakyReLU(a T [Wh i ‖Wh j ])
[0140] hi Represents the feature vector representing node i, which is the output of the previous layer. W represents the weight matrix. A represents the attention weight vector, which is the parameter to be learned. LeakyReLU represents the LeakyReLU activation function. ‖ represents the concatenation operation of the vector. N represents the number of nodes. In GAT, each node i has a corresponding attention weight e between it and other nodes j. ij to adjust the propagation of information. These attention weights are obtained by linear combination of a and node features, and then normalized to ensure that their sum is 1. Finally, h i The new feature of the node ′ is the weighted sum of the features of all adjacent nodes, where the weight is determined by the attention weight e ij The operation rules of GAT can be expressed as follows:
[0141] G l+1 =g(AG l e ij )
[0142] We define the function output of the last layer of G as out G =g final (F att ,A), which accepts two inputs, F att represents the weighted fusion feature obtained by the above GRU module, and A represents the cosine adjacency matrix. The following process is described as follows:
[0143] M=out G *(h p ) T
[0144] M represents the pseudo label obtained by the GAT module and the fusion module, out G Representing the above attention fusion process, the present invention calculates the similarity probability score between the final pseudo-label and the real label, and the label calculation loss of the present invention is as follows:
[0145]
[0146] Where σ(t) represents the sigmoid function, which is expressed as:
[0147]
[0148] Since the feature fusion module interacts the features well, the graph attention classification learning module can better generate relatively high-quality pseudo-labels, thereby better compensating for the imbalance of text features and better learning hash representations.
[0149] As attached Figure 3As shown, the multi-scale label feature fusion attention network MSFA is composed of a feature extraction module and four hierarchical multi-scale attention modules that are finally weighted and fused. Label information is the same as text, and both contain a large amount of feature information. When performing cross-modal hash retrieval, the present invention uses labels as a supplement to text to make up for the fact that text semantic features are not rich. Unlike the above method, the modal feature fusion graph attention module is mainly used for a fusion of image and text features, while the label network treats labels as a new modal information. In the cross-modal hash retrieval task, the same image sample corresponds to multiple different labels, so the labels also have multi-scale information. In response to the above problems, the present invention adopts a multi-level module to extract the multi-scale features of labels, and uses the multi-scale features of labels extracted by attention fusion, and screens and generates corresponding hash codes. The specific algorithm is as follows:
[0150] K=AEMM1(Z i )
[0151] V=AEMM2(Z i )
[0152] Q = Concat(AEMM3(Z i ),AEMM4(Z i ))
[0153] Among them, AEMM1, AEMM2, AEMM3, and AEMM4 represent the non-equal-span convolutions with the step size of the first convolution layer in AEMM being 10, 5, 3, and 1 respectively. The algorithm of AEMM is as follows:
[0154] AEMM j =GMP(ReLU(LKA(ReLU(Conv1D(Z i )))))j∈{1,2,3,4}
[0155] Where j represents the different one-dimensional convolution steps used, Z i Represents the use of different label samples. GMP represents global maximum pooling, and its pooling window size is (1,1).
[0156]
[0157]
[0158] Out labnel-att Represents the feature information extracted by multi-scale attention, AutoEncoder represents the automatic table decoder, and its structure is:
[0159] AutoEncoder label=ReLU(Conv1D2(ReLU(LN(Conv1D1(Out labnel-att )))))
[0160] Where LN stands for layer normalization (LayerNorm), Conv1D u represents the use of one-dimensional convolution, where u represents the dimensions used, which are 2048 and 8192 respectively. Finally, the present invention uses a linear layer (Linear) and a Tanh (t) function to map the multi-scale label fusion features obtained above to the hash code length required by the present invention:
[0161]
[0162] Among them, H z k represents the text hash code, k represents the length of the hash code, and HashLayer represents the hash layer.
[0163] As attached Figure 4 As shown, the deep feature text network DSTN is composed of two deep extraction modules and an automatic codec. The present invention uses a deep text feature extraction network to replace the traditional use of a fully connected layer (MLP) or Transformer to convert text tags into a bag of words (BoW) vector, which has sparse characteristics in feature information features. Therefore, compared with the former, it can better learn text features and gather more sparse text features to better learn hash features. Compared with the latter, using Transformer can reduce computing resources and speed up the calculation speed, and has an advantage in the amount of parameters, and does not significantly increase the amount of parameters compared to the previous fully connected layer (MLP).
[0164] The text network proposed by the present invention is relatively simple, and the specific algorithm is as follows:
[0165] Out deep_txt_1 =GAP(ReLU(Conv1D txt_1 (Y i )))
[0166] AutoEncoder txt =ReLU(LN(Linear2(ReLU(LN(Linear1(Out deep-txt ))))))
[0167] Where Conv1D txt_1It represents a one-dimensional convolution with a kernel size of 3x3, a stride of 1, and a padding of 1. Its input dimension is the dimension of the bag-of-words vector, and its output dimension is 2048. GAP represents global average pooling, and its window size is (1, 1). Linear1 represents an input dimension and an output dimension of 2048 and 8192 respectively. Linear2 is the opposite, with an input dimension and an output dimension of 8192 and 2048 respectively.
[0168] In order to better obtain text representation, the present invention finally uses the deep module to fuse the features obtained by the automatic codec. The specific process is as follows:
[0169]
[0170] in Represents text features, k represents different feature dimensions, Conv1D txt_2 It represents a one-dimensional convolution with a kernel size of 3x3, a stride of 1, and a padding of 1. Its input dimension is 2048 and its output dimension is also 2048.
[0171] Finally, the present invention uses a linear layer (Linear) and Tanh (t) function to convert text features into the hash code length required by the present invention:
[0172]
[0173] Among them, H y k represents the text hash code, k represents the length of the hash code, and HashLayer represents the hash layer.
Claims
1. A cross-modal hash retrieval method, characterized in that: The following steps are involved: 1) First, a cross-modal feature learning network including an image network, a text network, and a label network is constructed. Each image-text-label triplet is mapped to a high-dimensional Hamming space through a cross-modal feature fusion graph attention classification learning module. 2) As mentioned above, use SwinT-S, i.e. SwinT Small model, to extract semantic features of the image; Design two deep feature extraction modules and automatic encoder-decoder as text networks to learn text features. Each text is converted into a bag-of-words (BOW) vector using the bag-of-words method. Use the attention network that fuses multi-scale features to extract multi-scale label feature information; 3) Use the feature fusion graph attention classification learning module to deeply fuse and align the acquired image semantic features and text semantic features; 4) Use deep text feature extraction network to optimize the generation of text hash codes and generate better quality text hash codes; 5) Use the linear layer (Linear) and Tanh (t) function to map the text features to the hash code length required by the present invention.
2. A cross-modal hash retrieval method according to claim 1, characterized in that: In step 1, the cross-modal feature fusion graph attention classification learning module assumes that the features extracted by the image feature extractor and the text feature extractor are and The features extracted by the label network are The adjacency matrix is defined as Where C represents the dimension of the label, that is, the number of categories; the present invention defines each layer of the GAT network symbol as G, and the feature fusion method of the present invention can be expressed as: F f It is the feature tensor of the present invention after concatenating the tensors of the two modes in dimension 1; F stage1 =PReLU(RMSNorm(Linear(F f ))) Among them, F stage1 It is the feature tensor after the first feature depth fusion extraction layer is extracted in the present invention.
3. A cross-modal hash retrieval method according to claim 2, characterized in that: The present invention uses GRU to perform deeper cross-modal fusion, and the specific operations are as follows: F g =GRU(F stage1 ) where F g The features extracted by GRU are used in the present invention; Then, the present invention performs different forms of weighting operations on the features of different levels, as shown below: in Represents F stage1 The attention generated, F g Attention generated after passing through GRU.
4. A cross-modal hash retrieval method according to claim 3, characterized in that: The present invention will obtain the attention and F g With F stage1 To multiply, the operation is as follows: Next, the present invention maps the obtained attention back to the original feature space dimension through a linear layer, and performs a residual link with the fused image-text features to enhance the robustness of the network module. The specific operation steps are as follows: F att =PReLU(RMSNorm(Linear_Reg(at g )))+F f where F att represents the fused attention feature obtained after residual connection, PReLU represents the use of PreLU activation function, RMSNorm represents Root Mean Square Layer Normalization; Linear_Reg represents the linear layer that maps the attention feature back to the original feature dimension; out f =GMP(ReLU(LKA(ReLU(Conv1D(F att ))))) Among them, GMP stands for global maximum pooling, the pooling window is (1,1), LKA stands for local kernel alignment module (LocalKernel Alignment), and Conv1D stands for one-dimensional convolution with a convolution kernel size of 3x3, a stride of 1, and a padding of 1.
5. A cross-modal hash retrieval method according to claim 4, characterized in that: The algorithm of LKA is as follows: Assume the input tensor is x, whose shape is: [batch_size, d_model] ① Create a copy tensor s of x; ②, process x through the 1D convolutional layer proj_1, denoted as x′=proj_1(x); ③. Apply the ReLU activation function to x′: x′ = ReLU(x′) ④. Create variable u, which is a copy of x′: u = x′; ⑤. Calculate the attention weight att through three different 1D convolutional layers conv0, conv2, conv1 lka : to lka =conv1(conv2(conv0(x′))) These convolutional layers are used to calculate attention weights; ⑥、Use u and att lka Multiply to get the weighted feature tensor: to lka =u·that lka ⑦. Att lka After processing by 1D convolutional layer proj_2, the final output is obtained: x″=proj_2(to lka ) ⑧. Add x″ to the copy tensor s to form the result of the residual connection: out lka =x″+s These formulas represent the LKA algorithm flow, where · represents element-wise multiplication. multiplication), and ReLU represents the ReLU activation function.
6. A cross-modal hash retrieval method according to claim 2, characterized in that: In the GAT module, the present invention uses the fusion feature F obtained by the above process att The pseudo labels are obtained by fusing with the features obtained by GAT. The specific process is as follows: e ij =LeakyReLU(a T [Wh i ‖Wh j ]) h i represents the feature vector representing node i, which is the output of the previous layer; W represents the weight matrix; A represents the attention weight vector, which is the parameter to be learned; LeakyReLU represents the LeakyReLU activation function; || represents the concatenation operation of the vector; N represents the number of nodes; in GAT, each node i has a corresponding attention weight e between other nodes j. ij to adjust the propagation of information; these attention weights are obtained by linear combination of a and node features, and then normalized to ensure that their sum is 1; finally, h i The new feature of the node ′ is the weighted sum of the features of all adjacent nodes, where the weight is determined by the attention weight e ij Decide; The operation rules of the GAT are as follows: G l+1 =g(AG l e ij ) Output the function definition of the last layer of G as out G =g final (F att ,A), which accepts two inputs, F att represents the weighted fusion feature obtained by the above GRU module, and A represents the cosine adjacency matrix; the following process is described as follows: M=out G *(h p ) T M represents the pseudo label obtained by the GAT module and the fusion module, out G Representing the above attention fusion process, the present invention calculates the similarity probability score between it and the final pseudo-label and the real label; The label loss is calculated as follows: Where σ(t) represents the sigmoid function, which is expressed as:
7. A cross-modal hash retrieval method according to claim 2, characterized in that: In step 2, a multi-level module is used to extract the multi-scale features of the label, and the multi-scale features of the label extracted by attention fusion are screened to generate the corresponding hash code. The specific algorithm is as follows: K=AEMM1(Z i ) V=AEMM2(Z i ) Q=Concat(AEMM3(Z i ),AEMM4(Z i )) Among them, AEMM1, AEMM2, AEMM3, and AEMM4 represent non-equal-span convolutions with the step size of the first convolution layer in AEMM being 10, 5, 3, and 1 respectively; the algorithm of AEMM is as follows: AEMM j =GMP(ReLU(LKA(ReLU(Conv1D(Z i ))))),j∈{1,2,3,4} Where j represents the different one-dimensional convolution steps used, Z i Represents the use of different label samples; GMP represents global maximum pooling, and its pooling window size is (1,1); Out labnel-att Represents the feature information extracted by multi-scale attention, AutoEncoder represents the automatic table decoder, and its structure is: AutoEncoder label =ReLU(Conv1D2(ReLU(LN(Conv1D1(Out labnel-att ))))) Where LN stands for layer normalization (LayerNorm), Conv1D u represents the use of one-dimensional convolution, where u represents the dimensions used, 2048 and 8192 respectively; The multi-scale label fusion features obtained above are mapped to the hash code length required by the present invention using the linear layer (Linear) and Tanh (t) function: Among them, H z k represents the text hash code, k represents the length of the hash code, and HashLayer represents the hash layer.
8. A cross-modal hash retrieval method according to claim 1, characterized in that: In step 2, a deep text feature extraction network is used to convert text tags into bag-of-words BoW vectors. The specific algorithm is as follows: Out deep_txt_1 =GAP(ReLU(Conv1D txt_1 (Y i ))) AutoEncoder txt =ReLU(LN(Linear2(ReLU(LN(Linear1(Out deep-txt )))))) Where Conv1D txt_1 It represents a one-dimensional convolution with a kernel size of 3x 3, a stride of 1, and a padding of 1. Its input dimension is the dimension of the text bag-of-words vector, and its output dimension is 2048. GAP represents global average pooling, and its window size is (1, 1). Linear1 represents an input dimension and an output dimension of 2048 and 8192 respectively. Linear2 is the opposite, with an input dimension and an output dimension of 8192 and 2048 respectively.
9. A cross-modal hash retrieval method according to claim 1, characterized in that: In step 3, the features obtained by the automatic codec are fused using the deep module. The specific process is as follows: in Represents text features, k represents different feature dimensions, Conv1D txt_2 It represents a one-dimensional convolution with a kernel size of 3x 3, a stride of 1, and a padding of 1. Its input dimension is 2048 and its output dimension is also 2048.
10. A cross-modal hash retrieval method according to claim 1, characterized in that: In step 4, the linear layer (Linear) and Tanh (t) function are as follows: Among them, H y k represents the text hash code, k represents the length of the hash code, and HashLayer represents the hash layer.
Citation Information
Patent Citations
A method and system for cross-modal hash retrieval fusing supervisory information
CN109299216A
Joint attention-based cross-modal deep hash retrieval method and system and medium
CN115203442A
Text segmentation recognition method, system and equipment in artificial intelligence field and medium
CN116229584A
Text embedding representation method and system for medical vision-language multi-modal task
CN116704272A
Cited By
Privacy image detection method based on multi-scale features and cross-modal residual attention
CN119625424A
Social network anomaly detection system and method based on network representation learning
CN120744777A
Heterogeneous target association retrieval method based on multi-dimensional feature data
CN122594337A
