一种基于知识增强的跨模态匹配方法及装置
By using multimodal clustering and aggregation methods, and by fusing external knowledge and image region labels, image and text features are enhanced, the semantic gap in image-text matching is solved, and higher cross-modal matching accuracy is achieved.
Patent Information
- Application Number
- CN202410513675.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-26
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2044-04-26
AI Technical Summary
Existing technologies struggle to effectively bridge the semantic gap between images and text in image-text matching, resulting in insufficient accuracy in cross-modal matching.
By using multimodal clustering and aggregation methods, and fusing external knowledge information and image region labels, image and text features are enhanced. Multi-head attention mechanism, graph convolutional network and gating mechanism are used for feature interaction and alignment to achieve cross-modal matching.
It improves the accuracy of cross-modal matching of images and text, and enhances the correlation and interaction between modalities by constructing a more complete joint embedding space through multimodal knowledge enhancement.
Smart Images

Figure CN118427631B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of cross-modal matching technology, and in particular to a cross-modal matching method and apparatus based on knowledge enhancement. Background Technology
[0002] With the continuous development of information technology, a large amount of heterogeneous multimodal data has been generated on social media networks, making cross-modal learning increasingly important. Among this multimodal data, vision and language, as two main ways people acquire information, have attracted widespread attention for the interactive learning between them. Image-text matching, as the foundation of visual-language interaction, has a wide range of applications, supporting various challenging cross-modal semantic interaction tasks, such as visual question answering, visual-language navigation, and multimedia understanding. Image-text matching is a research field at the intersection of computer vision and natural language processing. Its purpose is to establish semantic associations between images and text and calculate similarity, retrieving the most relevant text or image based on the required paired images or text. This process requires simultaneously understanding complex visual semantics and textual information. However, due to the semantic gap caused by the heterogeneity of image and text data, accurately learning the semantic correspondence between heterogeneous modalities remains crucial in image-text matching tasks.
[0003] Traditional cross-modal image-text matching methods [1,2] Matching models are constructed using statistical analysis and machine learning methods such as subspace learning and topic modeling. In recent years, with the development of deep learning and artificial intelligence, more and more researchers are using deep learning methods to build cross-modal image-text matching models, such as attention networks and graph neural networks. [3,4] However, these methods only consider the equivalent feature interactions between images and text, ignoring the unique abstract semantics of images relative to text, making it difficult to bridge the semantic gap between heterogeneous modalities. Therefore, by using multimodal knowledge clustering and fusion to aggregate image regions and text information, the semantic expression of image visual information becomes more specific, thereby improving the accuracy of cross-modal image-text matching.
[0004] Images and text are fundamental means of describing objects, and they are often combined to provide a comprehensive description of real-world scenes. An image (or a region of an image) contains multiple pieces of information, making its referent ambiguous, and the semantic information it represents is relatively abstract to the text.
[0005] Therefore, there is an urgent need for a method that addresses the abstract semantics of images, weakens the semantic differences between heterogeneous modalities, and achieves accurate cross-modal matching between images and text. Summary of the Invention
[0006] This invention provides a knowledge-enhanced cross-modal matching method and apparatus. This invention fully learns the semantic alignment and interaction of images and text in the joint embedding space, improving the accuracy of image-text cross-modal matching, as detailed below:
[0007] Firstly, a knowledge-enhanced cross-modal matching method, the method comprising:
[0008] Based on external knowledge information from multimodal clustering, a multi-head attention mechanism is used to encode the input image features V and text features B, resulting in encoded image features. and encoded text features
[0009] Obtaining regional semantic knowledge information based on multimodal aggregation Guided by the label information t, image region features are... Aggregate the features with the label information t, and use the aggregated features G, along with the encoded text features. Interacting with a graph convolutional network using multi-step reasoning to obtain regional semantic knowledge information based on multimodal aggregation.
[0010] Region semantic knowledge information based on multimodal aggregation By using a gating mechanism, the encoded image features are... and encoded text features Enhancement is performed to obtain the enhanced image features V. * and enhanced text features B * ;
[0011] For the enhanced image features V * and enhanced text features B * Simultaneously employing adaptive joint inference with global and local alignment, cross-modal matching of image and text pairs is achieved.
[0012] The external knowledge information based on multimodal clustering is as follows:
[0013] First, clustering of external image features in the image space is performed. Guided by external text features in WordNet, the abstract semantics in the image space and the semantics in the text space are fused through similarity judgment. Then, a second clustering is performed in the image-text joint embedding space.
[0014] The external knowledge information for multimodal clustering includes:
[0015] Nouns are inversely classified into k image semantic centers using similarity discrimination. Noun T i The probability of belonging to the l-th image semantic center is:
[0016]
[0017] The sim calculation method is cosine similarity, where the top γ ranked nouns by score are selected for each image semantic center, and noun T is... i Being selected as the l-th image semantic center is equivalent to:
[0018]
[0019]
[0020] in, The maximum confidence score of γ-th corresponding to the noun belonging to the l-th image semantic center; define the image semantic center S. l The selected set of nouns is Based on the noun selected for each image semantic center, the features of each image region mapped to the joint embedding space are calculated as follows:
[0021]
[0022]
[0023] in, For image region O i Image semantic center S of the class l The selected nouns, where τ controls the aggregation margin, and the image region features after noun text semantic enhancement are: in:
[0024]
[0025] By analyzing the features of the fused image regions By reapplying the k-means clustering algorithm, we obtain external knowledge based on multimodal clustering, namely:
[0026] M k =[m1,m2,m i ,…,m k ]
[0027]
[0028] Where, m i This represents the semantic center of the image region features after the algorithm converges.
[0029] Among them, the use of label information t to guide the image region features The aggregation with the tag information t is specifically as follows:
[0030] The i-th region will be classified as the l-th label information, which is equivalent to:
[0031]
[0032]
[0033] in, Corresponding to the region features belonging to the l-th label information Maximum confidence level, setting image label information t i The selected set of regional features is Aggregating the selected image regions yields:
[0034]
[0035]
[0036] in, Image label information t i The corresponding aggregated image region features; then the image region label fusion information is represented as G = [g1, g2, g...]. i ,…,g n ], g i It is obtained by concatenating label information and image region aggregation features:
[0037] The gating mechanism is used to encode the image features. and encoded text features Enhancement is performed to obtain the enhanced image features V. * and enhanced text features B * Specifically:
[0038] The result and The gating mechanism is applied to the region features of the enhanced image and text respectively:
[0039]
[0040]
[0041]
[0042]
[0043] in, and To enhance the regional features of the text in the post-image, and Given a learnable weight matrix, the image and text features after two steps of multimodal knowledge enhancement are: and
[0044] A second aspect is a knowledge-enhanced cross-modal matching apparatus, the apparatus comprising: a processor and a memory, the memory storing program instructions, the processor invoking the program instructions stored in the memory to cause the apparatus to perform the method described in any of the first aspects.
[0045] Third aspect, a computer-readable storage medium storing a computer program, the computer program including program instructions that, when executed by a processor, cause the processor to perform the method described in any one of the first aspects.
[0046] The beneficial effects of the technical solution provided by this invention are:
[0047] 1. This invention acquires multimodal data such as exogenous knowledge information based on multimodal clustering and image region label fusion information based on multimodal aggregation. Guided by noun text information and image label information, it fuses image region features with word text features. While clarifying the abstract visual referent, it uses the joint embedding space to focus on the expression of the same semantics under different modalities and mines the semantic commonalities under heterogeneous modalities.
[0048] 2. This invention utilizes multimodal data, such as external knowledge information based on multimodal clustering and image region label fusion information based on multimodal aggregation, to enhance the semantic features of image-text pairs from both external and internal perspectives. External knowledge information based on multimodal clustering tends to enhance frequently occurring semantic information in image-text pairs due to the common clustering features, while image region label fusion information obtained from object detection can enhance rare semantics through label information. The combined semantic enhancement of these two types of multimodal knowledge makes the construction of the joint semantic embedding space more complete, bridging the semantic gap between heterogeneous modalities and enhancing the association and interaction between modalities.
[0049] Therefore, this invention can fully learn the semantic alignment and interaction of images and text in the joint embedding space, thereby improving the accuracy of cross-modal matching of images and text. Attached Figure Description
[0050] Figure 1 A flowchart of a knowledge-enhanced cross-modal matching method;
[0051] Figure 2 This is a schematic diagram illustrating the operation of a knowledge-enhanced cross-modal matching method. Detailed Implementation
[0052] To make the objectives, technical solutions, and advantages of the present invention clearer, the embodiments of the present invention will be described in further detail below.
[0053] Example 1
[0054] A knowledge-enhanced cross-modal matching method, see [link to relevant documentation]. Figure 1 The method includes the following steps:
[0055] Step 101: Obtain the image features V, text features B, external image features O, and external text features T to be matched;
[0056] Step 102: Obtain external knowledge information M based on multimodal clustering k ;
[0057] First, clustering of external image features O in the image space is performed. Then, guided by external text features T from WordNet, the abstract semantics in the image space are fused with the more specific semantics in the text space through similarity judgment. Finally, a second clustering is performed in the image-text joint embedding space to obtain external knowledge information M based on multimodal clustering. k .
[0058] Step 103: For external knowledge information M based on multimodal clustering k The input image features V and text features B are encoded using a multi-head attention mechanism to obtain the encoded image features. and encoded text features To enhance the common semantic information that frequently appears in the text-image pair;
[0059] Step 104: Obtain regional semantic knowledge information based on multimodal aggregation Guided by the label information t, image region features are... Aggregate the features with the label information t, and use the aggregated features G, along with the encoded text features. Interacting with a graph convolutional network using multi-step reasoning to obtain regional semantic knowledge information based on multimodal aggregation.
[0060] Step 105: Targeting regional semantic knowledge information based on multimodal aggregation By using a gating mechanism, the encoded image features are... and encoded text features Enhancement is performed to obtain the enhanced image features V. * and enhanced text features B * This allows the model to simultaneously focus on rare semantic features, making the construction of the joint semantic co-embedding space more complete;
[0061] Step 106: Enhance the image features V * and enhanced text features B *Simultaneously employing adaptive joint inference with global and local alignment, while focusing on detailed features, we avoid introducing redundant information, thereby achieving correct cross-modal matching of image and text pairs.
[0062] In summary, the embodiments of the present invention fuse the content in the image region with the word text through the above steps 101-106, making the abstract semantics of the image reference more specific and clear; the embodiments of the present invention fully learn the semantic alignment and interaction of images and text in the joint embedding space, thereby improving the accuracy of cross-modal matching of images and text.
[0063] Example 2
[0064] The scheme in Example 1 will be further described below with specific calculation formulas and examples:
[0065] 201: Obtain the image V to be matched, text data B, external image features O, and external text features T;
[0066] For the input image to be matched:
[0067] F = Fast R-CNN (image)
[0068] v i =MLP(f i )+FC(f i )
[0069] First, pre-trained Fast-RCNN is used for object detection in image regions, and the top 36 regions with the highest confidence are selected. Then, ResNet101, pre-trained on ImageNet, is used for feature extraction, resulting in a 2048-dimensional feature vector. The extracted feature vector is denoted as F = [f1, f2, ..., f...]. n [n=36, where n=36 is the number of image region features. Finally, the image features are fine-tuned through a fully connected layer and a multi-layer perceptron with residual connections, mapping them to a 1024-dimensional common embedding space to obtain the final feature representation V=[v1, v2, ..., v] of the input image to be matched. n ], where v i This represents the region features of the image. For the input text to be matched:
[0070] C = Bert(text)
[0071] b i =FC(c i )
[0072] This invention uses the sequence model BERT for processing, extracting features described by each word in the text, to obtain C = [c1, c2, ..., c...]. m ], where m represents the number of words in each paragraph, c i This represents a word vector with a dimension of 768. Then, a fully connected layer maps the word vectors to a 1024-dimensional common embedding space, resulting in the final feature representation of the input text to be matched, B = [b1, b2, ..., b...]. m ], where b i This is the feature vector of a word.
[0073] To avoid data leakage in the validation set, this embodiment of the invention selects image data from Visual Genome and text data from WordNet for the external datasets that need to be introduced. N Similarly, in this embodiment of the invention, a pre-trained text encoder BERT is used to encode a set of nouns in WordNet to obtain external text features T = [T1, T2, ..., T]. M ], where N and M are the number of corresponding samples, respectively.
[0074] 202: Obtaining external knowledge information M based on multimodal clustering k ;
[0075] First, clustering of external image features O in the image space is performed. Then, guided by external text features T from WordNet, the abstract semantics in the image space are fused with the more specific semantics in the text space through similarity judgment. Finally, a second clustering is performed in the image-text joint embedding space to obtain external knowledge information M based on multimodal clustering. k .
[0076] In this embodiment of the invention, the set of external image regions is O = [O1, O2, ..., O2]. NClustering is performed. Since the sample data is large enough and the similarity between samples can be described using Euclidean distance, this embodiment of the invention chooses to use the k-means algorithm for clustering to obtain better clustering results. Image semantics of different granularities can be captured by different k values in the k-means algorithm. Smaller k values correspond to coarse-grained semantics, whose accuracy may not be sufficient to cover the image semantics of the cluster boundaries. Conversely, larger k values produce fine-grained semantics, which may not be able to distinguish different region features. To find image semantics of appropriate granularity, for the large Visual Genome dataset, this embodiment of the invention, through experiments, considers a cluster of approximately 300 image regions to be sufficiently compact, i.e.:
[0077] k = N / 300
[0078] The clustering process is as follows:
[0079]
[0080] Where, μ j (j∈[1,k]) represents the centroid of each class in k-means clustering, for each image region sample O i It is necessary to calculate the relationship with each centroid μ. j The distance, O i Then it belongs to the nearest centroid μ to him j In the class, Represents an identifier, that is, when O i The centroid value is 1 if the cluster belongs to the j-th cluster, and 0 otherwise. Repeat the calculation of the centroid value for each cluster according to the above formula until the clustering algorithm converges, satisfying the following formula:
[0081]
[0082] in, Indicates the current image region O i The centroid of the class. After clustering, this embodiment of the invention defines the image semantic center of each class as:
[0083]
[0084] To make image semantics more specific and bridge the semantic gap between images and text, this invention utilizes the semantic representation of nouns in the WordNet dataset, T = [T1, T2, ..., T...]. M The term "[]" is used to describe the clustered image regions, that is, to classify nouns into k semantic centers based on similarity. Specifically, noun T... i The probability of belonging to the l-th image semantic center is:
[0085]
[0086] The sim similarity is calculated using cosine similarity. To utilize highly representative and distinguishable nouns, semantically irrelevant nouns are discarded, thus fully exploring the semantic commonalities between heterogeneous image-text modalities. In this embodiment of the invention, the top γ ranked nouns are selected for each image semantic center. Formally, noun T... i Being selected as the l-th image semantic center is equivalent to:
[0087]
[0088]
[0089] in, The maximum confidence score of γ-th corresponds to the noun belonging to the l-th image semantic center. In this embodiment of the invention, the image semantic center S is set. l The selected set of nouns is Based on the noun selected for each image semantic center, the features of each image region mapped to the joint embedding space are calculated as follows:
[0090]
[0091]
[0092] in, For image region O i Image semantic center S of the class l The selected nouns, τ, represent the margin controlling aggregation, designed to prevent the joint spatial embedding of different images from degenerating to the same point. The image region features after noun text semantic enhancement are then: in:
[0093]
[0094] After the joint embedding space is constructed, this embodiment of the invention uses the features of the fused image regions as... By reapplying the k-means clustering algorithm, we can obtain the external knowledge M based on multimodal clustering. k This is used to enhance the semantics of abstract images and uncover commonalities in the semantics of heterogeneous modalities.
[0095] M k =[m1,m2,m i ,…,m k ]
[0096]
[0097] Where, m i This represents the semantic center of the image region features after the algorithm converges.
[0098] 203: Targeting external knowledge information M based on multimodal clustering k The input image features V and text features B are encoded using a multi-head attention mechanism to obtain... and To enhance the common semantic information that frequently appears in the text-image pair;
[0099] This invention utilizes the semantic center feature M of the image region after re-clustering. k Feature enhancement is performed on the image-text pairs to be matched. Embedding enhancement helps to inject multimodal knowledge into the output embedding. Specifically, this embodiment of the invention employs a multi-head attention mechanism, using M... k The global / local embedding of the input image-text pair is encoded as follows:
[0100] MultiHead(X,Y)=Concat(h1,h2,h i ,…,h H )+X
[0101] Where X represents the region feature v of the image or text. i or b i Y = M k Concat(.) represents the feature dimension concatenation operation, H represents the number of attention heads, and h is calculated using the scaled dot product attention Att(.). i as follows:
[0102]
[0103]
[0104] Where, d k W represents the number of channels for Q and K. i Q , W i V The matrix is learnable. The final enhanced features. Represented as:
[0105]
[0106] In the formula, FFN(.) represents a feedforward network implemented by two MLP layers, with a ReLU activation function in between. For image region features, For text features, External knowledge based on multimodal clustering can bridge the abstract semantic gap between images and text. The semantic embeddings of both modalities are enhanced through a multi-head attention mechanism. Therefore, this enhancement helps the model learn the semantic interactions between heterogeneous text and image modalities, resulting in better image-text matching performance. The image features obtained in this step... and text features This will be used as the input feature in 205 based on multimodal aggregation knowledge enhancement to further enhance the representation of semantic features.
[0107] 204: Obtaining regional semantic knowledge information based on multimodal aggregation Guided by the label information t, image region features are... Aggregate with label information t; use the aggregated feature G and text features Interacting with a graph convolutional network using multi-step reasoning to obtain regional semantic knowledge information based on multimodal aggregation.
[0108] For the acquisition of multimodal image region label fusion information, this embodiment of the invention takes a single image-text pair as an example. The label information of the target detection is encoded by BERT to obtain the feature t = [t1, t2, ..., t]. n The enhanced image's region features are: This invention embodiment will use tag information t i Region features of the corresponding image Replace to get Next, this embodiment of the invention utilizes the remaining regional features to describe each tag information t. i That is, to reverse classify all remaining region features into n object detection label information t i Specifically, the probability that the i-th image region belongs to the semantic information of the j-th label is:
[0109]
[0110] The sim similarity is calculated using cosine similarity. To utilize image regions with high semantic relevance and discriminability, regions semantically irrelevant to the label information are discarded. In this embodiment, the top γ ranked image region features are selected for each label information feature. Formally, classifying the i-th region as the l-th label information is equivalent to:
[0111]
[0112]
[0113] in, Corresponding to the region features belonging to the l-th label information Maximum confidence level. Fixed in embodiments of the present invention. Set image label information t i The selected set of regional features is Aggregating the selected image regions yields:
[0114]
[0115]
[0116] in, Image label information t i The corresponding aggregated image region features differ from the exogenous knowledge based on multimodal aggregation. In this embodiment of the invention, the focus is on multimodal fusion guided by label information within the image. Therefore, the image semantic fusion information is represented as G = [g1, g2, g...]. i ,…,g n ], g i It is obtained by concatenating label information and image region aggregation features:
[0117]
[0118] After obtaining all semantic fusion information G fused with region features, this embodiment of the invention uses a graph convolutional network to match the input text features to be matched. Interact with each other.
[0119] First, there's intramodal graph convolutional inference:
[0120]
[0121]
[0122] Among them, A i and A t This represents the adjacency matrix calculated based on the cosine similarity between features. W i (l-1) and W t (l-1) For learnable matrices, and Let σ(.) be the learnable bias matrix, σ(.) be the Leaky ReLU activation function, and l represent the current layer number of the modal inner graph convolutional semantic inference. s This represents the total number of layers in modal inner graph convolutional semantic reasoning.
[0123] Next, this embodiment of the invention performs reasoning on the entire multimodal semantic interaction, realizing intermodal semantic reasoning on the entire graph and mining similar graph structure relationships between different modalities. The process is as follows:
[0124]
[0125]
[0126]
[0127] Where A represents the adjacency matrix that connects two modalities based on semantic similarity, and W... (l) and C (l) Let G be a learnable matrix, l2 be the l2 norm function, || represent the eigenvector concatenation operation, and G be the eigenvectors. (l) and B (l) This is the final result of the reasoning.
[0128] 205: Regional semantic knowledge information based on multimodal aggregation Image features are controlled through a gating mechanism. and text features Enhancement is performed to obtain V * and B * At the same time, it can enhance rare semantic features, making the construction of the joint semantic co-embedded space more complete;
[0129] Regional semantic knowledge information obtained through multi-step reasoning In and Region features are added to the image and text respectively after step 203 enhancement using a gating mechanism. and middle:
[0130]
[0131]
[0132]
[0133]
[0134] in, and To enhance the regional features of the text in the post-image, and This is a learnable weight matrix. The image and text features after two steps of multimodal knowledge enhancement are: and
[0135] 206: Regarding V * and B *Simultaneously employing adaptive joint inference with global and local alignment, while focusing on detailed features, we avoid introducing redundant information, thereby achieving correct cross-modal matching of image and text pairs.
[0136] For image-text matching tasks, simply using global or local paradigms is insufficient to achieve satisfactory results across various semantic scenarios. In simple scenarios, using a local paradigm introduces redundant information into the feature construction of the image and text. In complex scenarios, using a global paradigm leads to the loss of detailed features between the image and text. Therefore, this invention employs both global and local paradigms to adaptively and jointly infer cross-modal matching of images and text.
[0137] For global alignment, the calculation method in this embodiment of the invention is as follows:
[0138] S g =Sim a (agg(V * ),agg(B * ))
[0139] Where agg(.) is the aggregation operation for region features, and in this embodiment of the invention, the aggregation method selected is GPO. [5] It can learn and automatically adapt the optimal pooling strategy to different features. The global similarity calculation formula is as follows:
[0140]
[0141] Where, T = agg(B * ) represents the aggregated global text features, I = agg(V * The aggregated global image features are represented by (). This similarity calculation method differs from the cosine similarity commonly used in image-text matching methods, transforming the similarity results from numerical values into vectors, facilitating subsequent joint inference. The similarity calculation method for local alignment is as follows:
[0142]
[0143] In performing fine-grained semantic alignment, this embodiment of the invention treats the similarity between a word and its cross-modal salient segment as the similarity between the word and the entire image, while ignoring all other cross-modal segments. The similarity scores of all words and images are then summed to obtain the final local alignment similarity score. The final image-text pair similarity score is obtained through learning two vectors for global and local alignment to automatically adapt to image-text pairs with varying semantic scene complexity.
[0144]
[0145] Among them, W g and W lThe weight matrix is learnable, and fc is a fully connected layer that downsamples the similarity vector into a similarity score.
[0146] In the training process, this embodiment of the invention selects the triplet ranking loss based on the most negative sample, which is commonly used in image-text matching, as the loss function. Specifically:
[0147]
[0148] in, and The most negative sample, distinct from the positive samples, is used to optimize the matching process; α is the distance factor, [x] + =max(x,0).
[0149] In summary, for the image-text data to be matched, this embodiment of the invention, through steps 201-206 above, utilizes multimodal data such as image region label fusion information based on multimodal aggregation and external knowledge information based on multimodal clustering to enhance the semantic features of the image-text pair from both inside and outside the image to be matched, respectively. This embodiment of the invention uses external knowledge based on multimodal clustering to enhance semantics from outside the image, fusing the image regions of Visual Genome with the noun text of WordNet, and performing multimodal clustering in the joint embedding space; through the fusion features of the clustered image regions and noun text, a multi-head attention mechanism is used to enhance the features of the image-text pair to be matched. While clearly defining the visual referent, this invention utilizes a joint embedding space to focus on the expression of the same semantics across different modalities, making it easier to understand the semantic commonalities in images and text. This embodiment of the invention uses image region label fusion information based on multimodal aggregation to enhance semantics from within the image. Label information from the detection of target features within the image is used as a semantic supplement to the image region features. Guided by the label information, image region features are aggregated around the label features. The fused features of the aggregated image regions and label information interact with the text features to be matched through a graph convolutional network. Through multi-step inference, similar graph structure information is extracted from the text features and fused features, and then added to the image region features through a gating mechanism. This enhances the semantic representation of image features while increasing intermodal correlation. Finally, this embodiment of the invention simultaneously uses global and local alignment methods for adaptive joint inference, improving the accuracy of cross-modal matching of images and text and meeting various needs in practical applications.
[0150] Example 3
[0151] The feasibility of Examples 1 and 2 is verified through specific experiments, as detailed below:
[0152] This invention employs the Flickr30k image annotation dataset, which contains 31,783 images, each with five different text descriptions. The dataset is divided into two parts: 29,783 images and their corresponding texts are used as the training set, and 1,000 images and their corresponding texts are used as the test set. The cross-modal matching technique used in this invention leverages the cross-modal similarity of image-text features enhanced with multimodal knowledge. First, we acquire external knowledge information based on multimodal clustering and image tag fusion information based on multimodal aggregation. Guided by noun text and tag information, we perform multimodal semantic clustering and fusion of images and text within both the external dataset and the samples in the Flickr30k dataset. This enhances the association between the common semantics of images and text, jointly constructing a more accurate joint embedding semantic space. Subsequently, this invention employs multi-head attention and gating mechanisms to enhance the input image and text features using the aforementioned knowledge, thereby reducing semantic differences between heterogeneous modalities and further mining common characteristics among different modalities. Under both local and global alignment methods, the cross-modal similarity matrix of the image and text is calculated and ranked, enabling the prediction of cross-modal matching relationships between image and text pairs. This invention uses two metrics, R@K and rSum, to evaluate the performance of the method. R@K (K = 1, 5, 10) represents the correct matching ranking of the image and text pair; a higher R@K indicates better performance. rSum (the sum of R@K) serves as an evaluation metric for calculating cross-modal matching of text and images, providing a more general evaluation perspective for overall cross-modal matching performance. The latest existing method achieves an rSum metric of 526.5, while the method in this invention achieves an rSum metric of 530.1. Compared to the latest existing method, this invention improves rSum by 3.6%, enhancing the reliability of cross-modal matching.
[0153] Example 4
[0154] A knowledge-enhanced cross-modal matching device includes a processor and a memory, wherein the memory stores program instructions, and the processor invokes the program instructions stored in the memory to cause the device to perform the following method steps in Embodiment 1:
[0155] Based on external knowledge information from multimodal clustering, a multi-head attention mechanism is used to encode the input image features V and text features B, resulting in encoded image features. and encoded text features
[0156] Obtaining regional semantic knowledge information based on multimodal aggregation Guided by the label information t, image region features are... Aggregate the features with the label information t, and use the aggregated features G, along with the encoded text features. Interacting with a graph convolutional network using multi-step reasoning to obtain regional semantic knowledge information based on multimodal aggregation.
[0157] Region semantic knowledge information based on multimodal aggregation By using a gating mechanism, the encoded image features are... and encoded text features Enhancement is performed to obtain the enhanced image features V. * and enhanced text features B * ;
[0158] For the enhanced image features V * and enhanced text features B * Simultaneously employing adaptive joint inference with global and local alignment, cross-modal matching of image and text pairs is achieved.
[0159] Among them, the external knowledge information based on multimodal clustering includes:
[0160] First, clustering is performed in the image space, guided by noun text in WordNet. The abstract semantics in the image space are fused with the semantics in the text space through similarity judgment. Then, a second clustering is performed in the image-text joint embedding space.
[0161] The external knowledge information in multimodal clustering includes:
[0162] Nouns are inversely classified into k image semantic centers using similarity discrimination. Noun T i The probability of belonging to the l-th image semantic center is:
[0163]
[0164] The sim calculation method is cosine similarity, where the top γ ranked nouns by score are selected for each image semantic center, and noun T is... i Being selected as the l-th image semantic center is equivalent to:
[0165]
[0166]
[0167] in, The maximum confidence score of γ-th corresponding to the noun belonging to the l-th image semantic center; define the image semantic center S. l The selected set of nouns is Based on the noun selected for each image semantic center, the features of each image region mapped to the joint embedding space are calculated as follows:
[0168]
[0169]
[0170] in, For image region O i Image semantic center S of the class l The selected nouns, where τ controls the aggregation margin, and the image region features after noun text semantic enhancement are: in:
[0171]
[0172] By analyzing the features of the fused image regions By reapplying the k-means clustering algorithm, we obtain external knowledge based on multimodal clustering, namely:
[0173] M k =[m1,m2,m i ,…,m k ]
[0174]
[0175] Where, m i This represents the semantic center of the image region features after the algorithm converges.
[0176] Among them, the image region features are guided by the label information t. The aggregation with the tag information t is specifically as follows:
[0177] The i-th region will be classified as the l-th label information, which is equivalent to:
[0178]
[0179]
[0180] in, Corresponding to the region features belonging to the l-th label information Maximum confidence level, setting image label information t i The selected set of regional features is Aggregating the selected image regions yields:
[0181]
[0182]
[0183] in, Image label information t iThe corresponding aggregated image region features; then the image region label fusion information is represented as G = [g1, g2, g...]. i ,…,g n ], g i It is obtained by concatenating label information and image region aggregation features:
[0184] Among them, the encoded image features are controlled through a gating mechanism. and encoded text features Enhancement is performed to obtain the enhanced image features V. * and enhanced text features B * Specifically:
[0185] The result and The gating mechanism is applied to the region features of the enhanced image and text respectively:
[0186]
[0187]
[0188]
[0189]
[0190] in, and To enhance the regional features of the text in the post-image, and Given a learnable weight matrix, the image and text features after two steps of multimodal knowledge enhancement are: and
[0191] It should be noted that the device descriptions in the above embodiments correspond to the method descriptions in the embodiments, and the embodiments of the present invention will not be repeated here.
[0192] The aforementioned processor and memory can be devices with computing capabilities, such as computers, microcontrollers, or single-chip microcomputers. In specific implementations, this embodiment of the invention does not limit the execution entity and allows selection based on the needs of the actual application. Data signals are transmitted between the memory and processor via a bus, which will not be elaborated upon in this embodiment.
[0193] Based on the same inventive concept, embodiments of the present invention also provide a computer-readable storage medium, the storage medium including a stored program, which, when the program is running, controls the device where the storage medium is located to execute the method steps in the above embodiments.
[0194] The computer-readable storage medium includes, but is not limited to, flash memory, hard disk, solid-state drive, etc. It should be noted that the description of the readable storage medium in the above embodiments corresponds to the method description in the embodiments, and will not be repeated here.
[0195] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. A computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of the present invention is generated.
[0196] A computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. Computer instructions can be stored in or transmitted through a computer-readable storage medium. A computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be magnetic or semiconductor, etc.
[0197] References
[0198] [1] Mahadevan V, Wong C, Pereira J, et al. Maximum covariance unfolding: Manifold learning for bimodal data [C]. In Proceedings of the International Conference on Neural Information Processing Systems, Granada: MIT Press, 2011: 918–926.
[0199] [2]Blei DM, Jordan M I.Modeling annotated data[C].In Proceedings of the International Conference on ACM Special Interest Group on InformationRetrieval,Toronto:ACM,2003:127–134.
[0200] [3]Lee K, Chen
[0201] [4]Liu C, Mao Z, Zhang T, et al. Graph Structured Network for Image-TextMatching[C]. In Proceedings of the IEEE / CVF Conference on Computer Vision andPattern Recognition, Seattle: IEEE Computer Vision Foundation, 2020:10918–10927.
[0202] [5]Chen J, Hu H, Wu H, et al. Learning the best pooling strategy for visual semantic embedding[C]. In Proceedings of the IEEE / CVF Conference on Computer Vision and Pattern Recognition, virtual: IEEE Computer Vision Foundation, 2021: 15789–15798.
[0203] Unless otherwise specified, the model numbers of the various devices in this embodiment of the invention are not limited, and any device that can perform the above functions is acceptable.
[0204] Those skilled in the art will understand that the accompanying drawings are merely schematic diagrams of a preferred embodiment, and the sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0205] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A cross-modal matching method based on knowledge enhancement, characterized in that, The method includes: Based on external knowledge information from multimodal clustering, a multi-head attention mechanism is used to encode the input image features and text features, resulting in encoded image features and encoded text features. Obtain regional semantic knowledge information based on multimodal aggregation and utilize label information. Guided by the image region features With tag information Perform aggregation and utilize the aggregated features. , and encoded text features Interacting with a graph convolutional network using multi-step reasoning to obtain regional semantic knowledge information based on multimodal aggregation. ; Region semantic knowledge information based on multimodal aggregation Through a gating mechanism, the encoded image features are... and encoded text features Enhancement is performed to obtain enhanced image features. and enhanced text features ; Enhanced image features and enhanced text features Simultaneously employing adaptive joint inference with global and local alignment, cross-modal matching of image and text pairs is achieved.
2. The cross-modal matching method based on knowledge enhancement according to claim 1, characterized in that, The external knowledge information based on multimodal clustering is: First, perform an analysis of external image features in the image space. Clustering, utilizing foreign text features in WordNet Guided by similarity judgment, the abstract semantics in the image space are integrated with the semantics in the text space; a second clustering is performed in the image-text joint embedding space.
3. The cross-modal matching method based on knowledge enhancement according to claim 2, characterized in that, The external knowledge information for multimodal clustering includes: Nouns are inversely classified into k image semantic centers using similarity discrimination. Belongs to the The probability of a semantic center in an image is: ; in, The calculation method is cosine similarity, which is used to select the top semantic center for each image. The nouns ranked by score, nouns Will be selected as the An image semantic center is equivalent to: ; ; in, Corresponding to the first The noun at the semantic center of an image -th is the maximum confidence level; sets the semantic center of the image. The selected set of nouns is Based on the noun selected for each image semantic center, the features of each image region mapped to the joint embedding space are calculated as follows: ; ; in, For image region Image semantic center of the class The selected nouns To control the margin of aggregation, the image region features after semantic enhancement of the noun text are: ,in: ; By analyzing the features of the fused image regions By reapplying the k-means clustering algorithm, we obtain external knowledge based on multimodal clustering, namely: ; ; in, This represents the semantic center of the image region features after the algorithm converges.
4. The cross-modal matching method based on knowledge enhancement according to claim 1, characterized in that, The use of tag information Guided by the image region features With tag information The aggregation process specifically involves: The i-th region will be classified as the i-th region. Each tag information is equivalent to: ; ; in, Corresponding to the first Regional features of individual label information -th is the maximum confidence level, setting the image label information. The selected set of regional features is Aggregating the selected image regions yields: ; ; in, Image tag information The corresponding aggregated image region features; then the image region label fusion information is represented as , It is obtained by concatenating label information and image region aggregation features: .
5. The cross-modal matching method based on knowledge enhancement according to claim 1, characterized in that, The gating mechanism is used to encode image features. and encoded text features Enhancement is performed to obtain enhanced image features. and enhanced text features Specifically: The result and The gating mechanism is applied to the region features of the enhanced image and text respectively: ; ; ; ; in, and To enhance the regional features of the text in the post-image, and Given a learnable weight matrix, the image and text features after two steps of multimodal knowledge enhancement are: and .
6. A cross-modal matching device based on knowledge enhancement, characterized in that, The device includes a processor and a memory, the memory storing program instructions, the processor invoking the program instructions stored in the memory to cause the device to perform the method according to any one of claims 1-5.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, the computer program including program instructions that, when executed by a processor, cause the processor to perform the method described in any one of claims 1-5.
Citation Information
Patent Citations
Multi-modal interaction cross-modal retrieval method and system
CN115017358A
Image text matching method based on cross-modal confidence perception
CN115033727A
