Cross-modal hash retrieval model training method and device and cross-modal hash retrieval method and device
Through adaptive gradient triple loss and step-by-step quantization loss, the problem of gradient fixation and embedding space conflict in the deep cross-modal hashing method is solved, the discriminant and retrieval performance of hash code is improved, and more efficient cross-modal retrieval is achieved.
Patent Information
- Application Number
- CN202510987462.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-17
- Publication Date
- 2025-08-19
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the existing deep cross-modal hashing method, the gradient and threshold of traditional triple loss are fixed, making it difficult to distinguish hard negative samples, and similarity learning and quantization constraint conflicts lead to damage to the embedded space structure, affecting the accuracy and retrieval performance of the hash code.
Adaptive gradient triple loss and step-by-step quantization loss are adopted, and the gradient is adjusted and staged optimization is used to maintain the consistency of neighborhood relationships and semantic structures, and decoupled representation learning and binary code generation.
It improves the discriminant ability and retrieval performance of the cross-modal hash retrieval model, generates more accurate and robust hash codes, and improves the efficiency and accuracy of cross-modal retrieval.
Smart Images

Figure CN120508684A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information retrieval technology, and in particular to a cross-modal hash retrieval model training method, a retrieval method, and a device. Background Art
[0002] The development of the internet and smart devices has led to a surge in multimedia data. Traditional single-modal search is limited, making cross-modal search (enabling efficient matching between different types of data, such as searching for text using images) a research hotspot. Faced with massive amounts of data, hash learning, by encoding data into binary codes and leveraging bitwise operations to significantly reduce storage costs and increase search speed, is a key technology for achieving efficient cross-modal search.
[0003] The key challenge of cross-modal hashing methods is to bridge the heterogeneous gap between modalities and effectively measure similarity. Existing cross-modal hashing methods can be divided into three main categories: unsupervised methods do not rely on labels and learn the data's inherent structure; semi-supervised methods combine a small amount of labels with a large amount of unlabeled data, using labels to guide learning; and supervised methods rely entirely on labels to optimize similarity metrics.
[0004] Inspired by the powerful feature learning capabilities of deep neural networks, deep cross-modal hashing methods have made significant progress recently and achieved excellent retrieval performance. However, deep cross-modal hashing methods still have some problems: (1) The gradient and threshold of the traditional triple loss are usually fixed and require empirical selection. It mainly focuses on the relative distance between data points and ignores the actual distance. Therefore, when the anchor point is very close to the negative sample, it is difficult for the model to distinguish hard negative samples, which weakens the model's discrimination ability and optimization effect. In addition, since the gradient update remains fixed, it cannot be dynamically adjusted according to the difficulty changes of the sample pair. In addition, when the relative distance between positive and negative samples exceeds the preset threshold, the cross-modal hashing network is difficult to learn effectively, which in turn affects the accuracy of the hash code. (2) Most deep cross-modal hashing methods introduce similarity learning terms and quantization constraints in the loss function at the same time. Optimizing the similarity preservation and binarization objectives at the same time often leads to a conflict between the embedding objective and the quantization objective. The interaction between the two may destroy the structure of the embedding space, thereby generating suboptimal hash codes. Due to the above reasons, the performance of cross-modal hashing is far from satisfactory. Summary of the Invention
[0005] In order to solve at least one problem in the prior art, the present invention provides a cross-modal hash retrieval model training method, a retrieval method and a device.
[0006] A first aspect of the present invention provides a cross-modal hash retrieval model training method, which includes the following steps: Extract features from a training sample set, where the training sample set includes anchor samples, positive samples, and negative samples; Inputting the above features into a hash network and training the above hash network; wherein the above features are mapped into continuous hash codes, and the above continuous hash codes are binarized; Update the parameters of the above hash network according to the overall target loss to obtain a cross-modal hash retrieval model; Among them, the above-mentioned overall target loss includes adaptive gradient triplet loss and step-by-step quantization loss. The above-mentioned adaptive gradient triplet loss is adaptively adjusted according to the cosine similarity between the anchor point sample and the negative sample and the cosine similarity between the anchor point sample and the positive sample during the training process. The above-mentioned step-by-step quantization loss only takes effect in the above-mentioned binarization process.
[0007] It should be noted that the adaptive gradient triplet loss can assign adaptive gradients to triplets of different difficulties by introducing constraints based on the angle between the anchor point and the negative sample, so as to maintain the consistency of the neighborhood relationship in the original space, promote the intra-class compactness and inter-class separability of heterogeneous modalities, and retrieve samples that are semantically similar to the query sample; the step-by-step quantization loss decouples representation learning and binary code generation. This two-stage design retains the semantic structure in the embedding stage and minimizes the subsequent quantization loss; in this way, the cross-modal hash retrieval model has good retrieval performance.
[0008] In some optional embodiments, features in the training sample set are extracted through a pre-trained Transformer network.
[0009] In some optional embodiments, the adaptive gradient triplet loss is calculated as follows: ; in, represents the adaptive gradient triplet loss; represents the adaptive threshold, represents the angle constraint term, represents the coefficient; , Represents the cosine similarity between the anchor point and the positive sample, represents the cosine similarity between the anchor point and the negative sample; [·] + Represents the ReLU function.
[0010] In some optional embodiments, the above-mentioned adaptive threshold and angle constraints Calculated by the following formula: ; ; in, Representing a collection The mean of x ai 、x ptand x nt Represent image anchor samples, text positive samples and text negative samples respectively, represents the set of all triples; Representing a collection The mean of is a hyperparameter, Represents the set of positive integers.
[0011] In some optional embodiments, the step-by-step quantization loss is calculated as follows: ; in, represents the step-by-step quantization loss, n represents the total number of samples, represents the embedded function; ; ; ; in, represents the sign function, K represents the number of bits of the hash code, P(r) represents the orthogonal transformation group, Δ represents the product of the Householder matrix, Indicates the value of the input variable when the objective function reaches the minimum value; This means that the normalized features are placed in the Euclidean sphere containing the hash code.
[0012] In some optional embodiments, the above-mentioned overall target loss is calculated by the following formula: ; in, Indicates the overall target loss; represents the adaptive gradient triplet loss; represents a hyperparameter; represents the step-wise quantization loss.
[0013] A second aspect of the present invention provides a cross-modal hash retrieval method, which includes the following steps: The image to be retrieved is input into the cross-modal hash retrieval model obtained by the above-mentioned cross-modal hash retrieval model training method, and the cross-modal hash retrieval model outputs the retrieval result.
[0014] A third aspect of the present invention provides a cross-modal hash retrieval device, comprising: An acquisition module, for receiving an image to be retrieved; A retrieval module, which has a built-in cross-modal hash retrieval model obtained by the cross-modal hash retrieval model training method, and is used to retrieve the above-mentioned images to be retrieved; The output module is used to receive the search results obtained by the search module and output the search results.
[0015] A fourth aspect of the present invention provides an electronic device comprising a memory and a processor, wherein the memory is used to store a computer program; and the processor is used to execute the above-mentioned cross-modal hash retrieval model training method or cross-modal hash retrieval method according to the computer program.
[0016] A fifth aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program; when the computer program is executed by a processor, it implements the above-mentioned cross-modal hash retrieval model training method or cross-modal hash retrieval method.
[0017] The technical solution of the embodiment of the present invention has the following beneficial effects: An adaptive gradient triplet loss is applied, which uses an adaptive gradient and threshold mechanism. By introducing a constraint term based on the angle between the anchor point and the negative sample, a dynamic gradient penalty is imposed on triplets of different difficulty in the loss function. Hard negative samples with large angle deviations will receive stronger gradient updates, forcing the model to improve its ability to discriminate such samples in the feature space. During model training, the cross-modal hash network can continue to optimize parameters even if the distance between positive and negative samples is large. A step-by-step quantization loss is adopted to decouple representation learning and binary code generation. This two-stage design maintains the integrity of the semantic structure in the embedding stage and minimizes the quantization loss in subsequent stages. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 Schematic diagram of the network structure of the cross-modal hash retrieval model in an embodiment of the present invention.
[0019] Figure 2 The PR curves of each model on the NUS-WIDE dataset, where (a) is the 32-bit hash code PR curve of the image-to-text modality, (b) is the 64-bit hash code PR curve of the image-to-text modality, (c) is the 32-bit hash code PR curve of the text-to-image modality, and (d) is the 64-bit hash code PR curve of the text-to-image modality.
[0020] Figure 3 The TopN-accuracy curves of each model on the NUS-WIDE dataset, where (a) is the 32-bit hash code TopN-accuracy curve of the image-to-text modality, (b) is the 64-bit hash code TopN-accuracy curve of the image-to-text modality, (c) is the 32-bit hash code TopN-accuracy curve of the text-to-image modality, and (d) is the 64-bit hash code TopN-accuracy curve of the text-to-image modality. DETAILED DESCRIPTION
[0021] The following will be combined with the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0022] Existing deep cross-modal hashing frameworks usually use triplet loss to learn model parameters. However, the limitation of triplet loss is that it requires manual selection of a threshold parameter. , and it may not be able to handle the situation where the anchor point is too close to the negative sample. When the negative sample is too close to the anchor point, the model has difficulty distinguishing it from the positive sample, which impairs its discrimination ability and convergence. Moreover, due to the use of a fixed gradient, the model cannot adaptively respond to samples of different difficulty levels. In addition, the prediction is only effective when the distance between the positive and negative sample pairs falls within a preset threshold parameter. The deep cross-modal hashing model can be effectively trained only when the number of nodes is within the bounds; otherwise, it may lead to training failure or model crash.
[0023] Because discrete hash codes are difficult to optimize directly, a common approach is to first obtain continuous embeddings through similarity learning and then binarize them. However, this binarization step often introduces significant quantization error, which can be considered a lossy compression and reduces retrieval accuracy. Many deep cross-modal hashing methods attempt to alleviate this problem by combining similarity learning and quantization penalties into a joint loss function. However, these conflicting objectives can distort the embedding space, leading to suboptimal hash codes.
[0024] To this end, embodiments of the present invention provide a cross-modal hash retrieval model training method, a retrieval method, and a device.
[0025] According to an embodiment of the present invention, a cross-modal hash retrieval model is first trained using a cross-modal hash retrieval model training method, and then the cross-modal hash retrieval model is used for retrieval. For ease of representation, the cross-modal hash retrieval model is labeled as DAGtH.
[0026] like Figure 1 As shown in the figure, during the model training phase, a deeper network architecture (pre-trained Transformer) is used to extract sample feature descriptors. For hash learning, an adaptive gradient triplet loss is used to assign adaptive gradients to triplets of varying difficulty levels to maintain the consistency of neighborhood relationships in the original space. A step-by-step quantization loss is used to reduce the lossy compression caused by quantization. During the model testing phase, a sign function is added to enable the hash layer to generate discrete hash codes.
[0027] Specifically, for feature extraction, a pre-trained Transformer network is selected as the feature extractor to extract image and text features. The pre-trained Transformer network is used as the backbone to extract the global embedding representation of the sample. By utilizing the multi-head self-attention mechanism, the Transformer is good at capturing long-distance dependencies, thereby achieving richer semantic alignment between images and text. Specifically in cross-modal retrieval applications, a feature extraction method based on the Transformer encoder is introduced to extract semantic features of image and text modalities respectively. The image encoder can contain 12 encoding blocks, each of which captures the global features in the image through the self-attention mechanism, and further performs nonlinear transformation through a multi-layer perceptron (MLP) to obtain image features with more semantic expression capabilities. For the text modality, feature learning is also performed through 12 encoding blocks, each of which has 8 attention heads, which can effectively capture the contextual information and semantic relationships in the text.
[0028] For hash learning, we first build a hash layer (hash network). The hash layer is used to map the extracted high-dimensional features into K-bit hash codes (K is the length of the generated hash code). Using a bit-based linear transformation function as the hash map, the output of the hash layer is as follows:
[0029] in, represents the transpose of the weights of the hash layer, Represents the features extracted by the Transformer encoder; represents the bias parameter.
[0030] Obviously, the output of the hashing layer Is a continuous output vector. In order to obtain the discretized binary code , the bit-based conversion function is defined as follows:
[0031] in, represents a sign function. If ,but ,otherwise .
[0032] Secondly, an adaptive gradient triplet loss is constructed to update the parameters of the hash layer.
[0033] An additional constraint term is proposed from the inter-modal perspective , as shown below:
[0034] in, represents the cosine similarity between the anchor point and the negative sample, Represents the angle constraint. By combining the traditional triplet loss and the additional constraint The inter-modal adaptive gradient triplet loss is obtained, which is expressed as follows:
[0035] in,[·] + Represents the ReLU function, for example [y] + =max(y,0), take the maximum value of input y, if y>0, output y, otherwise output 0; Represents the cosine similarity between the anchor point and the negative sample; Represents the cosine similarity between the anchor point and the positive sample; represents a non-negative threshold parameter; Represents the angle constraint item; Represents the coefficient, which determines the angle constraint The weight of . Different from the traditional triplet loss, about and The gradient of will adjust its size and direction according to the difficulty of the triplet sample, and the gradient is as follows:
[0036] in, represents a triple, and denote the set of all difficult triplets and the set of all triplets containing hard negative pairs, respectively. ai 、x pt and x nt They represent image anchor samples, text positive samples, and text negative samples respectively.
[0037] Accordingly, the image-modality adaptive gradient triplet loss is expressed as follows:
[0038] in, represents the cosine similarity between the anchor point and the negative sample, Represents the cosine similarity between the anchor point and the positive sample. about and The gradient of is as follows:
[0039] in, and denote the set of all difficult triplets and the set of all triplets with difficult negative pairs, respectively.
[0040] The adaptive gradient triplet loss function in text modality is:
[0041] in, represents the cosine similarity between the anchor point and the negative sample, Represents the cosine similarity between the anchor point and the positive sample. about and The gradient of is as follows:
[0042] in, and denote the set of all difficult triplets and the set of all triplets with difficult negative pairs, respectively.
[0043] The total adaptive gradient triplet loss function is:
[0044] in, represents the adaptive gradient triplet loss function; 、 、 They represent the adaptive gradient triplet loss functions within the image modality, within the text modality, and between the image and text modalities, respectively.
[0045] Previous studies have shown that difficult negative samples are beneficial for model training. From a cross-modal perspective, in the adaptive gradient triplet loss, taking the inter-modal loss as an example, the mining of difficult negative samples no longer relies on the traditional triplet constraint criterion. , and adopt a new adaptive threshold learning strategy. Specifically, by By imposing numerical constraints, the training process no longer relies entirely on the traditional definition of difficult negative samples, thus achieving optimization. As training progresses, the model will gradually find it easier to satisfy the constraints. Let , the inter-modality adaptive gradient triplet loss can be rewritten as:
[0046] Among them, the threshold parameter and angle constraints According to the training process and The distribution statistics of are adaptively adjusted, and the corresponding calculation formula is as follows:
[0047]
[0048] in, Representing a collection The mean of x ai 、x pt and x nt Represent image anchor samples, text positive samples, and text negative samples, respectively. represents the set of all triples; Representing a collection The mean of is a hyperparameter, Represents the set of positive integers.
[0049] Correspondingly, the intra-image adaptive gradient triplet loss can be rewritten as:
[0050] The in-text adaptive gradient triplet loss can be rewritten as:
[0051] The model is also trained using a step-wise quantization loss that decouples the learning process into two stages: the first stage focuses solely on learning semantically meaningful embeddings without introducing any quantization constraints; the second stage optimizes an orthogonal transformation that aligns continuous embeddings with their corresponding binary hash codes. Crucially, because the orthogonal transformation preserves the inner product, the semantic structure of the learned representation is maintained during the binarization process. This reduces the quantization-induced distortion typically associated with lossy compression, resulting in more accurate and robust hash codes. Specifically, the discriminative features It is learned by adaptive gradient triplet loss without quantization penalty. To avoid poor model performance due to feature scale differences, these feature representations are normalized as follows:
[0052] The Householder matrix parameterization method is used in combination with stochastic gradient descent to optimize the orthogonal transformation, thereby effectively binarizing the embedding and minimizing the quantization error without affecting similarity learning. Specifically, the loss function minimizes the distance between each transformed feature vector and its sign value (i.e., the binarization target ±1):
[0053] where Δ is parameterized as the product of Householder matrices.
[0054] In the supervised deep cross-modal hashing framework, the orthogonal transformation group P(r) is optimized. This achieves the aforementioned goal of minimizing the quantization error and discretizes the feature space.
[0055] The image intra-modality loss function is:
[0056] The loss function in text mode is:
[0057] in, , represents a hash function based on Householder quantization.
[0058] Finally, the step-by-step quantization loss is:
[0059] Direct quantization typically binarizes each dimension independently without considering the overall geometric structure of the embedding space, potentially mapping semantically similar samples to binary codes that are far apart in the hash space. Unlike direct quantization, orthogonal transformations maintain the inner product constant, thereby preserving semantically similar structures during binarization and effectively alleviating the lossy compression issues common in deep hashing. By minimizing quantization error, this not only enhances the discriminability of hash codes but also ensures their semantic consistency in Hamming space, significantly improving model performance and efficiency when processing multimodal data.
[0060] Combining the adaptive gradient triplet loss and the step-by-step quantization loss, the final overall objective loss function is as follows:
[0061] in, Indicates the overall target loss; represents the adaptive gradient triplet loss; represents a hyperparameter; represents the step-wise quantization loss.
[0062] By training with a training sample set and updating parameters based on the overall objective loss, a cross-modal hash retrieval model can be obtained. The query set sample is input into the trained cross-modal hash retrieval model to obtain the hash code of the query set sample. The hash code of the query set sample is compared with the hash codes in the hash code library. The differences are ranked, and the retrieval results are output based on the ranking results. The Hamming distance between the hash code of the query set sample and each hash code in the hash code library is calculated; a smaller Hamming distance indicates a smaller difference.
[0063] The following describes an experiment to verify the performance of the cross-modal hashing retrieval model (DAGtH). The benchmark datasets used in the experiment include MIRFLICKR-25K, NUS-WIDE, and IAPRTC-12.
[0064] MIRFLICKR-25K is a widely used dataset for cross-modal retrieval tasks, primarily sourced from the Flickr platform. The dataset contains 24,581 image-text pairs, divided into 24 categories, with each sample pair assigned to at least one category.
[0065] NUS-WIDE is a large and diverse cross-modal dataset widely used in deep hashing research. Following standard protocols, categories with insufficient sample sizes were filtered out during preprocessing. The resulting dataset contains 195,834 image-text pairs covering 21 different categories.
[0066] The IAPRTC-12 dataset is a commonly used dataset in the field of computer vision. It contains approximately 20,000 images covering a variety of subjects, including people, animals, and landscapes. Each image has at least one label from 255 categories. In our experiments, we used the English image descriptions provided in the dataset.
[0067] Ten typical deep cross-modal hashing models were selected for comparison with the DAGtH of the present invention. These models include Deep Cross-Modal Hashing (DCMH), Cross-Modal Hamming Hashing (CMHH), Adversary-Guided Asymmetric Hashing (AGAH), Deep Adversarial Discrete Hashing (DADH), Self-Constrained Attention Hashing Network (SCAHN), Multi-Label Enhanced Self-Supervised Deep Cross-Modal Hashing (MESDCH), Differentiable Cross-Modal Hashing Transformer (DCHMT), Modality-Invariant Asymmetric Network (MIAN), Deep Neighborhood-Aware Proxy Hashing (DNPH), and Deep Rank Distribution Preserving Hashing (RDPH). The comparison models are based on the official source code, and the relevant parameter settings are based on the original paper. It should be noted that to ensure experimental fairness, all comparison models use the same backbone architecture.
[0068] To evaluate the model's performance in cross-modal retrieval, we used common evaluation metrics: mean average precision (mAP), precision-recall (PR) curve, TopN precision curve, and normalized discounted cumulative gain with the top 1,000 returned samples (NDCG@1000). The mAP score represents the average accuracy of the model across the entire dataset and is a standard performance metric widely recognized in the field of information retrieval. The PR curve shows the relationship between recall and precision, providing insights into overall retrieval performance. The TopN precision curve measures accuracy based on the top-N returned samples. NDCG@1000 is a metric that measures the relevance of search results to user queries, and its value increases when the returned ranked samples show a higher similarity. In the experiment, the number of rankings was configured to 1,000.
[0069] We first calculated the mean average performance approximation (mAP) for 16-bit, 32-bit, 64-bit, and 128-bit datasets on three benchmark datasets, focusing on two retrieval tasks: image-to-text (I2T) and text-to-image (T2I) retrieval. Detailed results are shown in Tables 1-3.
[0070] Table 1 mAP of each model on the MIRFLICKR-25K dataset
[0071] Table 2 mAP of each model on the NUS-WIDE dataset
[0072] Table 3 mAP of each model on the IAPRTC-12 dataset
[0073] As can be seen, DAGtH outperforms other models. Specifically, on the MIRFLICKR-25K dataset, DAGtH surpasses the comparison model MIAN in image-to-text (I2T) and text-to-image (T2I) tasks, achieving mAP improvements of 1.14% and 1.66% respectively, at three different hash lengths. On the NUS-WIDE dataset, compared to the comparison model DNPH, DAGtH achieves improvements of 2.08%, 1.68%, 1.59%, and 2.70% in image-to-text retrieval tasks at 16-bit, 32-bit, 64-bit, and 128-bit hash code lengths, respectively; and 0.79%, 0.80%, 0.61%, and 2.00% in text-to-image retrieval tasks. On the IAPRTC-12 dataset, DAGtH surpasses the DCHMT model by 0.13% to 4.12% in mAP in the image-to-text retrieval task, and by 0.72% to 5.62% in mAP in the text-to-image retrieval task.
[0074] To further evaluate the effectiveness of DAGtH, PR curves and TopN-precision curves are plotted on the NUS-WIDE public dataset using 32-bit and 64-bit hash codes. Figure 2 and Figure 3 Compared with other comparison models, the PR curve and TopN-precision curve show that DAGtH achieves good retrieval performance.
[0075] Table 4 shows the NDCG@1000 results of DAGtH and other comparison models. It can be seen that DAGtH exhibits better cross-modal retrieval performance than other comparison models.
[0076] Table 4 NDCG@1000 results of each model on the NUS-WIDE dataset
[0077] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form or substance. It should be pointed out that ordinary technicians in this technical field can make several improvements and supplements without departing from the method of the present invention. These improvements and supplements should also be regarded as the scope of protection of the present invention. Any equivalent changes, modifications and evolutions made by technicians familiar with this profession without departing from the spirit and scope of the present invention by using the technical content disclosed above are all equivalent embodiments of the present invention; at the same time, any equivalent changes, modifications and evolutions made to the above embodiments based on the essential technology of the present invention are still within the scope of the technical solution of the present invention.
Claims
1. A cross-modal hash retrieval model training method, characterized in that: The following steps are involved: Extract features from a training sample set, where the training sample set includes anchor samples, positive samples, and negative samples; Inputting the features into a hash network and training the hash network; wherein the features are mapped into continuous hash codes, and the continuous hash codes are binarized; Updating the parameters of the hash network according to the overall target loss to obtain a cross-modal hash retrieval model; Among them, the overall target loss includes adaptive gradient triplet loss and step-by-step quantization loss. The adaptive gradient triplet loss is adaptively adjusted according to the cosine similarity between the anchor point sample and the negative sample and the cosine similarity between the anchor point sample and the positive sample during the training process. The step-by-step quantization loss only takes effect in the binarization process.
2. The method according to claim 1, characterized in that The features of the training sample set are extracted through the pre-trained Transformer network.
3. The method according to claim 1, characterized in that The adaptive gradient triplet loss is calculated as follows: ; in, represents the adaptive gradient triplet loss; represents the adaptive threshold, represents the angle constraint term, represents the coefficient; , Represents the cosine similarity between the anchor point and the positive sample, represents the cosine similarity between the anchor point and the negative sample; [·] + Represents the ReLU function.
4. The method according to claim 3, characterized in that The adaptive threshold and angle constraints Calculated by the following formula: ; ; in, Representing a collection The mean of x ai 、x pt and x nt Represent image anchor samples, text positive samples and text negative samples respectively, represents the set of all triples; Representing a collection The mean of is a hyperparameter, Represents the set of positive integers.
5. The method according to claim 1, wherein The step-by-step quantization loss is calculated as follows: ; in, represents the step-by-step quantization loss, n represents the total number of samples, represents the embedded function; ; ; ; in, represents the sign function, K represents the number of bits of the hash code, P(r) represents the orthogonal transformation group, Δ represents the product of the Householder matrix, Indicates the value of the input variable when the objective function reaches the minimum value; This means that the normalized features are placed in the Euclidean sphere containing the hash code.
6. The method according to claim 1, characterized in that The overall target loss is calculated as follows: ; in, Indicates the overall target loss; represents the adaptive gradient triplet loss; represents a hyperparameter; represents the step-wise quantization loss.
7. A cross-modal hash retrieval method, characterized in that: The following steps are involved: The image to be retrieved is input into the cross-modal hash retrieval model obtained by the cross-modal hash retrieval model training method described in any one of claims 1-6, and the cross-modal hash retrieval model outputs the retrieval result.
8. A cross-modal hash retrieval device, characterized in that: include: An acquisition module, for receiving an image to be retrieved; A retrieval module, which has a built-in cross-modal hash retrieval model obtained by the cross-modal hash retrieval model training method according to any one of claims 1 to 6, and is used to retrieve the image to be retrieved; The output module is used to receive the search results obtained by the search module and output the search results.
9. An electronic device, characterized in that: It includes a memory and a processor, wherein the memory is used to store a computer program; the processor is used to execute the cross-modal hash retrieval model training method described in any one of claims 1 to 6 or the cross-modal hash retrieval method described in claim 7 according to the computer program.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium is used to store a computer program; when the computer program is executed by a processor, it implements the cross-modal hash retrieval model training method described in any one of claims 1 to 6 or the cross-modal hash retrieval method described in claim 7.
Citation Information
Patent Citations
Zero sample image classification method based on an adaptive weight Hash cyclic adversarial network
CN109558890A
Cross-modal retrieval model based on differentiated representation deep hash
CN113641790A
Cross-modal retrieval model training method and cross-modal retrieval method
CN119646304A
Cited By
Cross-batch mining-based image retrieval model training method and image retrieval method
CN120877070A
Model optimization method, electronic equipment and computer readable storage medium
CN121561424A