Image-text retrieval method and system based on semantic relationship and cross attention mechanism
By combining a graph-text retrieval method based on semantic relations and cross-attention mechanism with graph convolutional networks and self-attention mechanism, the problem of fine-grained alignment between image regions and text words is solved, achieving more efficient graph-text retrieval performance.
Patent Information
- Application Number
- CN202311779671.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-21
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2043-12-21
AI Technical Summary
Existing image-text retrieval methods ignore fine-grained alignment between image regions and text words, and fail to effectively combine intra-modal and inter-modal relationships, resulting in incomplete information capture and poor retrieval performance.
We employ a method based on semantic relationships and cross-attention mechanisms. By using graph convolutional networks and self-attention mechanisms to extract features from image regions and text words, and combining bidirectional cross-attention mechanisms to capture fine-grained associations between image regions and text words, we establish a unified image-text retrieval framework.
It improves semantic understanding between images and text, enhances the accuracy and efficiency of retrieval, enables a more comprehensive understanding of image and text data, adapts to different scenarios and applications, and improves the overall performance of the model by adjusting the balance of intramodal and intermodal relationships through hyperparameter adjustment.
Smart Images

Figure CN117725253B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of image and text retrieval technology, specifically to image and text retrieval methods and systems based on semantic relationships and cross-attention mechanisms. Background Technology
[0002] The statements in this section are merely background information relating to this disclosure and do not necessarily constitute prior art.
[0003] Visual and textual retrieval refers to the retrieval and searching of multimedia content by combining image and text information. With the rapid development of computer vision and natural language processing, visual and textual retrieval technology has gradually become a research field attracting much attention. It not only plays an important role in many applications but also has broad prospects for future development.
[0004] Currently, methods for image-text retrieval include: 1) Global matching-based methods, which extract features from both the image and text separately, then embed the image and text independently into a common embedding space, and measure their similarity through feature distance. Driven by the success of deep learning, different networks can be used for feature learning for different modalities; convolutional neural networks can be used for images, and recurrent neural networks can be used for text. The two models are then mapped to a common space for comparison. 2) Local matching-based methods, which typically extract salient segments from images or text. For example, for images, mature object detection methods can be used, such as pre-trained Faster-RCNN, to extract salient regions, and then backbone networks like ResNet101 are used to extract features from these salient regions. In addition, most of these methods introduce attention mechanisms, which can selectively focus on the more important segments of the two modalities. The purpose is to capture the correlation between image regions and text words, discover fine-grained alignment between modalities, and then aggregate the local similarities between the two modalities to infer the similarity of the entire image and text, so as to bring better retrieval performance; 3) Attention mechanism-based methods. Attention mechanisms have been developed to simulate human behavior, that is, humans selectively use partial data to make decisions. It has been widely used in various visual and text tasks. Attention mechanisms have also been applied to image and text retrieval tasks. By selectively focusing on the meaningful components of the two modalities, it provides an effective solution. Some scholars have used stacked cross-attention mechanisms to discover alignment between segments.
[0005] However, the methods mentioned above still have some problems:
[0006] 1) Global matching methods ignore the fact that different segments in an image have different importance and lack fine-grained alignment between image regions and text words, resulting in poor performance.
[0007] 2) The relationships between image regions and sentence words are not considered. Some scholars have used self-attention mechanisms to explore intramodal relationships, but they have ignored the relationships between modalities. Neither intramodal nor intermodal relationships are considered simultaneously. Most existing methods only utilize each intramodal or intermodal relationship for image-text retrieval tasks, which may lead to incomplete information capture. Few have proposed methods to jointly study intramodal and intermodal relationships within a unified framework for image-text retrieval. Summary of the Invention
[0008] To address the aforementioned issues, this disclosure proposes an image-text retrieval method and system based on semantic relationships and cross-attention mechanisms. It considers both intra-modal and inter-modal relationships between image regions and text words. First, it mines potential associations between image regions and text words within each modality to obtain semantically enhanced features. Then, it captures fine-grained associations between image regions and text words through a cross-attention mechanism.
[0009] According to some embodiments, the present disclosure adopts the following technical solutions:
[0010] Image and text retrieval methods based on semantic relationships and cross-attention mechanisms include:
[0011] Retrieve a given image and text data;
[0012] For image data, significant image regions are extracted, connections between these regions are established, a relational graph model is generated, and region features with semantic relational information are generated through graph convolutional network inference. Finally, the region features are aggregated through a self-attention mechanism to obtain global image features. For text data, the contextual relationships of all words in the text data are extracted to generate word features, and the word features are aggregated through a self-attention mechanism to generate global text features.
[0013] Based on region features and word features, we first calculate the region-word similarity matrix. According to the obtained region-word similarity matrix, we apply bidirectional cross-attention to capture the association between segments. Each region feature is used as a query to assign weights to word features. Similarly, each word feature is used as a query to assign weights to region features. We obtain new text word representations and image region representations respectively, and explore the fine-grained association between image regions and text words. Finally, we dot product the image global features and the text global features, and dot product the image representation obtained after aggregating region features and the text representation obtained after aggregating text word features. The weighted sum of the two dot products is the image and text similarity score.
[0014] According to some embodiments, the present disclosure adopts the following technical solutions:
[0015] Image and text retrieval systems based on semantic relations and cross-attention mechanisms include:
[0016] The data acquisition module is used to acquire given image and text data;
[0017] The feature extraction module is used to extract significant image regions from image data, establish connections between image regions, generate a relational graph model, generate region features with semantic relational information through graph convolutional network inference, and aggregate the region features through a self-attention mechanism to obtain global image features; for text data, it extracts the contextual relationships of all words in the text data to generate word features, and aggregates the word features through a self-attention mechanism to generate global text features.
[0018] The similarity retrieval module, based on region and word features, first calculates a region-word similarity matrix. Then, based on this matrix, it applies bidirectional cross-attention to capture the associations between segments. Each region feature is used as a query to assign weights to word features, and similarly, each word feature is used as a query to assign weights to region features. This process yields new text word representations and image region representations, exploring fine-grained associations between image regions and text words. Finally, it performs an inner product of the image global features and the text global features, and an inner product of the image representation obtained by aggregating region features and the text representation obtained by aggregating text word features. The weighted sum of these two inner products is the image-text similarity score.
[0019] Compared with the prior art, the beneficial effects of this disclosure are as follows:
[0020] This disclosure presents an image-text retrieval method based on semantic relationships and cross-attention mechanisms. The model establishes a relational graph model for images, applies a graph convolutional network (GCNN) to perform inference on this graph, explores intra-modal relationships, and obtains semantically enhanced image region features. The GCNN can more effectively propagate information within the graph; each layer's GCNN operation allows nodes to better utilize information from their neighbors, thereby improving the overall network's ability to model relationships between nodes. The model can gradually learn higher-level, more abstract feature representations. For text, BERT is used to explore intra-modal relationships. Then, image features and text features are combined through a cross-attention mechanism to capture fine-grained associations between segments, exploring inter-modal relationships. Through the cross-attention mechanism, image features and text features are accurately fused, capturing fine-grained associations between various regions in the image and individual words in the text. This fusion not only improves the understanding of semantic relationships within images and text but also explores inter-modal relationships at a deeper level. This interactive approach enables the model to understand image-text data more comprehensively and accurately, resulting in significant performance improvements in image-text retrieval tasks. The introduction of hyperparameters provides the model with flexibility, allowing it to be adjusted according to specific task requirements and data characteristics, thus better adapting to different scenarios and applications. Secondly, through the balanced adjustment of hyperparameters, the model can more flexibly handle intra-modal and inter-modal relationships, avoiding overemphasis on one aspect that could lead to a decline in the performance of other aspects. This helps improve the overall performance of the model, enabling it to more comprehensively understand the semantic relationships between images and text, thereby improving the accuracy and efficiency of retrieval. Balancing intra-modal and inter-modal relationships with a single hyperparameter allows the model to achieve good performance. Finally, the model is trained using a selected loss function to obtain the final retrieval results, and the effectiveness of the proposed method is demonstrated on the MS-COCO dataset and the Flickr30K dataset. Attached Figure Description
[0021] The accompanying drawings, which form part of this disclosure, are used to provide a further understanding of this disclosure. The illustrative embodiments of this disclosure and their descriptions are used to explain this disclosure and do not constitute an undue limitation of this disclosure.
[0022] Figure 1 This is an example diagram of an image and text retrieval task according to an embodiment of this disclosure; Figure 1 (a) in the text represents image retrieval based on text; Figure 1 (b) in the example shows how to retrieve text based on an image.
[0023] Figure 2 This is a flowchart illustrating the model of an embodiment of this disclosure. Detailed Implementation
[0024] The present disclosure will be further described below with reference to the accompanying drawings and embodiments.
[0025] It should be noted that the following detailed descriptions are illustrative and intended to provide further explanation of this disclosure. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this disclosure pertains.
[0026] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the exemplary embodiments according to this disclosure. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms “comprising” and / or “including” are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.
[0027] Example 1
[0028] One embodiment of this disclosure provides a text and image retrieval method based on semantic relationships and cross-attention mechanisms, including:
[0029] Step 1: Obtain the given image and text data;
[0030] Step 2: For image data, extract significant image regions, establish connections between image regions, generate a relational graph model, and generate region features with semantic relational information through graph convolutional network inference. Then, aggregate the region features through a self-attention mechanism to obtain global image features. For text data, extract the contextual relationships of all words in the text data to generate word features. Then, aggregate the word features through a self-attention mechanism to generate global text features.
[0031] Step 3: Based on region features and word features, first calculate the region-word similarity matrix. According to the obtained region-word similarity matrix, apply bidirectional cross-attention to capture the association between segments. Each region feature is used as a query to assign weights to word features. Similarly, each word feature is used as a query to assign weights to region features. New text word representations and image region representations are obtained respectively. Explore the fine-grained association between image regions and text words. Finally, the inner product of the image global features and the text global features, and the inner product of the image representation obtained after aggregating region features and the text representation obtained after aggregating text word features, are weighted to obtain the image and text similarity score.
[0032] As one embodiment, this disclosure presents an image-text retrieval method based on semantic relationships and cross-attention mechanisms. Considering both intra-modal and inter-modal relationships, after fully capturing the contextual relationships within each modality, it firstly obtains global features of image regions and text words through self-attention mechanisms. Secondly, it models the inter-modal relationships between image regions and text words through a cross-attention mechanism to obtain interactive features. Then, it uses 1d-CNN or pooling operations to obtain aggregated features. Finally, it optimizes the parameters in the model using a set objective function. The specific implementation process includes:
[0033] (1) Image Representation: For a given image, a pre-trained Faster R-CNN is used to extract salient regions from the image. This model is a bottom-up model pre-trained on the visual genome, which can extract a set of salient image regions, whose feature representation is O={o1,o2,...,o k}, where each o i This represents the average pooling feature of the i-th region, where k represents the number of image regions. The feature dimensions are then transformed by a fully connected layer, as shown below, where r... i Corresponding to o i The transformed features.
[0034] r i =W v o i +b v
[0035] Among them, W v It is the weight matrix of the fully connected layer, used to average pooling features of the image region. i Perform a linear transformation. v It is a bias term used to adjust the transformed features.
[0036] A new set of features is obtained In addition, there are certain connections between image regions. Considering that these connections can lead to a better understanding of the image content, a region relation inference model is constructed here to enhance region-based representation by considering the semantic relevance between image regions. First, a relation graph model is established, where the nodes of the graph are the salient regions of the image. If there is a strong semantic connection between two image regions, then a high-weight edge will connect these two regions. The semantic relevance between regions is measured using the following formula:
[0037]
[0038] in and φ(v) j ) = W φ r jThere are two embeddings, and the weight parameters are... and W φ Updates can be performed via backpropagation.
[0039] This results in a fully connected graph G = (V, E), where V is the set of detected regions and E is described by the association matrix P. A graph convolutional network is then applied to this graph for inference. The update of each node is obtained based on the neighboring nodes in the image. A residual connection is then added, as shown below:
[0040] V = W a (PRW b )+R
[0041] Among them, W b W is the weight matrix of the GCN layer. a The weight matrix is the residual structure, P is the k×k incidence matrix, and the final output is...
[0042] After obtaining a new set of features with enhanced relationships, the next step is to perform a self-attention mechanism on this new set of features, using the average feature value. As a guide, all regional features are aggregated to obtain a global representation, and finally, ι2 normalization is applied to obtain the final representation v0 of the image, which is the global feature of the image.
[0043] (2) Text Representation: For a given text, first perform word segmentation, and use a set of features W = {w1,…,w...} n Let} represent the context, where each word is one-hot encoded, and n is the number of words in the given sentence. Word embeddings are then performed using an embedding matrix. To capture the contextual relationships between words, a pre-trained BERT model is used to extract word features. BERT is a transformer-based pre-trained model, pre-trained using Wikipedia data and a text corpus. It is trained on two unsupervised prediction tasks (masked language model and next sentence prediction) and consists of multiple stacked self-attention layers. The resulting features include intra-modal relationships, represented as} Similarly, the average feature is used. As a guide, all word features are aggregated to obtain a global representation, and finally, ι2 normalization is applied to obtain the final representation t0 of the text, which is the global feature of the text.
[0044] (3) Bidirectional Cross-Attention: While intramodal relationships were effectively mined in steps (1) and (2), intermodal relationships are explored here. This part uses a bidirectional cross-attention mechanism to mine fine-grained associations between image regions and text words. Based on the obtained set of region features V={v1,…,v…} k}, where each feature encodes v iThe i-th region in the image, k is the number of image regions, and a set of word features T = {t1,…,t} n}, each feature t j Encode the j-th word in a sentence, where n is the length of the sentence's words. First, calculate the region-word similarity matrix S, where cosine similarity is used to measure the similarity, i.e.:
[0045]
[0046] Here s ij This represents the similarity between the i-th region and the j-th word.
[0047] Based on the obtained similarity matrix S, cross-attention is performed using regions as queries. Each image region feature is used as a query to assign weights to word features, based on the similarity between the region and each word. Then, these n words are weighted and summed to obtain a set of updated word features. This process can be represented as follows:
[0048]
[0049] Here, λ represents the temperature parameter of the softmax function, and then a set of word features is obtained after the cross-attention mechanism. Similarly, using word features as the query yields a set of region features.
[0050]
[0051] Through the cross-attention mechanism, fine-grained relationships between modalities were effectively explored, resulting in a new set of region features and word features. For the region features, simple average pooling was used to aggregate them.
[0052]
[0053] Finally, ι2 normalization is applied to obtain the final image representation v1, i.e., the image representation. For word features, a one-dimensional convolutional network is used to fully utilize the local contextual information of words. Three window sizes (ungrammar, bigrammar, and trigrammar) are used to capture phrase-level information in the sentence. The output of the k-th word is obtained using a convolution with a window size of ι.
[0054] p l,k =ReLU(W l e k:k+ι-1 )+b l ,ι=1,2,3
[0055] Among them W l It is the convolution filter matrix, b lThe bias is that when performing tuple and triple convolutions, the word representation matrix is appropriately padded with 0s to ensure that the sequence lengths are consistent after convolution. Then, max pooling is performed on all word positions, q... ι =max{p l,1 ,…,p l,n Then, q1q2q3 are concatenated and passed to a fully connected layer. Finally, after ι2 normalization, the final text representation t1 is obtained; this process can be represented as follows:
[0056] t1 = LayerNorm(W t concat(q1,q2,q3)+b t )
[0057] Among them W t ∈R d×3d ,b t ∈R d×1 .
[0058] Complete a fine-grained similarity retrieval process between image regions and text words.
[0059] (4) Objective function: For a given image-text pair, two embeddings are obtained, namely (v0, t0) and (v1, t1). Since they have been adjusted to the unit norm, the inner product of the global image feature v0 and the global text feature t0, and the inner product of the image representation v1 obtained after aggregating region features and the text representation t1 obtained after aggregating text word features, are used. The weighted sum of the two inner products is the similarity score between the image and the text, i.e.:
[0060] S(V,T)=v0·t0+α(v1·t1), where α is a hyperparameter used to balance the influence of intramodal and intermodal relationships on the model performance.
[0061] Finally, the model is trained using a bidirectional triplet ranking loss, which results in a higher similarity score between matched images and sentences compared to unmatched images and sentences. The loss function is as follows:
[0062]
[0063] Where m represents the margin, and (V,T) represents the true matching image-sentence pair. This represents a hard negative example in a small batch, i.e. and
[0064] like Figure 1As shown, given the text "A young adult is doing a back flip on a trampoline near a lake", the system returns a set of images with the same meaning as the text.
[0065] like Figure 2 Given an image, query the corresponding text. The system returns a set of texts with the same meaning as the image, such as "A young adult is doing a back flip on a trampoline near a lake" and "A woman is doing flips on a trampoline in front of lake".
[0066] Experimental process
[0067] To evaluate the effectiveness of the proposed method, experiments were conducted on two classic datasets, MS-COCO and Flickr30k, for sentence retrieval and image retrieval, respectively. The model was evaluated using R@K, which represents the proportion of queries that retrieve the correct item from the K nearest points to the query. The model was also compared with other methods for this task, and the results are shown in Table 1.
[0068] Table 1: Comparison of Recall@K results for image and text retrieval on the MSCOCO 1K and Flick30K datasets.
[0069]
[0070] As can be seen from the table, the method disclosed herein achieves the best results on the vast majority of metrics. The superiority of the model disclosed herein can be attributed to its ability to utilize region-region, word-word, and region-word relationships through semantic relations and a cross-attention module (a unified network). Therefore, this disclosure can obtain more suitable embeddings to measure the relevance between visual and textual data and better perform retrieval tasks.
[0071] Ablation experiment:
[0072] In this section, ablation experiments were conducted on the Flick30K test set to test the impact of different hyperparameter α values on model performance. The parameter α serves to balance the influence of intra-modal and inter-modal relations on retrieval results to achieve better performance. The experimental results are shown in Table 2. When α is set to 0.4, the model of this disclosure achieves optimal performance. Values of α that are too high or too low will negatively impact model performance; therefore, careful control of the balance between intra-modal and inter-modal relations is necessary. If α equals 0, meaning the model only considers intra-modal relations, the model performance is poor, indicating that inter-modal relations are also important.
[0073] Table 2. The effect of different α values on the Flick30K dataset.
[0074]
[0075] Example 2
[0076] One embodiment of this disclosure provides a text and image retrieval system based on semantic relationships and cross-attention mechanisms, including:
[0077] The data acquisition module is used to acquire given image and text data;
[0078] The feature extraction module is used to extract significant image regions from image data, establish connections between image regions, generate a relational graph model, generate region features with semantic relational information through graph convolutional network inference, and aggregate the region features through a self-attention mechanism to obtain global image features; for text data, it extracts the contextual relationships of all words in the text data to generate word features, and aggregates the word features through a self-attention mechanism to generate global text features.
[0079] The similarity retrieval module, based on region and word features, first calculates a region-word similarity matrix. Then, based on this matrix, it applies bidirectional cross-attention to capture the associations between segments. Each region feature is used as a query to assign weights to word features, and similarly, each word feature is used as a query to assign weights to region features. This process yields new text word representations and image region representations, exploring fine-grained associations between image regions and text words. Finally, it performs an inner product of the image global features and the text global features, and an inner product of the image representation obtained by aggregating region features and the text representation obtained by aggregating text word features. The weighted sum of these two inner products is the image-text similarity score.
[0080] This disclosure is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create a machine for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0081] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0082] While the specific embodiments of this disclosure have been described above in conjunction with the accompanying drawings, this is not intended to limit the scope of protection of this disclosure. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art without creative effort based on the technical solutions of this disclosure are still within the scope of protection of this disclosure.
Claims
1. A text-image retrieval method based on semantic relationships and cross-attention mechanism, characterized in that, include: Retrieve a given image and text data; For image data, significant image regions are extracted, connections between these regions are established, a relational graph model is generated, and region features with semantic relational information are generated through graph convolutional network inference. Finally, the region features are aggregated through a self-attention mechanism to obtain global image features. For text data, the contextual relationships of all words in the text data are extracted to generate word features, and the word features are aggregated through a self-attention mechanism to generate global text features. The process of establishing connections between image regions and generating a relational graph model includes: enhancing the representation of image regions by considering semantic correlations between them; establishing a relational graph model where the nodes are salient regions of the image; if there is a strong semantic correlation between two image regions, a high-weight edge will connect the two regions, thus forming a fully connected graph; the fully connected graph uses a graph convolutional network for inference, and the update of each node is obtained based on the neighbors of the node in the image, then residual connections are added to obtain a new set of features after relationship enhancement; a self-attention mechanism is performed on this new set of features, using average features as guidance to aggregate all region features to obtain a global representation; finally, normalization is applied to obtain the global features of the image. Based on region features and word features, we first calculate the region-word similarity matrix. According to the obtained region-word similarity matrix, we apply bidirectional cross-attention to capture the association between segments. Each region feature is used as a query to assign weights to word features. Similarly, each word feature is used as a query to assign weights to region features. We obtain new text word representations and image region representations respectively, and explore the fine-grained association between image regions and text words. Finally, we dot product the image global features and the text global features, and dot product the image representation obtained after aggregating region features and the text representation obtained after aggregating text word features. The weighted sum of the two dot products is the image and text similarity score.
2. The image and text retrieval method based on semantic relations and cross-attention mechanism as described in claim 1, characterized in that, Faster R-CNN is used to extract salient regions from the image, resulting in a set of salient image regions whose features are represented as O={ }, each of which It is the first Average pooling characteristics of each region The number of image regions is represented by a fully connected layer, which then transforms the feature dimensions to obtain a set of semantic feature representations of the regions.
3. The image and text retrieval method based on semantic relations and cross-attention mechanism as described in claim 1, characterized in that, For text data, we first perform word segmentation, encode each word using one-hot encoding, then perform word embedding using an embedding matrix, use the BERT model to extract word features, and obtain global text features through multiple self-attention layers.
4. The image and text retrieval method based on semantic relations and cross-attention mechanism as described in claim 1, characterized in that, This paper employs a bidirectional cross-attention mechanism to mine fine-grained associations between image regions and text words. For image region features and word features, a region-word similarity matrix is first calculated, with cosine similarity used to measure the similarity. Based on the obtained similarity matrix, cross-attention is performed on text word features using image region features as queries. For each image region feature as a query, a softmax function is used to introduce a temperature parameter, and weights are assigned based on the similarity between the region and each word. Then, the words are weighted and summed to obtain a set of updated text word features.
5. The image and text retrieval method based on semantic relations and cross-attention mechanism as described in claim 4, characterized in that, Then, using word features as queries, a set of region features is obtained. Through the cross-attention mechanism, the fine-grained relationship between modalities is explored, resulting in a new set of image region features and text word features. For the region features, average pooling is used to aggregate the region features to obtain a new image representation.
6. The image and text retrieval method based on semantic relations and cross-attention mechanism as described in claim 4, characterized in that, The updated text word features are processed using a one-dimensional convolutional network to make full use of the local contextual information of words. Three window sizes are used to capture phrase-level information in sentences, and finally a new text representation is obtained.
7. The image and text retrieval method based on semantic relations and cross-attention mechanism as described in claim 1, characterized in that, For a given image and text data, the similarity between the image and text data is defined as a weighted sum of two inner products. A hyperparameter is used to balance intramodal and intermodal relationships, and finally, a bidirectional triplet ranking loss is used for training.
8. A text and image retrieval system based on semantic relationships and cross-attention mechanisms, characterized in that, Specifically, the image and text retrieval method based on semantic relationships and cross-attention mechanisms as described in any one of claims 1-7 includes: The data acquisition module is used to acquire given image and text data; The feature extraction module is used to extract significant image regions from image data, establish connections between image regions, generate a relational graph model, generate region features with semantic relational information through graph convolutional network inference, and aggregate the region features through a self-attention mechanism to obtain global image features; for text data, it extracts the contextual relationships of all words in the text data to generate word features, and aggregates the word features through a self-attention mechanism to generate global text features. The similarity retrieval module, based on region and word features, first calculates a region-word similarity matrix. Then, based on this matrix, it applies bidirectional cross-attention to capture the associations between segments. Each region feature is used as a query to assign weights to word features, and similarly, each word feature is used as a query to assign weights to region features. This process yields new text word representations and image region representations, exploring fine-grained associations between image regions and text words. Finally, it performs an inner product of the image global features and the text global features, and an inner product of the image representation obtained by aggregating region features and the text representation obtained by aggregating text word features. The weighted sum of these two inner products is the image-text similarity score.
Citation Information
Patent Citations
Cross-modal image-text retrieval method and system based on local context
CN116775927A
Method and apparatus for retrieving target
US20230005178A1
