Cross-modal hash learning method based on Mama and covariance interactive attention
By introducing Mamba and covariance interactive attention in cross-modal hash learning, combined with CLIP and oblique variance cross-feature fusion modules, the problem that hash codes in the existing technology cannot effectively maintain the similar structure of high-dimensional space is solved and improved Efficiency and accuracy in cross-modal learning.
Patent Information
- Application Number
- CN202410973522.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-19
- Publication Date
- 2024-10-08
AI Technical Summary
The existing cross-modal hash retrieval framework based on CLIP ignores the potential semantic connections between modalities, resulting in hash codes that cannot effectively maintain the high-dimensional spatial similarity structure of the data, low learning efficiency, long training time, and slow convergence.
A cross-modal hash learning method based on Mamba and covariance interactive attention is adopted to learn images and text through CLIP feature extraction backbone, Mamba oblique variance cross feature fusion module and hash layer, combined with proxy loss and hash center balance loss. Features to generate high-quality hash codes.
It effectively reduces the risk of misjudgment caused by the limitation of single modal information, improves the performance and generalization ability of the model in cross-modal learning tasks, and ensures the accuracy and robustness of the output.
Smart Images

Figure CN118747843A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of deep cross-modal hash retrieval, and specifically to a cross-modal hash learning method based on Mamba and covariance interactive attention. Background Art
[0002] With the rapid development of intelligent communication technology, the acquisition and sharing of various data have become more convenient than ever before. Every day, tens of thousands of graphic and text data are pouring into various storage systems. This data flood has put a severe test on the ability to quickly and accurately extract valuable content from the vast amount of information. In particular, when faced with a huge database, the traditional retrieval strategy that relies on precise matching has encountered the problem of "dimensionality curse" and the huge computing cost that comes with it.
[0003] In recent years, the development of deep learning has further promoted the development of cross-modal hash retrieval. Among them, CLIP (Contrastive Language-Image Pre-training) is a breakthrough deep learning framework designed to create a powerful cross-modal understanding system through large-scale unsupervised learning. CLIP adopts a contrastive learning method to optimize the model by learning how to distinguish different sample pairs. In this framework, CLIP processes two modal data at the same time: text and image. It trains the model through a large number of paired images and descriptive texts (such as image titles, tags or descriptions) collected from the Internet. The goal of the model is to predict whether they match when given a pair of images and texts. This process prompts the model to learn high-order semantic associations. The framework includes an image encoder and a text encoder. The image encoder is usually based on Vision Transformer or Convolutional Neural Network (CNN), which is responsible for converting images into high-dimensional vectors; the text encoder is usually based on the Transformer architecture and converts text sequences into vectors. The two encoders encode images and texts respectively, and the final output vectors should have high cosine similarity between semantically similar image-text pairs, while pairs with different semantics have low similarity.
[0004] The existing cross-modal hash retrieval framework based on CLIP usually directly extracts features from data of different modalities by CLIP and then feeds them into the loss module. Although the CLIP framework has a natural alignment function, this often makes people think that there is no need to perform feature learning between modalities after passing through the CLIP framework, which leads to ignoring the potential semantic connection between modalities. This is not conducive to the network's comprehensive grasp of the global semantic information of the data, resulting in the hash code being unable to effectively maintain the similar structure of the original high-dimensional space of the data; secondly, previous work usually uses pairwise loss or triplet loss for similarity metric learning. Since they can only pull in or push away a group of positive and negative samples at a time, they can only capture the similarity of the data locally. It takes repeated rounds of learning to obtain a suitable hash function, and the learning efficiency is low. Secondly, the current cross-modal hash retrieval framework still has problems such as slow convergence and long training time. This overhead also brings a lot of inconvenience to users. Summary of the invention
[0005] The purpose of the present invention is to solve the problems existing in the prior art and provide a cross-modal hash learning method based on Mamba and covariance interactive attention, which can effectively learn the information between different modalities, thereby generating high-quality hash codes, and can fully reduce the risk of misjudgment caused by the limitation of single modal information, ensure the accuracy and robustness of model output, and effectively improve the performance and generalization ability of the model in cross-modal learning tasks.
[0006] In order to achieve the above object, the present invention is implemented through the following technical solutions:
[0007] A cross-modal hashing learning method based on Mamba and covariance interactive attention, comprising the steps of:
[0008] S1. Divide the image dataset and its corresponding category label information into three parts: training set, test set and retrieval set, where each sample includes an image and a corresponding text description, and the number of samples for each category in the training set and the test set is the same;
[0009] S2, preprocessing the image information and cropping the image into the same pixel size as the model input;
[0010] S3. Construct a deep cross-modal hash retrieval architecture based on oblique variance feature fusion and Mamba, including the CLIP feature extraction backbone, the Mamba oblique variance cross feature fusion module, the hash layer and the loss function. The CLIP feature extraction backbone uses ViT-B-32 pre-trained weights, the hash layer includes a fully connected layer, a layer normalization layer and an activation function tanh(·), the loss function includes a proxy loss and a hash center balance loss, the CLIP feature extraction backbone and the Mamba oblique variance cross feature fusion module are used to learn image features, the hash layer is used to learn the construction of the hash function and obtain the hash code of the input image, and the loss function is used to guide the optimization direction of the hash function;
[0011] S4. Using the training set, according to the deep cross-modal hash retrieval architecture based on oblique variance feature fusion and Mamba, a deep cross-modal hash retrieval model based on oblique variance feature fusion and Mamba is obtained through training;
[0012] S5. Input the test set and retrieval set images into the trained deep hash image retrieval model based on frequency domain decoupling and visual Mamba, obtain the hash codes of the test set and retrieval set respectively, adjust the model parameters through the back propagation algorithm, use the validation set to verify the training effect and save the best model;
[0013] S6. Take the best model weight tested on the test set and save it, and save the hash code that performs best on the test set.
[0014] Preferably, in step S3, a CLIP framework is used as a feature extraction network, wherein the image feature extraction module adopts a computer vision vision transform framework, and the text feature extraction module selects a transformer module, and uses a ViT-B-32 pre-trained model.
[0015] Preferably, in step S3, the Mamba oblique variance cross feature fusion module is composed of an oblique variance feature enhancement module and a Mamba feature fusion module, wherein the oblique variance feature enhancement module is composed of matrix calculation, tensor operation and application of nonlinear function, and the Mamba feature fusion module adopts a selective state space model.
[0016] Preferably, the specific algorithm of the oblique variance feature enhancement model is as follows:
[0017] The oblique variance feature enhancement module receives the image features Fi and text features Ft extracted from the feature extraction module, where the matrix size of Fi and Ft is N×D, N is the number of samples, and D is the number of features of each sample, then:
[0018] Compute the sum of sample embeddings:
[0019]
[0020]
[0021] Construct a similarity matrix:
[0022] I=i1i1 T
[0023] T=t1t1 T
[0024] S=IT
[0025] Construct the activation function:
[0026] F = (1-tanh(S) 2 )·σ(S)·(1-σ(S))
[0027] Among them, is the Sigmoid() function, and
[0028] Generate Enhanced Features:
[0029] Ei=F⊙Fi+Fi
[0030] Et=F⊙Ft+Ft
[0031] Among them, Ei is the image enhancement feature, and Et is the enhanced text feature;
[0032] Merge features and output:
[0033] R=[Ei,Et].
[0034] Preferably, the underlying features of the multimodal data are first extracted through the CLIP framework, and then the feature vectors are spliced to obtain fused features, which are then sent to the Mamba feature fusion module. After passing through the oblique variance enhancement module and the Mamba feature fusion module, the two extracted features are weighted summed.
[0035] Preferably, in step S3, the hash layer uses a multi-layer perceptron as a hash mapping function, and the hash mapping function is:
[0036] Z=sign(W (2) σ(W (1) X+b (1 ))+b (2 ))
[0037] Where X is an N×D input matrix, N represents the number of samples, and D represents the dimension of each sample;
[0038] σ is the ReLU activation function, that is, σ(x) = max(0,x);
[0039] W (1) ,W (2) ,b (1) With b (2) These are all parameters that need to be learned, which are adjusted through back-propagation and optimization algorithms to minimize a certain loss function;
[0040] The Sign function is used to convert the tree branch into a hash code of -1 or +1, that is
[0041] Z is the N×H output matrix, and H is the hash code length.
[0042] Preferably, in step S3, the proxy loss adopts a multi-modal multi-label proxy loss function, and the loss function is L PROXY ; It includes cosine distance, unrelated proxy distance and irrelevant loss between modalities,
[0043] Cosine distance:
[0044]
[0045] Among them, h is the corresponding model output and p is the corresponding true label.
[0046] Distance of unrelated agents:
[0047]
[0048] Among them, threshold is a threshold;
[0049] Inter-modality independence loss:
[0050]
[0051] Where M represents the number of inter-modality correlation sample pairs;
[0052] Calculate the losses separately:
[0053]
[0054]
[0055]
[0056] Among them, C represents the number of categories contained in the data set, and D represents the number of features of each sample.
[0057] Therefore, the multimodal multi-label proxy loss function is:
[0058]
[0059] Preferably, in step S3, the hash center balance loss includes center loss, Q loss and balance loss;
[0060] The center loss is:
[0061]
[0062] Among them, u i is the i-th output of the corresponding model, t i is the corresponding true i-th label, and N represents the number of samples;
[0063] The Q loss is:
[0064]
[0065] The balance loss is:
[0066] L CMCBL =L image +L text ;
[0067] Among them, L total =sigmoid(η)(L center +λ×L Q +L balance );
[0068]
[0069] η is a learnable parameter with an initial value of 0.0001, λ is a pre-set hyperparameter with a value of 0.001, and β is a balancing weight with a value of 0.001.
[0070] Preferably, the loss function is:
[0071] L final =L CMCBL +L PROXY .
[0072] Compared with the prior art, the beneficial effects of the present invention are:
[0073] The present invention provides a cross-modal hash learning method based on Mamba and covariance interactive attention, in which the Mamba oblique variance cross feature fusion module can effectively utilize the information between different modalities for feature fusion and enhancement, and the cross-modal classification balance loss proposed in this paper makes up for the shortcomings of the existing loss function. The main contributions of the present invention are as follows:
[0074] 1) This paper proposes a deep cross-modal hash retrieval network based on CLIP, which can effectively learn the information between different modalities and generate high-quality hash codes.
[0075] 2) The present invention provides a Mamba oblique variance cross feature fusion module, which can effectively fuse and enhance information between different modalities, and is composed of a Mamba feature fusion module and an oblique variance enhancement module. The Mamba feature fusion module can fully fuse different modal features by utilizing its own advantages in processing long sequence data, while the oblique variance enhancement module utilizes matrix calculations, tensor operations, and nonlinear functions, which is lightweight and does not require additional parameters. It can effectively fuse different modal information such as images and texts to generate a more comprehensive and in-depth feature representation. The combination of the two can fully reduce the risk of misjudgment caused by the limitation of single modal information and ensure the accuracy and robustness of the model output.
[0076] 3) The present invention provides a new cross-modal classification balance loss, which effectively improves the performance and generalization ability of the model in cross-modal learning tasks by enhancing the utilization of label information and optimizing the balance between multiple modalities. BRIEF DESCRIPTION OF THE DRAWINGS
[0077] Figure 1 It is the overall framework of the present invention;
[0078] Figure 2 This is the model diagram of the Mamba oblique variance cross feature fusion module;
[0079] Figure 3 It is a schematic diagram of a hash map function. DETAILED DESCRIPTION
[0080] The present invention will be further described below in conjunction with 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 can make various changes or modifications to the present invention, and these equivalent forms fall within the scope limited by the application equally.
[0081] Embodiment: The present invention is a cross-modal hash learning method based on Mamba and covariance interactive attention, and the specific implementation steps are as follows:
[0082] Step 1: Divide the image dataset and its corresponding category label information into three parts: training set, test set and retrieval set. Each sample includes an image and a corresponding text description. The number of samples for each category in the training set and the test set is the same.
[0083] Step 2: Preprocess the image information and crop the large image into a size of 224*224 pixels as model input;
[0084] Step 3: Construct a deep cross-modal hash retrieval architecture based on oblique variance feature fusion and Mamba, which includes CLIP (using ViT-B-32 pre-trained weights) feature extraction backbone, Mamba oblique variance cross feature fusion module, hash layer (including fully connected layer, layer normalization layer and activation function tanh(·)) and loss function (including proxy loss and hash center balance loss). The CLIP feature extraction backbone and Mamba oblique variance cross feature fusion module are used to learn image features, the hash layer is used to learn the construction of hash function and obtain the hash code of the input image, and the loss function is used to guide the optimization direction of the hash function.
[0085] Step 4: Using the training set, according to the deep cross-modal hash retrieval architecture based on oblique variance feature fusion and Mamba, a deep cross-modal hash retrieval model based on oblique variance feature fusion and Mamba is obtained through training;
[0086] Step 5: Input the test set and retrieval set images into the trained deep hash image retrieval model based on frequency domain decoupling and visual Mamba to obtain the hash codes of the test set and retrieval set respectively. Adjust the model parameters through the back propagation algorithm. Use the validation set to verify the training effect and save the best model;
[0087] Step 6: Take the best model weight tested on the test set and save it, and save the hash code that performs best on the test set.
[0088] The feature fusion network, hash layer, and loss function mentioned in the above steps are introduced in detail below.
[0089] The deep cross-modal hash retrieval architecture based on oblique variance feature fusion and Mamba is as follows: Figure 1 As shown. First, the CLIP framework is used as the feature extraction network, in which the image feature extraction module adopts the excellent computer vision visiontransform framework, and the transformer module is selected in the text feature extraction module. Using the official ViT-B-32 pre-trained model can greatly reduce the time required for training. In addition, thanks to CLIP's pre-training on large-scale unlabeled image and text pairs, the intrinsic relationship between images and texts is learned, so that modal alignment is naturally formed in the model. In addition, by calculating the similarity between image and text embeddings, positive examples (correct image-text pairs) are brought closer, while negative examples (irrelevant image-text pairs) are pulled away, thereby generating hash codes that are not only fast in retrieval speed on large-scale datasets but also maintain high retrieval accuracy.
[0090] 1. Mamba oblique variance cross feature fusion module
[0091] This module is the core module of the present invention, which is composed of the oblique variance feature enhancement module and the Mamba feature fusion module. Figure 2 As shown, in the Mamba feature fusion module, SSM stands for state space model and Conv stands for convolutional layer.
[0092] Oblique variance enhancement module: This module consists only of matrix calculations, tensor operations, and the application of nonlinear functions. These operations do not add additional parameters when executed. This module can fuse information from different modalities (images and texts) to generate a more comprehensive and in-depth feature representation to better process multimodal data. In this way, by optimizing feature weights and fusion strategies, this module can improve the reliability of the model when facing complex decisions, effectively reduce the risk of misjudgment caused by the limitations of single modality information, and thus ensure the accuracy and robustness of the model output.
[0093] The specific algorithm is as follows:
[0094] This module receives the image features Fi and text features Ft extracted from the feature extraction module, where the matrix size of Fi and Ft is N×D, where N is the number of samples and D is the number of features of each sample, then:
[0095] Compute the sum of sample embeddings:
[0096]
[0097]
[0098] Construct a similarity matrix:
[0099] I=i1i1 T
[0100] T=t1t1 T
[0101] S=IT
[0102] Construct the activation function:
[0103] F = (1-tanh(S) 2 )·σ(S)·(1-σ(S))
[0104] Among them, is the Sigmoid() function, and Compared with the single activation functions Tanh() and Sigmoid(), the output range of the activation function used in the present invention is only (0, 0.25), which helps to maintain the stability of the gradient, thereby effectively reducing the risk of gradient disappearance or gradient explosion, and enhancing the stability of the model. At the same time, it can effectively limit the input of outliers, thereby enhancing the elasticity and noise resistance of the model.
[0105] Generate Enhanced Features:
[0106] Ei=F⊙Fi+Fi
[0107] Et=F⊙Ft+Ft
[0108] Among them, Ei is the image enhancement feature, and Et is the enhanced text feature;
[0109] Merge features and output:
[0110] R=[Ei,Et].
[0111] Mamba feature fusion module: The Mamba framework demonstrates excellent performance in processing long sequence data. Its core competitiveness stems from the innovative use of the Selective State Space Model (SSM). This model mechanism has intelligent screening capabilities, can dynamically evaluate the information value of each token in the sequence, and then make smart decisions on whether to pass or discard information. This method ensures that the model focuses on key segments in the sequence, thereby avoiding indiscriminate processing of all elements, greatly improving the operating efficiency and model performance in long sequence analysis scenarios.
[0112] It is based on the ability of the Mamba framework to efficiently process long sequence data that the present invention cleverly integrates it into the cross-modal feature fusion process. The specific steps are as follows: first, the underlying features of the multimodal data are extracted through the CLIP framework, and then these feature vectors are spliced. Subsequently, this fused feature is sent to the Mamba model, and its unique selective state space mechanism is used to achieve deep integration and optimization of information between different modalities. This process not only enhances the expressiveness of the features, but also promotes the complementarity and synergy of information between modalities, and ultimately produces richer and more comprehensive feature information, which provides strong support for subsequent tasks.
[0113] After the oblique variance enhancement module and the Mamba feature fusion module, the two extracted features are weighted and summed. This will produce complementary feature representations, and weighted fusion can integrate these different features to form a richer and more comprehensive representation, thereby improving the performance and reliability of the model.
[0114] 2. Hash layer:
[0115] The multi-layer perceptron used in the present invention is used as a hash mapping function, which can automatically learn the nonlinear representation of image features. Compared with the traditional thousand-layer hashing method, it can capture more complex and richer feature expressions, thereby generating more effective hash codes. And the entire hash code process is an end-to-end training, which allows the parameters of the entire network to be optimized during the training process. In contrast, some traditional hashing methods may require feature extraction and hash code generation in steps, which may result in information loss or inconsistency. Specific hash functions such as Figure 3 As shown, the hidden layer dimension is 4096 and the output layer hash length is the preset hash length value.
[0116] The hash mapping function used in the present invention can be mathematically explained as follows:
[0117] Z=sign(W (2) σ(W (1) X+b (1) )+b (2) )
[0118] Where X is an N×D input matrix, N represents the number of samples, and D represents the dimension of each sample;
[0119] σ is the ReLU activation function, that is, σ(x) = max(0,x);
[0120] W (1) ,W (2) ,b (1) With b (2) These are all parameters that need to be learned, which are adjusted through back-propagation and optimization algorithms to minimize a certain loss function;
[0121] The Sign function is used to convert the tree branch into a hash code of -1 or +1, that is
[0122] Z is the N×H output matrix, and H is the hash code length.
[0123] 3. Hash learning module:
[0124] The hash learning module is also a loss function module, such as Figure 1 As shown, the loss function is an important factor for the hash code to effectively reflect the similarity relationship between images. The present invention combines the existing multimodal multi-label proxy loss and the proposed cross-modal classification balance loss to optimize the generation of hash codes.
[0125] The multimodal multi-label proxy loss effectively achieves a unified representation of multimodal data by learning hash code representations of images and texts and combining proxies to represent category information. This representation learning enables the model to perform effective semantic association and similarity calculations between different modalities, and can help the model establish a consistent semantic space between images and texts, thereby achieving efficient retrieval or classification tasks.
[0126] However, when the feature space distribution is very different, this method cannot effectively capture the complex relationship between different modalities. In addition, the multimodal multi-label proxy loss mainly focuses on the similarity of samples, but label information is also very important in cross-modal learning.
[0127] In order to make up for the shortcomings of multimodal multi-label proxy loss in cross-modal hash retrieval, the present invention proposes a new cross-modal classification balance loss, whose main supplements and advantages are as follows: this loss strengthens the role of label information in model training by calculating the consistency between hash codes and labels, which helps the model learn more consistent and meaningful feature representations. And when designing feature representations between multiple modalities in cross-modal learning, the introduction of cross-modal classification balance loss can effectively optimize the model through the distance between positive and negative samples, thereby enhancing the model's ability to process multimodal data. This loss effectively improves the performance and generalization ability of the model in cross-modal learning tasks by enhancing the utilization of label information and optimizing the balance between multiple modalities.
[0128] In multimodal multi-label proxy loss: In order to ensure that the related multi-label data can be tightly clustered in the embedding space, while pushing away irrelevant data-proxy pairs, the present invention adopts a multimodal multi-label proxy loss function for optimizing model parameters, which includes cosine distance, irrelevant proxy distance and inter-modality irrelevant loss.
[0129] Cosine distance:
[0130]
[0131] Among them, h is the corresponding model output and p is the corresponding true label.
[0132] Distance of unrelated agents:
[0133]
[0134] Here, threshold is a threshold used to determine when similarity should be considered a negative impact. You can refer to "HHF: Hashing-guided Hinge function for deep hashing retrieval," for setting.
[0135] Inter-modality independence loss:
[0136]
[0137] Where M represents the number of inter-modality correlation sample pairs
[0138] Calculate the losses separately:
[0139]
[0140]
[0141]
[0142] Among them, C represents the number of categories contained in the data set, and D represents the number of features of each sample.
[0143] In summary, our multimodal proxy loss takes into account both the irrelevant loss within the modality and the irrelevant loss between modalities. Therefore, the multimodal multi-label proxy loss function is:
[0144]
[0145] The cross-modal classification balanced loss (hash center balanced loss) consists of three parts: center loss, Q loss and balanced loss.
[0146] Center loss: Its function is to help the model learn the central position of each category in the feature space, thereby improving the clustering effect of feature representation. Center loss optimizes the central position of each category in the feature space, making the feature representation of samples of the same category more compact and clustered together. This clustering effect helps to improve the efficiency of retrieval tasks, because similar samples are closer in the feature space and easier to retrieve. And by minimizing the distance from the sample to its category center, center loss can also enhance the discriminability of the feature. And the present invention only penalizes the misclassified class, as shown in the following formula:
[0147]
[0148] Among them, u i is the i-th output of the corresponding model, t i is the corresponding true i-th label, and N represents the number of samples;
[0149] Q loss: By constraining the range of feature vectors, the model is prompted to generate more discriminative and expressive hash codes, thereby improving the performance of cross-modal hash retrieval tasks. Specifically, the role of Q loss is to limit the value range of feature vectors to make them as close to extreme values (-1 and 1) as possible to reduce the overlap and confusion between hash codes, thereby enhancing the discriminative and expressive ability of hash codes. The specific calculation method of Q loss is:
[0150]
[0151] Balanced loss: By focusing more on less frequent categories, the model's generalization and robustness in multi-label classification or multimodal data is enhanced. This loss mechanism helps adjust the model's learning focus so that it can handle samples of different categories in the data more balanced, thereby improving overall performance. The specific calculation method is as follows:
[0152]
[0153] Its main purpose is to measure the difference of label distribution around 0.5 and perform weighted processing in combination with the balance weight, where β is the balance weight and its value is 0.001.
[0154] Therefore, the cross-modal classification balance loss is the weighted sum of the above three losses, as shown below:
[0155] L total =sigmoid(η)(L center +λ×L Q +L balance )
[0156] Among them, η is a learnable parameter with an initial value of 0.0001, and λ is a pre-set hyperparameter with a value of 0.001.
[0157] L total =sigmoid(η)(L center +λ×L Q +L balance )
[0158] Calculate the cross-modal classification balance loss L between the hash codes generated for images and text and the label t image and L text , and weighting them to obtain the cross-modal classification balance loss as follows:
[0159] L CMCBL =L image +L text
[0160] Therefore, the total loss of the hash learning module is as follows:
[0161] L final =L CMCBL +L PROXY .
Claims
1. A cross-modal hashing learning method based on Mamba and covariance interactive attention, characterized in that: Includes steps: S1. Divide the image dataset and its corresponding category label information into three parts: training set, test set and retrieval set, where each sample includes an image and a corresponding text description, and the number of samples for each category in the training set and the test set is the same; S2, preprocessing the image information and cropping the image into the same pixel size as the model input; S3. Construct a deep cross-modal hash retrieval architecture based on oblique variance feature fusion and Mamba, including the CLIP feature extraction backbone, the Mamba oblique variance cross feature fusion module, the hash layer and the loss function. The CLIP feature extraction backbone uses ViT-B-32 pre-trained weights, the hash layer includes a fully connected layer, a layer normalization layer and an activation function tanh(·), the loss function includes a proxy loss and a hash center balance loss, the CLIP feature extraction backbone and the Mamba oblique variance cross feature fusion module are used to learn image features, the hash layer is used to learn the construction of the hash function and obtain the hash code of the input image, and the loss function is used to guide the optimization direction of the hash function; S4. Using the training set, according to the deep cross-modal hash retrieval architecture based on oblique variance feature fusion and Mamba, a deep cross-modal hash retrieval model based on oblique variance feature fusion and Mamba is obtained through training; S5. Input the test set and retrieval set images into the trained deep hash image retrieval model based on frequency domain decoupling and visual Mamba, obtain the hash codes of the test set and retrieval set respectively, adjust the model parameters through the back propagation algorithm, use the validation set to verify the training effect and save the best model; S6. Take the best model weight tested on the test set and save it, and save the hash code that performs best on the test set.
2. A cross-modal hashing learning method based on Mamba and covariance interactive attention according to claim 1, characterized in that: In step S3, the CLIP framework is used as the feature extraction network, in which the image feature extraction module adopts the computer vision vision transform framework, and the text feature extraction module selects the transformer module and uses the ViT-B-32 pre-trained model.
3. A cross-modal hashing learning method based on Mamba and covariance interactive attention according to claim 1, characterized in that: In step S3, the Mamba oblique variance cross feature fusion module is composed of an oblique variance feature enhancement module and a Mamba feature fusion module, wherein the oblique variance feature enhancement module is composed of matrix calculation, tensor operation and application of nonlinear functions, and the Mamba feature fusion module adopts a selective state space model.
4. A cross-modal hashing learning method based on Mamba and covariance interactive attention according to claim 3, characterized in that: The specific algorithm of the oblique variance feature enhancement model is as follows: The oblique variance feature enhancement module receives the image features Fi and text features Ft extracted from the feature extraction module, where the matrix size of Fi and Ft is N×D, N is the number of samples, and D is the number of features of each sample, then: Compute the sum of sample embeddings: Construct a similarity matrix: I=i1i1 T T=t1t1 T S=IT Construct the activation function: F=(1-tanh(S) 2 )·σ(S)·(1-σ(S)) Among them, is the Sigmoid() function, and Generate Enhanced Features: Ei=F⊙Fi+Fi Et=F⊙Ft+Ft Among them, Ei is the image enhancement feature, and Et is the enhanced text feature; Merge features and output: R=[Ei,Et].
5. A cross-modal hashing learning method based on Mamba and covariance interactive attention according to claim 3, characterized in that: First, the underlying features of multimodal data are extracted through the CLIP framework, and then these feature vectors are spliced to obtain fused features. The fused features are then sent to the Mamba feature fusion module. After passing through the oblique variance enhancement module and the Mamba feature fusion module, the two extracted features are weighted summed.
6. A cross-modal hashing learning method based on Mamba and covariance interactive attention according to claim 1, characterized in that: In step S3, the hash layer uses a multi-layer perceptron as a hash mapping function, and the hash mapping function is: Z=sign(W (2) σ(W (1) X+b (1) )+b (2) ) Where X is an N×D input matrix, N represents the number of samples, and D represents the dimension of each sample; σ is the ReLU activation function, that is, σ(x) = max(0,x); W (1) ,W (2) ,b (1) With b (2) These are all parameters that need to be learned, which are adjusted through back-propagation and optimization algorithms to minimize a certain loss function; The Sign function is used to convert the tree branch into a hash code of -1 or +1, that is Z is the N×H output matrix, where H is the hash code length.
7. A cross-modal hashing learning method based on Mamba and covariance interactive attention according to claim 1, characterized in that: In step S3, the proxy loss adopts a multimodal multi-label proxy loss function, and the loss function is L PROXY , including cosine distance, irrelevant proxy distance and irrelevant loss between modalities, Cosine distance: Among them, h is the corresponding model output, and p is the corresponding true label; Distance of unrelated agents: Among them, threshold is a threshold; Inter-modality independence loss: Where M represents the number of inter-modality correlation sample pairs; Calculate the losses separately: Among them, C represents the number of categories contained in the data set, and D represents the number of features of each sample; Therefore, the multimodal multi-label proxy loss function is:
8. A cross-modal hashing learning method based on Mamba and covariance interactive attention according to claim 7, characterized in that: In step S3, the hash center balance loss includes center loss, Q loss and balance loss; The center loss is: Among them, u i is the i-th output of the corresponding model, t i is the corresponding true i-th label, and N represents the number of samples; The Q loss is: The balance loss is: L CMCBL =L image +L text ; Among them, L total =sigmoid(η)(L center +λ×L Q +L balance ); η is a learnable parameter with an initial value of 0.0001, λ is a pre-set hyperparameter with a value of 0.001, and β is a balancing weight with a value of 0.
001.
9. A cross-modal hashing learning method based on Mamba and covariance interactive attention according to claim 8, characterized in that: In step S3, the loss function is: L final =L CMCBL +L PROXY .
Citation Information
Cited By
Automatic parallel method based on double TMAN and strategy gradient optimization
CN119558378A
Visual Mama model fine tuning method based on selective prompt
CN119723231A
A method for fine-tuning a visual Mamba model based on selective cues
CN119723231B
ADHD classification diagnosis method based on multi-modal attention fusion network
CN119867752A
Remote sensing image text retrieval method and device based on Mamba adapter and sharing prompt enhancement
CN120144816A
