Content matching method, device, equipment, storage medium and computer program product
By combining the fusion processing of text and image features in article retrieval, multi-modal feature embedding vectors are extracted, which solves the problems of coarse feature granularity and lack of information in the existing technology, and significantly improves the accuracy of content matching.
Patent Information
- Application Number
- CN202111270814.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-29
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2041-10-29
AI Technical Summary
In the existing technology, when the article retrieval method uses TF-IDF for content matching, it lacks consideration of word order, has coarse feature granularity, and fails to effectively represent image information, resulting in low content matching accuracy.
By determining the text and image feature vectors of the content to be queried, performing fusion weighting processing, extracting multi-modal feature embedding vectors, and combining text and image features with the neural network model to improve the accuracy of content matching.
It achieves a more comprehensive representation of the multi-modal features of the content, improves the accuracy of content matching, and solves the problems of coarse feature granularity and lack of information.
Smart Images

Figure CN114330475B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a content matching method, apparatus, device, storage medium and computer program product. Background Art
[0002] The application scenario of content matching in the prior art can be article retrieval, which is widely used in the fields of article deduplication. Through article retrieval, it is possible to query whether there is content similar to the article to be queried in the database. The article retrieval method in the prior art directly uses TF-IDF (Term Frequency–Inverse Document Frequency). TF-IDF is a commonly used weighting technology for information retrieval and data mining. TF-IDF weights word vectors to obtain the text feature vector of the article, but TF-IDF only considers the vectorization of the text features of the article, resulting in coarse feature granularity and missing information of the article, and the accuracy of article retrieval is not high, that is, the accuracy of content matching is not high. Summary of the invention
[0003] In view of the shortcomings of the existing methods, the present application proposes a content matching method, device, equipment, computer-readable storage medium and computer program product to solve the problem of how to improve the accuracy of content matching.
[0004] In a first aspect, the present application provides a content matching method, comprising:
[0005] Determine a first feature vector of the text in the content to be queried and a second feature vector of each image, wherein the first feature vector is a vectorized fine-grained representation of the text, and the second feature vector is used to represent the visual features of each image;
[0006] The second feature vectors of each image are fused to determine the image feature vector of the content to be queried;
[0007] Performing weighted fusion processing between the image feature vector and the first feature vector to determine a feature embedding vector of the content to be queried;
[0008] According to the feature embedding vector of the content to be queried and the preset feature embedding vectors of multiple contents, similar contents corresponding to the content to be queried are matched from the multiple contents.
[0009] In one embodiment, determining a first feature vector of text in the content to be queried includes:
[0010] Inputting the text in the content to be queried into the matching sub-model of the text feature extraction model of the neural network model, matching the text with a plurality of preset cluster sets, and determining a cluster set corresponding to the first feature embedding vector of the text, wherein the plurality of cluster sets include a cluster set, and each cluster set in the plurality of cluster sets includes a plurality of text labels belonging to the same type;
[0011] A first feature vector is determined according to the first feature embedding vector of the text and the feature embedding vectors of each text label in the cluster set.
[0012] In one embodiment, determining the first feature vector according to the first feature embedding vector of the text and the feature embedding vectors of each text tag in the cluster set includes:
[0013] Determine a first similarity between a first feature embedding vector of the text and a feature embedding vector of each text tag;
[0014] A first feature vector is determined according to the feature embedding vector of each text tag and the weight corresponding to each first similarity, and each first similarity is positively correlated with the weight corresponding to each first similarity.
[0015] In one embodiment, determining the first feature vector according to the feature embedding vectors of each text tag and the weights corresponding to each first similarity includes:
[0016] Input each first similarity into a sorting sub-model of a text feature extraction model of a neural network model, sort each first similarity from large to small, and determine the top M first similarities;
[0017] A first feature vector is determined according to weights corresponding to the M first similarities and feature embedding vectors of text tags corresponding to the M first similarities, where M is a positive integer.
[0018] In one embodiment, before determining the first feature vector of the text in the to-be-queried content, the method further includes:
[0019] Get multiple text labels;
[0020] The multiple text labels are clustered to obtain multiple cluster sets, each of the multiple cluster sets including multiple text labels belonging to the same type.
[0021] In one embodiment, determining the second feature vector of each image in the content to be queried includes:
[0022] Each image in the content to be queried is input into the trained image encoder of the image feature extraction model of the neural network model, and each image is encoded to obtain a second feature vector of each image in the content to be queried.
[0023] In one embodiment, before determining the second feature vector of each image in the to-be-queried content, the method further includes:
[0024] Obtain multiple text samples and multiple image samples in a preset data set;
[0025] Inputting a plurality of text samples into a text encoder of the image feature extraction model, and inputting a plurality of image samples into an image encoder of the image feature extraction model, performing comparative learning processing, and obtaining a plurality of positive sample pairs, each of the plurality of positive sample pairs comprising an image sample and a text sample, and a second similarity between an image sample and a text sample being greater than or equal to a preset similarity threshold;
[0026] Determine the loss function value of each positive sample pair, where the loss function value is used to characterize the distance between the feature embedding vector of the image sample and the feature embedding vector of the text sample in each positive sample pair;
[0027] Based on the loss function value of each positive sample pair, updating the text encoder and the image encoder;
[0028] If the loss function value of each positive sample pair is less than or equal to the preset loss function value threshold, the training of the text encoder and the image encoder is terminated, and the trained image encoder is used as the trained image encoder of the image feature extraction model.
[0029] In one embodiment, the second feature vectors of each image are fused to determine the image feature vector of the content to be queried, including:
[0030] Inputting the second feature vector of each image into the first text image feature fusion model of the neural network model for fusion processing to obtain the image feature vector of the content to be queried;
[0031] The neural network model also includes a text feature extraction model, an image feature extraction model, a second text image feature fusion model and a weighted splicing model.
[0032] In one embodiment, performing a fusion weighting process between the image feature vector and the first feature vector to determine the feature embedding vector of the content to be queried includes:
[0033] The image feature vector and the first feature vector are input into the second text image feature fusion model of the neural network model for fusion processing to obtain an N-dimensional initial feature embedding vector of the content to be queried;
[0034] The N-dimensional initial feature embedding vector of the content to be queried is input into the weighted splicing model of the neural network model, the N features corresponding to the N-dimensional initial feature embedding vector are weighted respectively, and the weighted features are spliced to obtain the feature embedding vector of the content to be queried, where N is a positive integer.
[0035] In a second aspect, the present application provides a content matching device, including:
[0036] A first processing module is used to determine a first feature vector of text in the content to be queried and a second feature vector of each image, wherein the first feature vector is a vectorized fine-grained representation of the text, and the second feature vector is used to represent a visual feature of each image;
[0037] A second processing module is used to fuse the second feature vectors of each image to determine the image feature vector of the content to be queried;
[0038] A third processing module is used to perform a fusion weighting process between the image feature vector and the first feature vector to determine a feature embedding vector of the content to be queried;
[0039] The fourth processing module is used to match similar content corresponding to the to-be-queried content from multiple contents according to the feature embedding vector of the to-be-queried content and the preset feature embedding vectors of multiple contents.
[0040] In a third aspect, the present application provides an electronic device, including: a processor, a memory, and a bus;
[0041] A bus, used to connect the processor and memory;
[0042] A memory, used for storing operation instructions;
[0043] The processor is used to execute the content matching method of the first aspect of the present application by calling an operation instruction.
[0044] In a fourth aspect, the present application provides a computer-readable storage medium storing a computer program, and the computer program is used to execute the content matching method of the first aspect of the present application.
[0045] In a fifth aspect, the present application provides a computer program product, including a computer program, which implements the steps of the content matching method in the first aspect of the present application when the computer program is executed by a processor.
[0046] The technical solution provided in the embodiments of the present application has at least the following beneficial effects:
[0047] Determine the first feature vector of the text in the content to be queried and the second feature vector of each image, the first feature vector is a vectorized fine-grained representation of the text, and the second feature vector is used to represent the visual features of each image; fuse the second feature vectors of each image to determine the image feature vector of the content to be queried; fuse the image feature vector with the first feature vector and perform weighted processing to determine the feature embedding vector of the content to be queried; thus, the first feature vector of the text and the image feature vector are fused and weighted to realize the extraction of the feature embedding vector of the content to be queried, that is, the extraction of the multimodal features of the content to be queried, so that the text and image of the content can be more comprehensively represented through the feature embedding vector of the content to be queried, thereby improving the accuracy of content matching. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in describing the embodiments of the present application are briefly introduced below.
[0049] Figure 1 A schematic diagram of the architecture of a content matching system provided in an embodiment of the present application;
[0050] Figure 2 A flowchart of a content matching method provided in an embodiment of the present application;
[0051] Figure 3 A schematic diagram of a process for similarity recall of original articles provided in an embodiment of the present application;
[0052] Figure 4 A schematic diagram of an article search provided in an embodiment of the present application;
[0053] Figure 5 A schematic diagram of the structure of a content matching device provided in an embodiment of the present application;
[0054] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0055] The embodiments of the present application are described below in conjunction with the drawings in the present application. It should be understood that the implementation methods described below in conjunction with the drawings are exemplary descriptions for explaining the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions of the embodiments of the present application.
[0056] It will be understood by those skilled in the art that, unless specifically stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the terms "including" and "comprising" used in the embodiments of the present application refer to that the corresponding features can be implemented as the presented features, information, data, steps, operations, elements and / or components, but do not exclude the implementation as other features, information, data, steps, operations, elements, components and / or combinations thereof supported by the technical field. It should be understood that when we say that an element is "connected" or "coupled" to another element, the one element may be directly connected or coupled to the other element, or it may refer to that the one element and the other element establish a connection relationship through an intermediate element. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein indicates at least one of the items defined by the term, for example, "A and / or B" indicates that it is implemented as "A", or is implemented as "A", or is implemented as "A and B".
[0057] In the related art, the TD-IDF weighting method is to perform a weighted summation of all word vectors in the article according to the TF-IDF weight. However, the inventors have found that there are at least the following problems:
[0058] (1) Directly use TF-IDF to weight word vectors to obtain text vectors without considering the order of words.
[0059] (2) For the feature extractor learned from the public dataset, the features extracted by the feature extractor have the problem of coarse feature granularity.
[0060] (3) TF-IDF only considers the vectorization of the text features of the article, and the feature vector of the article lacks the representation of the image information in the article.
[0061] The TD-IDF weighted method directly uses TF-IDF to weight word vectors to obtain text vectors. On the one hand, this scheme does not take the order of words into consideration. On the other hand, the feature extractor learned from the public dataset does not meet the requirements of the image-text labeling task for fine-grained features.
[0062] Based on this, in order to solve at least one of the problems existing in the existing content matching and better meet the needs of content matching, the present application provides a content matching method, based on which the accuracy of content matching can be improved.
[0063] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0064] The embodiment of the present application is a content matching method provided by the content matching system, and the content matching method involves the field of artificial intelligence, such as machine learning, deep learning and other technologies. For example, the model involved in the embodiment of the present application can use the artificial neural network technology included in machine learning; for another example, the content matching involved in the embodiment of the present application can use deep learning to realize the recognition of text and images in the content.
[0065] Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.
[0066] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. Basic artificial intelligence technologies generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operating / interactive systems, mechatronics and other technologies. Artificial intelligence software technologies mainly include computer vision technology, speech processing technology, natural language processing technology, as well as machine learning / deep learning, autonomous driving, smart transportation and other major directions.
[0067] Machine Learning (ML) is a multi-disciplinary subject that involves probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It specializes in studying how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all areas of artificial intelligence. Machine learning and deep learning usually include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and self-learning.
[0068] Deep Learning (DL) is a new research direction in the field of machine learning. Deep learning is the study of the inherent laws and representation levels of sample data. The information obtained in the learning process is of great help in the interpretation of data such as text, images, and sounds. The ultimate goal of deep learning is to enable machines to have analytical learning capabilities like humans and to be able to recognize data such as text, images, and sounds.
[0069] In order to better understand and illustrate the solutions of the embodiments of the present application, some technical terms involved in the embodiments of the present application are briefly explained below.
[0070] TRANSFORMER: TRANSFORMER was originally proposed as a Seq2Seq model for machine translation. Pre-trained models based on TRANSFORMER have become the preferred architecture in NLP (Natural Language Processing). Various TRANSFORMER variants (X-TRANSFORMER) have improved the original TRANSFORMER from different perspectives.
[0071] Wikipedia: Wikipedia is a multilingual encyclopedia collaborative project based on Wiki technology. It is an online encyclopedia written in multiple languages.
[0072] XLNet: XLNet is a general autoregressive pre-training method.
[0073] One-vs-All: One-vs-All is a one-to-many algorithm. One-vs-All uses multiple classifiers. For each class, it is assumed to be a positive class, and then a binary classification algorithm is used to obtain the classification of each class.
[0074] Zero-shot learning: In traditional classification models, in order to solve multi-classification problems, such as three categories: cats, dogs, and pigs, a large number of images of cats, dogs, and pigs are needed for model training. Then, given a new image, it can be determined whether it belongs to the cat, dog, or pig category. However, for categories that did not appear in the previous training images, such as cows, the model cannot recognize cows. Zero-shot learning is designed to solve this problem. In zero-shot learning, a category does not appear in the training samples, but the characteristics of this category are known, and then this category can be identified through the corpus knowledge base.
[0075] CLIP model: The CLIP contrastive language-image pretraining (Contrastive Language-Image Pretraining) model adopts the classic dual-tower structure, with different image encoders (Image Encoder) and text encoders (Text Encoder) for the image domain and text domain; among them, the text encoder adopts the classic Transformer structure, and the image encoder adopts two types: the first image encoder is the improved residual network ResNet, which chooses to use the attention-based pooling layer to replace the global pooling layer of ResNet; the ViT structure is used as the second image encoder for experiments.
[0076] Batch Size: The number of samples selected for one training.
[0077] NeXtVLAD: NeXtVLAD reduces the frame-level features into video-level features, and then classifies the video-level features. NeXtVLAD first decomposes the high-dimensional features into a set of low-dimensional features, then adds the attention mechanism, and then encodes and decodes the features to finally achieve the effect of dimensionality reduction.
[0078] BERT model: The BERT (Bidirectional Encoder Representations from Transformers) model is a language representation model that is trained using very large data and extremely high computational overhead.
[0079] SE module: The SE (Squeeze and Excitation) module focuses on the relationship between channels, hoping that the model can automatically learn the importance of different channel features.
[0080] k-means clustering algorithm: k-means clustering algorithm is an iterative clustering analysis algorithm. Its steps are: divide the data into K groups in advance, randomly select K objects as the initial cluster centers, and then calculate the distance between each object and each seed cluster center, and assign each object to the cluster center closest to it. The cluster centers and the objects assigned to them represent a cluster. Each time a sample is assigned, the cluster center of the cluster is recalculated based on the existing objects in the cluster. This process will be repeated until a certain termination condition is met. The termination condition can be that no (or the minimum number) of objects are reassigned to different clusters, no (or the minimum number) of cluster centers change again, and the sum of squared errors is locally minimized.
[0081] The solution provided in the embodiments of the present application relates to artificial intelligence. The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0082] The solution provided in the embodiments of the present application can be applied to any application scenario in the field of artificial intelligence that requires content matching, such as article retrieval.
[0083] In order to better understand the solution provided by the embodiment of the present application, the solution is described below in conjunction with a specific application scenario.
[0084] In one embodiment, Figure 1 FIG. 1 shows a schematic diagram of the architecture of a content matching system applicable to an embodiment of the present application. It can be understood that the content matching method provided in the embodiment of the present application can be applied to but not limited to the following applications: Figure 1 In the application scenario shown.
[0085] In this example, Figure 1 As shown, the architecture of the content matching system in this example may include but is not limited to a content matching platform 10 and a database system 20, wherein the content matching platform 10 may be a server or a terminal, and the database system 20 may be a server; the content matching platform 10 and the database system 20 may interact through a network. A neural network model 110 is run in the content matching platform 10, and the neural network model 110 includes a text feature extraction model 111, an image feature extraction model 112, a first text image feature fusion model 113, a second text image feature fusion model 114, and a weighted splicing model 115.
[0086] The text of the content to be queried is input into the text feature extraction model 111 to determine the first feature vector of the text in the content to be queried, and each image of the content to be queried is respectively input into the image feature extraction model 112 to determine the second feature vector of each image in the content to be queried; the second feature vector of each image is input into the first text image feature fusion model 113, and the second feature vectors of each image are fused to determine the image feature vector of the content to be queried; the image feature vector and the first feature vector are input into the second text image feature fusion model 114 and the weighted splicing model 115 to perform fusion weighted processing to determine the feature embedding vector of the content to be queried; according to the feature embedding vector of the content to be queried and the feature embedding vectors of multiple contents in the database system 20, similar content corresponding to the content to be queried is matched from multiple contents; wherein the content can be an article, and the image can be a picture, a video frame, etc.
[0087] It is understandable that the above is only an example and this embodiment is not limited here.
[0088] Among them, the terminal can be a smart phone (such as Android phone, iOS phone, etc.), a mobile phone simulator, a tablet computer, a laptop computer, a digital broadcast receiver, a MID (Mobile Internet Devices), a PDA (Personal Digital Assistant), a vehicle terminal (such as a vehicle navigation terminal), a smart speaker, a smart watch, etc. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server or server cluster that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The above-mentioned network may include but is not limited to: wired network, wireless network, wherein the wired network includes: local area network, metropolitan area network and wide area network, and the wireless network includes: Bluetooth, Wi-Fi and other networks that realize wireless communication. The specific can also be determined based on the actual application scenario requirements, and is not limited here.
[0089] See also Figure 2 , Figure 2 The flowchart of a content matching method provided by an embodiment of the present application is shown, wherein the method can be executed by any electronic device, such as a server or a terminal. As an optional implementation, the method can be executed by a server or a terminal. For the convenience of description, in the description of some optional embodiments below, the server or terminal will be used as an example to illustrate the execution subject of the method. Figure 2 As shown, the content matching method provided in the embodiment of the present application includes the following steps:
[0090] S201, determining a first feature vector of text in the content to be queried and a second feature vector of each image, wherein the first feature vector is a vectorized fine-grained representation of the text, and the second feature vector is used to represent a visual feature of each image.
[0091] Specifically, the content can be an article, and the image can be a picture, a video frame, etc. For example, the text in the content to be queried can be "Watermelon is a delicious fruit", "There is a Dalmatian in the garden", etc., and the images in the content to be queried can be images of watermelon, people, dogs, cats, birds, etc. For another example, the text in a content to be queried is "Watermelon is a delicious fruit", and the images in the content to be queried are images of watermelons. The first feature vector is a vectorized fine-grained representation of the text, wherein the vectorized fine-grained representation of the text can be used to represent the granularity of words based on clustering. For example, the size of the first feature vector of the text is 1 128, that is, the size of the vectorized fine-grained representation of the text is 1 128.
[0092] S202, fusing the second feature vectors of the images to determine the image feature vector of the content to be queried.
[0093] Specifically, the second feature vectors of multiple images are fused to determine the image feature vector of the content to be queried, wherein the image feature vector of the content to be queried may be an embedding vector.
[0094] S203, performing a fusion weighting process on the image feature vector and the first feature vector to determine a feature embedding vector of the content to be queried.
[0095] Specifically, the feature embedding vector of the content to be queried is used to characterize the feature embedding embedding of the content to be queried. The fusion weighted processing includes fusion processing and weighted processing; the image feature vector and the first feature vector are fused to obtain the N-dimensional initial feature embedding vector of the content to be queried; the N features corresponding to the N-dimensional initial feature embedding vector are weighted respectively, and the weighted features are concatenated to obtain the feature embedding vector of the content to be queried; wherein N is a positive integer.
[0096] S204: Match similar content corresponding to the to-be-queried content from the multiple contents according to the feature embedding vector of the to-be-queried content and the preset feature embedding vectors of the multiple contents.
[0097] Specifically, content matching is performed on the content to be queried to obtain similar content corresponding to the content to be queried in the database, and the content to be queried and the similar content belong to the same category of content. For example, the text in a content to be queried is "watermelon is a delicious fruit", and each image in the content to be queried is an image of watermelon; the text in the similar content is "watermelon is a fruit", and each image in the similar content is an image of watermelon.
[0098] In an embodiment of the present application, a first feature vector of the text in the content to be queried and a second feature vector of each image are determined, the first feature vector being a vectorized fine-grained representation of the text, and the second feature vector being used to represent the visual features of each image; the second feature vectors of each image are fused to determine the image feature vector of the content to be queried; the image feature vector and the first feature vector are fused and weighted to determine the feature embedding vector of the content to be queried; in this way, the first feature vector of the text and the image feature vector are fused and weighted to realize the extraction of the feature embedding vector of the content to be queried, that is, the extraction of the multimodal features of the content to be queried, so that the text and image of the content can be more comprehensively represented through the feature embedding vector of the content to be queried, thereby improving the accuracy of content matching.
[0099] In one embodiment, determining a first feature vector of text in the content to be queried includes steps A1-A2:
[0100] Step A1, input the text in the content to be queried into the matching sub-model of the text feature extraction model of the neural network model, match the text with multiple preset cluster sets, and determine a cluster set corresponding to the first feature embedding vector of the text, the multiple cluster sets include a cluster set, and each cluster set in the multiple cluster sets includes multiple text tags belonging to the same type.
[0101] In one embodiment, the text feature extraction model of the neural network model can be a text feature extraction model XBERT based on supervised training. XBERT improves the shortcoming of the BERT model that it cannot meet the fine-grained features of text, and adds an X-TRANSFORMER module. The X-TRANSFORMER module enables XBERT to focus on fine-grained text labels.
[0102] In one embodiment, XBERT may include a semantic tag indexing module, a deep neural matching module and an integrated sorting module; wherein the semantic tag indexing module is used to establish an indexing system including multiple clustering sets, and the clustering sets can be used as indexes in the indexing system; the deep neural matching module can be a matching sub-model of the text feature extraction model XBERT of the neural network model, and the deep neural matching module matches the text with multiple preset clustering sets to determine a clustering set corresponding to the first feature embedding vector of the text.
[0103] In one embodiment, the deep neural matching module assigns a relevant cluster set to each instance, where the instance can be a text instance of the content. After multiple text tags are clustered, the multiple text tags are divided into K cluster sets. The goal of the deep neural matching module is to find an encoder g to create a feature embedding vector embedding u=g(x) of an instance, and learn a shallow neural network that maps the embedding u of the instance to the relevant cluster set. For example, the deep neural matching module can be a deep TRANSFORMER model. The deep neural matching module maps the features of each instance to a cluster set, which can be represented by an instance-cluster assignment matrix. The instance-cluster assignment matrix is used to represent the correlation between the instance and the cluster set, as shown in formula (1).
[0104] M=YC= Formula (1)
[0105] Where M is the instance-cluster assignment matrix, Y is the instance-text label assignment matrix, and C is the text label-cluster matrix; Represents the correlation between an instance and a cluster set, N represents N instances, K represents K cluster sets, {0,1} represents the value range of the correlation between an instance and a cluster set, and both N and K are positive integers.
[0106] Step A2, determining a first feature vector according to the first feature embedding vector of the text and the feature embedding vectors of each text label in the cluster set.
[0107] In one embodiment, the integrated ranking module included in XBERT determines the first feature vector based on the first feature embedding vector of the text and the feature embedding vectors of each text tag in the cluster set.
[0108] In one embodiment, determining the first feature vector according to the first feature embedding vector of the text and the feature embedding vectors of each text tag in the cluster set includes steps B1-B2:
[0109] Step B1, determining a first similarity between a first feature embedding vector of a text and a feature embedding vector of each text tag.
[0110] In one embodiment, first similarities between the first feature embedding vector of the text and the feature embedding vector of each text tag are calculated to obtain multiple first similarities, wherein each text tag belongs to the same cluster set.
[0111] Step B2, determining the first feature vector according to the feature embedding vector of each text tag and the weight corresponding to each first similarity, wherein each first similarity is positively correlated with the weight corresponding to each first similarity.
[0112] In one embodiment, the greater the first similarity, the greater the weight corresponding to the first similarity. The product between the feature embedding vector of each text label and the weight corresponding to each first similarity is calculated to obtain the vector weight value corresponding to each text label; the sum between the vector weight values corresponding to each text label is calculated to obtain the first feature vector.
[0113] In one embodiment, determining the first feature vector according to the feature embedding vectors of each text tag and the weights corresponding to each first similarity includes:
[0114] Input each first similarity into a sorting sub-model of a text feature extraction model of a neural network model, sort each first similarity from large to small, and determine the top M first similarities;
[0115] A first feature vector is determined according to weights corresponding to the M first similarities and feature embedding vectors of text tags corresponding to the M first similarities, where M is a positive integer.
[0116] In one embodiment, the product of the feature embedding vector of each text tag in the text tags corresponding to M first similarities and the weight corresponding to each first similarity is calculated to obtain the vector weight value corresponding to each text tag in the text tags corresponding to the M first similarities; and the sum of the M vector weight values is calculated to obtain the first feature vector.
[0117] In one embodiment, the integrated ranking module included in XBERT ranks the text labels in the cluster set. For example, given a text label l and an instance x, the integrated ranking module finds a mapping h(x, l) to map the instance x and the text label l to a score, mainly using the One-vs-All method, which regards the assignment of a single text label to an instance as an independent binary classification problem; when the instance x belongs to the cluster set, the text label l is positive, otherwise the text label l is negative.
[0118] The scores of different types of XBERT models can be further integrated. For example, for multiple different types of XBERT models, label 1 may get different scores respectively. Then, the scores are weighted to get the final score of label 1.
[0119] In one embodiment, before determining the first feature vector of the text in the to-be-queried content, steps C1-C2 are also included:
[0120] Step C1, obtaining multiple text labels.
[0121] In one embodiment, the semantic tag indexing module included in XBERT can find meaningful text tag representations to build an indexing system. Generating text tag feature embedding vectors (text tag embedding) includes the following two methods:
[0122] Method 1: Generate text label embedding through label text.
[0123] Specifically, given textual information about a label, such as a short description of a category in the Wikipedia dataset, this short text can be used to represent the label word. The XLNet model can be used to generate the label word l, and the textual label embedding of the label word l can be created by averaging all the word vectors in the label text, as shown in formula (2).
[0124] Formula (2)
[0125] in, Represents the text tag embedding of the label word l, text(l) represents the set of w, w represents the text that explains the label word l (for example, the label word l is watermelon, w is "a delicious fruit"), ǀtext(l)ǀ represents the number of w, l represents the label word l, Represents a feature embedding vector embedding of w.
[0126] Method 2: Generate text label embeddings using keywords in positive examples.
[0127] Specifically, the short text information of the tag may not contain enough information, and some words in the short text may be ambiguous and noisy. Therefore, consider another tag representation derived from the sparse text embedding of the instance, for example, the text tag embedding is the sum of the sparse TF-IDF features of all the relevant instances of the tag word l (tag word l is such as watermelon, a short text is "a delicious fruit", where the feature corresponding to "delicious" is the sparse TF-IDF feature), as shown in formula (3).
[0128] , , l=1,…,LFormula (3)
[0129] in, Represents text tag embedding; Indicates the number of multiple instances, Represents the total number of all label words, Represents an instance The sparse TF-IDF features of
[0130] Step C2: clustering the multiple text labels to obtain multiple cluster sets, each of the multiple cluster sets including multiple text labels belonging to the same type.
[0131] In one embodiment, a k-means clustering algorithm is used to cluster multiple text tag embeddings to establish an index system, and the index system includes multiple cluster sets.
[0132] In one embodiment, determining the second feature vector of each image in the content to be queried includes:
[0133] Each image in the content to be queried is input into the trained image encoder of the image feature extraction model of the neural network model, and each image is encoded to obtain a second feature vector of each image in the content to be queried.
[0134] In one embodiment, the image feature extraction model of the neural network model can be a CLIP model based on self-supervised training for contrasting images and texts. The reasoning stage (application stage) of the CLIP model includes: inputting each image in the content to be queried into the trained image encoder, encoding each image, and obtaining the second feature vector of each image in the content to be queried. For example, an image is passed through the image encoder of the trained CLIP model to extract the image size of 1 The image feature of 512 is the second feature vector of the image.
[0135] In one embodiment, before determining the second feature vector of each image in the to-be-queried content, the method further includes:
[0136] Obtain multiple text samples and multiple image samples in a preset data set;
[0137] Inputting a plurality of text samples into a text encoder of the image feature extraction model, and inputting a plurality of image samples into an image encoder of the image feature extraction model, performing comparative learning processing, and obtaining a plurality of positive sample pairs, wherein each positive sample pair in the plurality of positive sample pairs comprises an image sample and a text sample, and a second similarity between an image sample and a text sample is greater than or equal to a preset similarity threshold;
[0138] Determine the loss function value of each positive sample pair, where the loss function value is used to characterize the distance between the feature embedding vector of the image sample and the feature embedding vector of the text sample in each positive sample pair;
[0139] Based on the loss function value of each positive sample pair, updating the text encoder and the image encoder;
[0140] If the loss function value of each positive sample pair is less than or equal to the preset loss function value threshold, the training of the text encoder and the image encoder is terminated, and the trained image encoder is used as the trained image encoder of the image feature extraction model.
[0141] In one embodiment, the image feature extraction model of the neural network model can be a CLIP model based on self-supervised training for contrastive image and text pre-training. The CLIP model trains the image encoder and the text encoder by contrastive loss and pairing image embedding with text embedding, wherein the image encoder uses ResNet or VIT.
[0142] For example, the training data set of the CLIP model includes: 400 million pairs of structures and 500,000 entries (categories); batch size N=32768, 32768 is 2 to the 15th power, and each batch has N^2 image-text pairs, of which N image-text pairs (for example, an image-text pair, in which the image is an image of watermelon and the text is watermelon) are positive samples, and it is hoped that the distance between the image embedding and the text embedding of the positive samples is as close as possible, and the remaining N^2-N are negative samples, and it is hoped that their embedding similarity can be minimized; among them, the image-text pair can be a picture-text pair.
[0143] For example, the training phase of the CLIP model includes: predicting which images in the dataset are paired with which texts in a contrastive learning manner by pre-training the image encoder and the text encoder, and calculating the contrastive loss, such as the cross entropy loss. The smaller the cross entropy loss, the more the image and text match.
[0144] It should be noted that the workflow of the CLIP model includes: using pre-trained image encoders and text encoders to predict which images in the data set are paired with which texts in a comparative learning manner, and then converting the CLIP model into a zero-shot learning classifier. The CLIP image features (the second feature vector of each image) trained through self-supervision are used as a supplement to the text features (the first feature vector of the text) trained through label supervision, so that the subsequent neural network model can extract the feature embedding vector of the content to be queried. On the one hand, it can obtain feature information with better scalability, and on the other hand, it can make up for the lack of image features, thereby realizing the extraction of multimodal features of the content to be queried, thereby more comprehensively representing the text and image of the content and improving the accuracy of content matching.
[0145] In one embodiment, the second feature vectors of each image are fused to determine the image feature vector of the content to be queried, including the steps of:
[0146] Inputting the second feature vector of each image into the first text image feature fusion model of the neural network model for fusion processing to obtain the image feature vector of the content to be queried;
[0147] The neural network model also includes a text feature extraction model, an image feature extraction model, a second text image feature fusion model and a weighted splicing model.
[0148] In one embodiment, the first text-image feature fusion model of the neural network model may be an aggregation network, such as NeXtVLAD.
[0149] For example, the query content includes 5 images. These 5 images are input into the CLIP model for processing respectively, and 5 image features are obtained, that is, the second feature vectors of the 5 images. The size of the second feature vectors of the 5 images is 1. 512; The second feature vectors of the five images are fused through NeXtVLAD to form a content-level image feature, that is, the image feature vector of the content to be queried. The size of the image feature vector of the content to be queried is 1 512.
[0150] In one embodiment, the image feature vector and the first feature vector are fused and weighted to determine the feature embedding vector of the content to be queried, including steps D1-D2:
[0151] Step D1, input the image feature vector and the first feature vector into the second text image feature fusion model of the neural network model, perform fusion processing, and obtain an N-dimensional initial feature embedding vector of the content to be queried.
[0152] In one embodiment, the second text-image feature fusion model of the neural network model may be an aggregation network, such as NeXtVLAD.
[0153] For example, the text of the query content is input into XBERT, and a content-level text feature embedding vector is obtained, that is, the first feature vector of the text. The size of the first feature vector of the text is 1 128; the size of the image feature vector of the content to be queried is 1 512; The first feature vector of the text and the image feature vector of the content to be queried are fused through NeXtVLAD to form a content-level feature embedding vector, i.e., a 128-dimensional initial feature embedding vector of the content to be queried. The size of the 128-dimensional initial feature embedding vector of the content to be queried is 1 128, N is 128.
[0154] Step D2, input the N-dimensional initial feature embedding vector of the content to be queried into the weighted splicing model of the neural network model, weight the N features corresponding to the N-dimensional initial feature embedding vector respectively, and splice the weighted features to obtain the feature embedding vector of the content to be queried, where N is a positive integer.
[0155] In one embodiment, the weighted concatenation model of the neural network model may be a SE module.
[0156] For example, the 128-dimensional initial feature embedding vector of the content to be queried is input into the SE module, the 128 features corresponding to the 128-dimensional initial feature embedding vector are weighted respectively, and the weighted features are concatenated to obtain the feature embedding vector of the content to be queried. The feature embedding vector of the content to be queried can represent the multimodal feature vector of the content to be queried.
[0157] The application of the embodiments of the present application has at least the following beneficial effects:
[0158] The text feature extraction model based on the supervised training neural network model and the image feature extraction model based on the self-supervised training neural network model are combined, and the features extracted by both (the first feature vector and the image feature vector) are unified into a feature expression that combines text and vision (the feature embedding vector of the content to be queried). On the one hand, the text feature extraction model is used to extract fine-grained surface features related to the label, and on the other hand, the image feature extraction model is used to extract image features with more comprehensive information and better scalability. At the same time, it can avoid the problems caused by the noise and irrationality of the supervision signal itself in supervised training, thereby comprehensively representing the text and image of the content more comprehensively and improving the accuracy of content matching.
[0159] In order to better understand the method provided in the embodiment of the present application, the scheme of the embodiment of the present application is further explained below with reference to examples of specific application scenarios.
[0160] The application scenario of content matching can be article retrieval. The article retrieval provided in the embodiment of the present application is applied to the image and text feature extraction in the audit system, such as the image and text article repetition recall, rights protection article similarity recall, original article similarity recall, etc. Figure 3 As shown, the original article similarity recall provided in the embodiment of the present application includes the following steps:
[0161] S301, obtain the original article of the statement.
[0162] S302, inputting the declared original article into the neural network model to determine the feature embedding vector of the declared original article.
[0163] In one embodiment, Figure 1As shown, the text of the declared original article is input into a text feature extraction model 111 to determine the first feature vector of the text in the declared original article; each image of the declared original article is input into an image feature extraction model 112 to determine the second feature vector of each image in the declared original article; the second feature vector of each image is input into a first text image feature fusion model 113 to perform fusion processing on the second feature vectors of each image to determine the image feature vector of the declared original article; the image feature vector and the first feature vector are input into a second text image feature fusion model 114 and a weighted splicing model 115 to perform fusion weighted processing to determine the feature embedding vector of the declared original article.
[0164] For example, the text feature extraction model 111 of the neural network model 110 can be a text feature extraction model XBERT based on supervised training; the image feature extraction model 112 of the neural network model 110 can be a comparative image and text pre-training CLIP model based on self-supervised training; the first text image feature fusion model 113 of the neural network model 110 can be an aggregation network, such as NeXtVLAD; the second text image feature fusion model 114 of the neural network model 110 can be an aggregation network, such as NeXtVLAD; the weighted splicing model 115 of the neural network model 110 can be a SE module.
[0165] S303, based on the feature embedding vector of the declared original article and the feature embedding vectors of multiple articles in a preset database, determine whether there are similar contents between the declared original article and the multiple articles; when it is determined that there are no similar contents between the declared original article and the multiple articles, go to step S304 for processing; when it is determined that there are similar contents between the declared original article and the multiple articles, go to step S305 for processing.
[0166] S304: The similarity review of the declared original article is passed, and the declared original article is determined to be an original article.
[0167] S305, determine whether the posting time of the similar content is earlier than the posting time of the declared original article. When it is determined that the posting time of the similar content is later than the posting time of the declared original article, go to step S304 for processing; when it is determined that the posting time of the similar content is earlier than the posting time of the declared original article, go to step S306 for processing.
[0168] S306, determine whether the author of the similar content published earlier than the declared original article is the same as the author of the declared original article; when it is determined that the two authors are the same, go to step S307 for processing; when it is determined that the two authors are not the same, go to step S308 for processing.
[0169] S307, determine whether the similar content of the original article with a posting time earlier than the statement has an original mark. When it is determined that the similar content of the original article with a posting time earlier than the statement has no original mark, go to step S304 for processing; when it is determined that the similar content of the original article with a posting time earlier than the statement has an original mark, go to step S308 for processing.
[0170] S308: The similarity review of the declared original article fails, and it is determined that the declared original article is not an original article.
[0171] In one embodiment, in a recommendation scenario, the content matching method provided in the embodiment of the present application can help the business party apply image and text tags to various links of the recommendation system, such as enriching users' long-term and short-term interests, recalling and sorting articles, and improving cold start distribution capabilities.
[0172] In one embodiment, for example, the baseline indicators of the image-text labeling model are 78% accuracy and 57% recall. After adding XBERT fine-grained text features to the image-text labeling model, the accuracy is increased to 80% and the recall is increased to 58%. On this basis, the image features extracted by CLIP are integrated, and the accuracy is increased to 83% and the recall is increased to 60%. The comparison of the effects of different models is shown in Table 1. After adding XBERT and CLIP, the accuracy and recall of the image-text labeling model have been significantly improved compared with the previous image-text labeling model.
[0173] Table 1 Comparison of the effects of different models
[0174]
[0175] See also Figure 4 , Figure 4 A schematic diagram of an article search provided by an embodiment of the present application is shown, wherein the method can be executed by any electronic device, such as a server or a terminal. As an optional implementation, the method can be executed by a server or a terminal. For the convenience of description, in the description of some optional embodiments below, the server or terminal will be used as an example to illustrate the execution subject of the method. Figure 4 As shown, the article retrieval provided in the embodiment of the present application includes the following steps:
[0176] S401, obtaining the article to be searched.
[0177] It should be noted that the articles to be queried are the contents to be queried.
[0178] S402: Input the text of the article to be queried into the text feature extraction model XBERT based on supervised training to determine the first feature vector of the text in the article to be queried.
[0179] It should be noted that XBERT has improved the shortcoming of the BERT model that it cannot meet the fine-grained features of text, and added the X-TRANSFORMER module. The X-TRANSFORMER module enables XBERT to focus on fine-grained text labels.
[0180] S403: Input each image of the article to be queried into the CLIP model based on self-supervised training to determine the second feature vector of each image in the article to be queried.
[0181] S404, inputting the second feature vector of each image into the first NeXtVLAD, fusing the second feature vectors of each image, and determining the image feature vector of the article to be queried.
[0182] S405, input the image feature vector and the first feature vector into the second NeXtVLAD for fusion processing to obtain an N-dimensional initial feature embedding vector of the article to be queried, where N is a positive integer.
[0183] S406, inputting the N-dimensional initial feature embedding vector of the article to be queried into the SE module, weighting the N features corresponding to the N-dimensional initial feature embedding vector respectively, and concatenating the weighted features to obtain the feature embedding vector of the article to be queried.
[0184] S407, judging whether the article to be queried and the multiple articles have similar contents based on the feature embedding vector of the article to be queried and the feature embedding vectors of the multiple articles in the database system.
[0185] The application of the embodiments of the present application has at least the following beneficial effects:
[0186] XBERT is trained using artificial labels as supervisory signals, and the X-TRANSFORMER module is added on this basis to enable it to extract fine-grained label features with rich semantics. The image self-supervised model CLIP is used to extract image features to obtain comprehensive and extensible visual feature expressions while reducing dependence on manual annotations. The text features extracted by the model XBERT trained with artificial labels as supervisory signals and the visual features extracted by the image model CLIP trained in a self-supervised manner are combined. The two are trained and fused as multimodal features and can be used for the next stage model or downstream tasks. The extraction of the feature embedding vector of the article to be queried, that is, the extraction of the multimodal features of the article to be queried, is realized, so that the text and image of the article are more comprehensively represented through the feature embedding vector of the article to be queried, thereby improving the accuracy of article retrieval.
[0187] The present application also provides a content matching device. The structural diagram of the content matching device is as follows: Figure 5As shown, the content matching device 60 includes a first processing module 601 , a second processing module 602 , a third processing module 603 and a fourth processing module 604 .
[0188] A first processing module 601 is used to determine a first feature vector of text in the content to be queried and a second feature vector of each image, where the first feature vector is a vectorized fine-grained representation of the text, and the second feature vector is used to represent a visual feature of each image;
[0189] The second processing module 602 is used to fuse the second feature vectors of each image to determine the image feature vector of the content to be queried;
[0190] The third processing module 603 is used to perform a fusion weighting process between the image feature vector and the first feature vector to determine a feature embedding vector of the content to be queried;
[0191] The fourth processing module 604 is used to match similar content corresponding to the to-be-queried content from multiple contents according to the feature embedding vector of the to-be-queried content and the preset feature embedding vectors of multiple contents.
[0192] In one embodiment, the first processing module 601 is specifically configured to:
[0193] Inputting the text in the content to be queried into the matching sub-model of the text feature extraction model of the neural network model, matching the text with a plurality of preset cluster sets, and determining a cluster set corresponding to the first feature embedding vector of the text, wherein the plurality of cluster sets include a cluster set, and each cluster set in the plurality of cluster sets includes a plurality of text labels belonging to the same type;
[0194] A first feature vector is determined according to the first feature embedding vector of the text and the feature embedding vectors of each text label in the cluster set.
[0195] In one embodiment, the first processing module 601 is specifically configured to:
[0196] Determine a first similarity between a first feature embedding vector of the text and a feature embedding vector of each text tag;
[0197] A first feature vector is determined according to the feature embedding vector of each text tag and the weight corresponding to each first similarity, and each first similarity is positively correlated with the weight corresponding to each first similarity.
[0198] In one embodiment, the first processing module 601 is specifically configured to:
[0199] Input each first similarity into a sorting sub-model of a text feature extraction model of a neural network model, sort each first similarity from large to small, and determine the top M first similarities;
[0200] A first feature vector is determined according to weights corresponding to the M first similarities and feature embedding vectors of text tags corresponding to the M first similarities, where M is a positive integer.
[0201] In one embodiment, the first processing module 601 is further configured to:
[0202] Get multiple text labels;
[0203] The multiple text labels are clustered to obtain multiple cluster sets, each of the multiple cluster sets including multiple text labels belonging to the same type.
[0204] In one embodiment, the first processing module 601 is specifically configured to:
[0205] Each image in the content to be queried is input into the trained image encoder of the image feature extraction model of the neural network model, and each image is encoded to obtain a second feature vector of each image in the content to be queried.
[0206] In one embodiment, the first processing module 601 is further configured to:
[0207] Obtain multiple text samples and multiple image samples in a preset data set;
[0208] Inputting a plurality of text samples into a text encoder of the image feature extraction model, and inputting a plurality of image samples into an image encoder of the image feature extraction model, performing comparative learning processing, and obtaining a plurality of positive sample pairs, wherein each positive sample pair in the plurality of positive sample pairs comprises an image sample and a text sample, and a second similarity between an image sample and a text sample is greater than or equal to a preset similarity threshold;
[0209] Determine the loss function value of each positive sample pair, where the loss function value is used to characterize the distance between the feature embedding vector of the image sample and the feature embedding vector of the text sample in each positive sample pair;
[0210] Based on the loss function value of each positive sample pair, updating the text encoder and the image encoder;
[0211] If the loss function value of each positive sample pair is less than or equal to the preset loss function value threshold, the training of the text encoder and the image encoder is terminated, and the trained image encoder is used as the trained image encoder of the image feature extraction model.
[0212] In one embodiment, the second processing module 602 is specifically configured to:
[0213] Inputting the second feature vector of each image into the first text image feature fusion model of the neural network model for fusion processing to obtain the image feature vector of the content to be queried;
[0214] The neural network model also includes a text feature extraction model, an image feature extraction model, a second text image feature fusion model and a weighted splicing model.
[0215] In one embodiment, the third processing module 603 is specifically configured to:
[0216] The image feature vector and the first feature vector are input into the second text image feature fusion model of the neural network model for fusion processing to obtain an N-dimensional initial feature embedding vector of the content to be queried;
[0217] The N-dimensional initial feature embedding vector of the content to be queried is input into the weighted splicing model of the neural network model, the N features corresponding to the N-dimensional initial feature embedding vector are weighted respectively, and the weighted features are spliced to obtain the feature embedding vector of the content to be queried, where N is a positive integer.
[0218] The application of the embodiments of the present application has at least the following beneficial effects:
[0219] Determine the first feature vector of the text in the content to be queried and the second feature vector of each image, the first feature vector is a vectorized fine-grained representation of the text, and the second feature vector is used to represent the visual features of each image; fuse the second feature vectors of each image to determine the image feature vector of the content to be queried; fuse the image feature vector with the first feature vector and perform weighted processing to determine the feature embedding vector of the content to be queried; thus, the first feature vector of the text and the image feature vector are fused and weighted to realize the extraction of the feature embedding vector of the content to be queried, that is, the extraction of the multimodal features of the content to be queried, so that the text and image of the content can be more comprehensively represented through the feature embedding vector of the content to be queried, thereby improving the accuracy of content matching.
[0220] The present application also provides an electronic device. The structural diagram of the electronic device is as follows: Figure 6 As shown, Figure 6 The electronic device 4000 shown includes: a processor 4001 and a memory 4003. The processor 4001 and the memory 4003 are connected, such as through a bus 4002. Optionally, the electronic device 4000 may also include a transceiver 4004, which may be used for data interaction between the electronic device and other electronic devices, such as data transmission and / or data reception. It should be noted that in actual applications, the transceiver 4004 is not limited to one, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of the present application.
[0221] Processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. Processor 4001 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0222] The bus 4002 may include a path to transmit information between the above components. The bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 4002 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0223] The memory 4003 may be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), magnetic disk storage media, other magnetic storage devices, or any other medium that can be used to carry or store computer programs and can be read by a computer, without limitation herein.
[0224] The memory 4003 is used to store the computer program for executing the embodiment of the present application, and the execution is controlled by the processor 4001. The processor 4001 is used to execute the computer program stored in the memory 4003 to implement the steps shown in the above method embodiment.
[0225] Among them, electronic equipment includes but is not limited to: servers, terminals, etc.
[0226] The application of the embodiments of the present application has at least the following beneficial effects:
[0227] Determine the first feature vector of the text in the content to be queried and the second feature vector of each image, the first feature vector is a vectorized fine-grained representation of the text, and the second feature vector is used to represent the visual features of each image; fuse the second feature vectors of each image to determine the image feature vector of the content to be queried; fuse the image feature vector with the first feature vector and perform weighted processing to determine the feature embedding vector of the content to be queried; thus, the first feature vector of the text and the image feature vector are fused and weighted to realize the extraction of the feature embedding vector of the content to be queried, that is, the extraction of the multimodal features of the content to be queried, so that the text and image of the content can be more comprehensively represented through the feature embedding vector of the content to be queried, thereby improving the accuracy of content matching.
[0228] An embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps and corresponding contents of the aforementioned method embodiment can be implemented.
[0229] The embodiment of the present application also provides a computer program product, including a computer program, which can implement the steps and corresponding contents of the aforementioned method embodiment when executed by a processor.
[0230] Based on the same principle as the method provided in the embodiment of the present application, the embodiment of the present application further provides a computer program product or a computer program, which includes a computer instruction, and the computer instruction is stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the method provided in any optional embodiment of the present application.
[0231] It should be understood that, although each operation step is indicated by arrows in the flowchart of the embodiment of the present application, the implementation order of these steps is not limited to the order indicated by the arrows. Unless clearly stated herein, in some implementation scenarios of the embodiment of the present application, the implementation steps in each flowchart can be performed in other orders according to demand. In addition, some or all of the steps in each flowchart may include multiple sub-steps or multiple stages based on actual implementation scenarios. Some or all of these sub-steps or stages may be executed at the same time, and each sub-step or stage in these sub-steps or stages may also be executed at different times respectively. In different scenarios of execution time, the execution order of these sub-steps or stages may be flexibly configured according to demand, and the embodiment of the present application does not limit this.
[0232] The above is only an optional implementation method for some implementation scenarios of the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the technical concept of the solution of the present application, other similar implementation methods based on the technical ideas of the present application are also within the protection scope of the embodiments of the present application.
Claims
1. A content matching method, It is characterized in that include: Determine a first feature vector of text in the content to be queried and a second feature vector of each image, wherein the first feature vector is a vectorized fine-grained representation of the text, and the second feature vector is used to represent the visual features of each image, and the vectorized fine-grained representation of the text is used to represent the granularity of the words based on clustering; The second feature vectors of the images are fused to determine the image feature vector of the content to be queried; Performing a fusion weighting process between the image feature vector and the first feature vector to determine a feature embedding vector of the content to be queried; According to the feature embedding vector of the content to be queried and the feature embedding vectors of a plurality of preset contents, matching similar contents corresponding to the content to be queried from the plurality of contents; The step of fusing and weighting the image feature vector and the first feature vector to determine the feature embedding vector of the content to be queried includes: Inputting the image feature vector and the first feature vector into a second text image feature fusion model of a neural network model for fusion processing to obtain an N-dimensional initial feature embedding vector of the content to be queried; The N-dimensional initial feature embedding vector of the content to be queried is input into the weighted splicing model of the neural network model, the N features corresponding to the N-dimensional initial feature embedding vector are weighted respectively, and the weighted features are spliced to obtain the feature embedding vector of the content to be queried, where N is a positive integer.
2. The method according to claim 1, It is characterized in that The determining a first feature vector of text in the content to be queried includes: Inputting the text in the content to be queried into the matching sub-model of the text feature extraction model of the neural network model, matching the text with a plurality of preset cluster sets, and determining a cluster set corresponding to the first feature embedding vector of the text, wherein the plurality of cluster sets include the one cluster set, and each of the plurality of cluster sets includes a plurality of text tags belonging to the same type; The first feature vector is determined according to the first feature embedding vector of the text and the feature embedding vectors of each text label in the cluster set.
3. The method according to claim 2, It is characterized in that The determining the first feature vector according to the first feature embedding vector of the text and the feature embedding vectors of each text label in the cluster set includes: Determining a first similarity between a first feature embedding vector of the text and a feature embedding vector of each text tag; The first feature vector is determined according to the feature embedding vectors of the text tags and the weights corresponding to the first similarities, and there is a positive correlation between the first similarities and the weights corresponding to the first similarities.
4. The method according to claim 3, It is characterized in that The determining the first feature vector according to the feature embedding vectors of the text labels and the weights corresponding to the first similarities includes: Input each first similarity into a sorting sub-model of a text feature extraction model of a neural network model, sort each first similarity from large to small, and determine the top M first similarities; The first feature vector is determined according to the weights corresponding to the M first similarities and the feature embedding vectors of the text tags corresponding to the M first similarities, where M is a positive integer.
5. The method according to claim 2, It is characterized in that Before determining the first feature vector of the text in the to-be-queried content, the method further includes: Get multiple text labels; The multiple text labels are clustered to obtain the multiple cluster sets, each of the multiple cluster sets including multiple text labels belonging to the same type.
6. The method according to claim 1, It is characterized in that The determining of the second feature vector of each image in the content to be queried includes: Each image in the content to be queried is input into a trained image encoder of an image feature extraction model of a neural network model, and each image is encoded to obtain a second feature vector of each image in the content to be queried.
7. The method according to claim 6, It is characterized in that Before determining the second feature vector of each image in the to-be-queried content, the method further includes: Obtain multiple text samples and multiple image samples in a preset data set; Input the multiple text samples into the text encoder of the image feature extraction model, and input the multiple image samples into the image encoder of the image feature extraction model, perform contrastive learning processing, and obtain multiple positive sample pairs, each of the multiple positive sample pairs includes an image sample and a text sample, and the second similarity between the image sample and the text sample is greater than or equal to a preset similarity threshold; Determine a loss function value for each positive sample pair, wherein the loss function value is used to characterize the distance between a feature embedding vector of an image sample and a feature embedding vector of a text sample in each positive sample pair; Based on the loss function values of the positive sample pairs, updating the text encoder and the image encoder; If the loss function value of each positive sample pair is less than or equal to a preset loss function value threshold, the training of the text encoder and the image encoder is terminated, and the trained image encoder is used as the trained image encoder of the image feature extraction model.
8. The method according to claim 1, It is characterized in that The fusing the second feature vectors of the images to determine the image feature vector of the content to be queried includes: Inputting the second feature vector of each image into the first text image feature fusion model of the neural network model for fusion processing to obtain the image feature vector of the content to be queried; The neural network model also includes a text feature extraction model, an image feature extraction model, a second text image feature fusion model and a weighted splicing model.
9. A content matching device, It is characterized in that include: A first processing module, used to determine a first feature vector of text in the content to be queried and a second feature vector of each image, wherein the first feature vector is a vectorized fine-grained representation of the text, and the second feature vector is used to represent the visual features of each image, and the vectorized fine-grained representation of the text is used to represent the granularity of the words based on clustering; A second processing module is used to fuse the second feature vectors of the images to determine the image feature vector of the content to be queried; A third processing module, configured to perform a fusion weighting process between the image feature vector and the first feature vector to determine a feature embedding vector of the content to be queried; A fourth processing module, configured to match similar content corresponding to the content to be queried from the multiple contents according to the feature embedding vector of the content to be queried and the feature embedding vectors of the multiple contents preset; The third processing module is specifically used for: Inputting the image feature vector and the first feature vector into a second text image feature fusion model of a neural network model for fusion processing to obtain an N-dimensional initial feature embedding vector of the content to be queried; The N-dimensional initial feature embedding vector of the content to be queried is input into the weighted splicing model of the neural network model, the N features corresponding to the N-dimensional initial feature embedding vector are weighted respectively, and the weighted features are spliced to obtain the feature embedding vector of the content to be queried, where N is a positive integer.
10. An electronic device comprising a memory, a processor and a computer program stored in the memory, It is characterized in that The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 8.
11. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
12. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Text classification method and system based on label information and text characteristics and medium
CN109492101A
Shared content processing method, device, computer equipment and storage medium
CN111581510A
Method and device for determining text label
CN112541055A
Retrieval method and device for retrieval object with multi-modal information
CN113076433A
Text based image search
GB201911724D0
