News event search method and system based on multi-level image-text semantic alignment model
Through the multi-level visual-text semantic alignment model MSAVT, combined with clustering loss and word detection loss, the cross-modal image and text retrieval model is optimized, solving the problems of insufficient image and text alignment level and computing performance bottleneck in the existing technology, and achieving More efficient news event retrieval effect.
Patent Information
- Application Number
- CN202111413975.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-25
- Publication Date
- 2024-10-15
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing cross-modal image and text retrieval models have room for optimization in text feature extraction and loss function design, resulting in insufficient image and text alignment and computational performance bottlenecks, and cannot effectively utilize the multi-modal information of images and text.
A multi-level visual-text semantic alignment model MSAVT is proposed, which extracts image and text features through a deep neural network, combines clustering loss and word detection loss, establishes intra-modal and inter-modal constraints, optimizes the ranking loss function, and uses pre-trained The BERT model improves generalization performance.
It improves the image and text alignment accuracy of cross-modal retrieval, significantly improves the recall rate and average accuracy, reduces retrieval time, and achieves more efficient multi-modal news event retrieval.
Smart Images

Figure CN114297473B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a news event search method based on a multi-level image-text semantic alignment model. Background Art
[0002] Cross-modal retrieval
[0003] Modality refers to the form in which data exists, such as text, images, videos, etc. Cross-modal retrieval aims to use data of one modality as a query to retrieve data of another modality. The most common is image-text retrieval, which is to retrieve related images given a piece of text, or vice versa, retrieve related text given an image. The main difficulty of cross-modal retrieval lies in the "heterogeneous gap". The heterogeneous gap means that due to the inconsistent representation of the query input and the retrieval results, the data of the two are in different distribution spaces. Although the high-level semantics are related, the similarity cannot be directly measured. Therefore, the focus of the research is how to represent the underlying features, how to model the high-level semantics, and how to find a suitable measurement method to calculate the association between modalities. There are currently four main research methods.
[0004] 1) Subspace method
[0005] The projection matrix is learned by exploiting the pairwise co-occurrence information of sample pairs from different modalities, and cross-modal retrieval is achieved by projecting the features of different modalities into a common latent subspace and measuring the similarity of different modalities in it.
[0006] 2) Topic Model Method
[0007] The implicit topic space in cross-modal data is mined through a generative model, thereby mapping the underlying features of the cross-modal data to an invisible semantic space.
[0008] 3) Hash transformation method
[0009] By utilizing the sample pair information of different modalities, we learn the hash transformation of different modalities, map the features of different modalities into a Hamming binary space, and then achieve fast cross-modal retrieval in the Hamming space.
[0010] 4) Deep Learning Methods
[0011] By using the feature extraction capability of deep neural networks, we can extract separate and effective representations of different modalities at the bottom layer, and then establish semantic associations of different modalities at the high layer, and use high-level networks to maximize the relevance of representations of different modalities. Compared with traditional cross-modal retrieval methods, deep learning-based methods have shown great superiority in the extraction, learning, and representation of features of information in different modalities such as images and texts, and have become a research hotspot for cross-modal retrieval in recent years.
[0012] The main evaluation indicator of cross-modal retrieval is recall@K, which calculates the recall rate based on whether the correct answer appears in the first K returned results.
[0013] Representation Learning
[0014] The performance of machine learning methods depends largely on the choice of data representation (or features). In machine learning, representation learning is a collection of techniques for learning a feature, and is a direction used to improve the representation of raw data. The main task of representation learning is to let the computer learn how to automatically extract suitable and useful data features and use the learned features to complete the target task. Representation learning can be divided into two categories: supervised and unsupervised. The former uses labeled data as features, while the latter uses unlabeled data as features for learning.
[0015] With the improvement of computer hardware computing power and the continuous development of neural network architecture, representation learning using deep architecture has been widely used in various tasks in the fields of CV and NLP. Deep learning is a representation learning method with multi-level representation, which is used to represent increasingly abstract concepts or patterns step by step, and is usually in the form of multi-layer neural networks. Deep architecture brings two main advantages: (1) it promotes the reuse of features; (2) deep architecture can obtain higher-level feature abstraction. For example, in the field of CV, for image input data, the widely used method is to use pre-trained deep neural network models (such as VGG, ResNet, etc.) to extract feature information and then use it for subsequent tasks; in the field of NLP, for text input data, feature extractors (such as RNN, Transformer, etc.) are also used to obtain vector representations of words and sentences. At present, ResNet and BERT are the most widely used pre-trained models in the fields of images and text, respectively. Many research works first use them to obtain a baseline embedding representation, and then fine-tune them in downstream tasks to obtain the final embedding representation.
[0016] Metric Learning
[0017] Metric learning [Bellet A, Habrard A, Sebban M. Metric learning [J]. Synthesis Lectures on Artificial Intelligence and Machine Learning, 2015, 9 (1): 1-151.] [Kulis B. Metric learning: A survey [J]. Foundations and trends in machine learning, 2012, 5 (4): 287-364.] (Metric Learning) is a type of task that learns distance functions for different goals. It studies how to learn a distance function on a specific task so that the distance function can help the nearest neighbor-based algorithm achieve better performance. Deep Metric Learning is a method of metric learning. Its goal is to learn the mapping from the original features to a low-dimensional dense vector space (called embedding space) so that the distance between positive samples in the embedding space is closer and the distance between negative samples is farther.
[0018] In deep learning, many metric learning methods use paired samples for loss calculation. This type of method is called pair-based deep metric learning. For example, two samples are randomly selected during the training of the model, features are extracted using the model, and the distance between the features is calculated. If the two samples belong to the same category, the distance between them should be as small as possible, or even 0; if the two samples belong to different categories, the distance between them should be as large as possible, or even infinite. Based on this idea, a loss function is constructed, the loss function is used to measure the distance between sample pairs, and various optimization methods are used to update the model based on the generated loss. The essence of metric learning is the learning of similarity. The loss function can guide the update of neural network parameters, so the optimization of metric learning is mainly the design of the loss function.
[0019] Commonly used loss functions in deep metric learning are:
[0020] 1) Softmax Loss
[0021] Softmax Loss is the most basic loss function for metric learning, which can complete the classification task well but does not consider the distance between classes. The formula is shown in 1-1:
[0022]
[0023] Among them, W and b are classification layer parameters, and m is the amount of training data.
[0024] 2) Center Loss
[0025] Center Loss not only considers the correctness of classification, but also requires a certain distance between classes. The formula is shown in 1-2:
[0026]
[0027] Among them, x i represents the features before the fully connected layer, Indicates the yth i The feature center of each category,
[0028] 3) Triplet Loss
[0029] The triplet loss function [Hoffer E, Ailon N. Deep metric learning using tripletnetwork [C]. International Workshop on Similarity-Based Pattern Recognition, 2015: 84-92.] consists of three parts: the target (Anchor), the positive sample (Positive) and the negative sample (Negative). The purpose of triplet loss is to make the feature expression distance of the same sample as small as possible and the feature expression distance of the different samples as large as possible through learning. The formula is shown in 1-3.
[0030]
[0031] in, is the distance between the target and the positive sample, is the distance between the target and the negative sample, and α is a parameter. The similarity calculation of samples is realized by optimizing the distance between the target sample and the positive sample to be smaller than the distance between the target sample and the negative sample, that is, using the gradient descent method to continuously reduce the loss function.
[0032] Prior art related to the present invention
[0033] Technical solution of prior art 1
[0034] At present, cross-modal image-text retrieval tasks mostly use common space feature learning methods to obtain high-quality and highly semantic cross-modal representations when the image-text models are independent and non-interactive. The representative method is VSE++ [Faghri F, Fleet DJ, Kiros JR, et al. Vse++: Improving visual-semantic embeddings with hard negatives [J]. arXiv preprint arXiv: 1707.05612, 2017.]. VSE++ uses Ranking Loss to make the distance between paired samples in the common space small and the distance between mismatched samples large. At the same time, it uses hard negative samples to improve the performance of visual semantic joint embedding.
[0035] like Figure 1 As shown in the figure, the model mainly consists of two parts. First, the deep neural network is used to extract features of images and texts respectively. Then, with the help of metric learning methods, the loss function is designed to learn to obtain an effective common representation space, namely the joint embedding space. In terms of feature extraction, the VSE++ model uses VGG19 or ResNet152 for image feature extraction and GRU for text feature extraction.
[0036] Difficult samples refer to negative samples that are close to positive samples. In terms of similarity measurement, VSE++ proposes a new loss function, max hinge loss, which advocates that more attention should be paid to difficult samples during the sorting process so that the model can better learn the boundaries between positive and negative samples. (i, c) is a correct image-text pair, i′=argmax j≠i s(j,c),c′=argmax d≠c s(i,c) are the most difficult image and text to distinguish relative to this positive sample. The formula of max hinge loss is shown in 1-4, which is obtained by summing the two symmetrical parts of the distance constraint from the negative sample image to the reference text and the distance constraint from the negative sample text to the reference image.
[0037] L Rank =max c′ [α+s(i,c′)-s(i,c)] + +max i′ [α+s(c,i′)-s(i,c)] + #(1-4)
[0038] in, s(i,c) is the cosine distance function that measures the similarity between the two modalities of image and text, and α is the set hyperparameter, i.e., margin.
[0039] Disadvantages of the prior art 1
[0040] 1) Text feature extraction can still be optimized
[0041] The commonly used feature extraction method in NLP tasks is to combine word2vec and RNN. Currently, the Transformer-based BERT model is pre-trained on a very large corpus and has shown stronger capabilities in the task of text feature extraction.
[0042] 2) Loss function design can still be optimized
[0043] Formula 1-4 only focuses on the relationship between modalities and ignores the relationship within the modality. This results in too many parameters to be adjusted, and the ranking loss is difficult to optimize the representation of images and texts at the same time.
[0044] 3) Insufficient alignment between image and text
[0045] Both words and sentences in text objects are effective descriptions of images, where words are low-level detailed descriptions and sentences correspond to high-level overviews of images. Existing cross-modal image-text retrieval models focus more on sentence-level alignment, which may lead to biased predictions of image details.
[0046] Prior art related to the present invention
[0047] Technical solution of prior art 2
[0048] The main idea of another type of cross-modal image and text retrieval task is to fuse image and text features and calculate cross-modal similarity.
[0049] A typical method is stacked attention in image-text matching [Lee KH, Xi C, Gang H, et al. Stacked Cross Attention for Image-Text Matching [J]. 2018.] (Stacked Cross Attention for Image-Text Matching, SCAN). SCAN uses the attention mechanism to interact the local information of the image and text to obtain better feature representation, and at the same time constructs a similarity function for learning under the commonly used ranking loss.
[0050] Figure 2 It is the Image-Text version, which uses images and texts for attention calculation.
[0051] (1) Use the bottom-up attention model to detect and encode image regions and obtain image features V = {v1,v2,...,v k}, each image feature encodes a region in the image.
[0052] (2) Use bidirectional GRU to obtain text features. A sentence of length n obtains a set of word vectors E = {e1, e2, ..., e n}.
[0053] (3) Calculate the similarity between all image pairs, s ij represents the similarity between the i-th image region and the j-th word.
[0054]
[0055] (4) Normalize the similarity scores.
[0056]
[0057] (5) Use each image region and word in the sentence to perform attention calculations.
[0058]
[0059]
[0060] is the sentence vector that focuses on the i-th image region.
[0061] (6) Calculate the similarity between the image region and the sentence vector.
[0062]
[0063] (7) Superimpose the similarities between the i image regions and the sentence to obtain the overall similarity between image I and text T.
[0064]
[0065]
[0066] Disadvantages of the second prior art
[0067] Although the combination of image and text features can provide more cross-feature information for the hidden layer of the model, the top-level embedding vector cannot be used to independently represent the input signals of the image and text. Compared with the common space feature learning method, the search process of the cross-modal similarity measurement method is time-consuming. Specifically, when a user enters a text query q, the system needs to calculate the feature combination of all images and q online to obtain the similarity score between q and each image. The computing performance is a huge bottleneck, making it impossible to apply in practice. Summary of the invention
[0068] The purpose of this invention is to construct a multimodal news image-text dataset, fill the gap of such datasets, propose a multi-level visual-text semantic alignment model MSAVT (Multi-level Semantic Alignments for Visual and Text) for image-text matching; design and implement a news event cross-modal image-text search system to meet the current news retrieval needs.
[0069] To achieve the purpose of the invention, the technical solution provided by the invention is: a news event search method based on a multi-level image-text semantic alignment model, comprising the following steps:
[0070] Step 1), construct a multimodal news image and text dataset;
[0071] Step 1.1) News event selection;
[0072] After sorting and summarizing the news events, we get the event names;
[0073] Step 1.2) Acquisition of news data
[0074] Using the event name obtained in step 1.1) as a search term, searching for the news report data that matches the event name, extracting the picture and title text pair of each news report as a sample data of the news event;
[0075] Step 1.3) Data annotation;
[0076] Preprocess the obtained data through the algorithm to complete the initial algorithm screening of the data set;
[0077] Step 2), establish a multi-level visual-text semantic alignment model MSAVT for image-text matching;
[0078] Step 2.1) Use a deep neural network model to extract image features and text features;
[0079] Step 2.2) Mapping the extracted text features and image features to the joint embedding space of image semantics and text semantics;
[0080] Step 2.3) proposes a clustering loss that simultaneously establishes intra-modal constraints and inter-modal constraints;
[0081] Step 2.4) For image features, add word detection loss to focus on word-level alignment;
[0082] Step 2.5) Clustering loss and word detection loss are used as supplements to the ranking loss to obtain the final overall loss function;
[0083] Step 3), realize cross-modal image and text search of news events;
[0084] By searching text by image or searching image by text, cross-modal image and text search of news events can be achieved.
[0085] The preferred technical solution provided by the present invention is:
[0086] In the step 1.3) of data annotation, the specific steps of the algorithm initial screening include:
[0087] Step 1.3.1) Use the pre-trained RoBERTa model to extract text features and the pre-trained ResNet50 model to extract image features;
[0088] Step 1.3.2) Each event is considered as a class, and the text center and image center of the class are calculated by taking the average of the text and image features;
[0089] Step 1.3.3) The 20% data closest to the center of the image feature or text feature is determined to be reliable data with high confidence, and their union is taken and retained;
[0090] Step 1.3.4) The remaining data are judged by manual annotation.
[0091] Another preferred technical solution provided by the present invention is:
[0092] The clustering loss in step 2.3) is:
[0093] Assume that the data set has K clusters and each cluster contains N sample pairs. Given an object i in cluster k, the intra-cluster distance is calculated as formula (2-2):
[0094]
[0095] Among them, r ik is the vector representation of object i in cluster k, μ k is the center of the kth cluster, which is defined as shown in Explanation 2-3:
[0096]
[0097] The definition of variance σ is shown in formula 2-4:
[0098]
[0099] The distance between clusters can be calculated using formula 2-5:
[0100]
[0101] By minimizing the intra-cluster distance and maximizing the inter-cluster distance, we get the clustering loss defined as Formula 2-6:
[0102]
[0103] In step 2.4), the word detection loss is used to evaluate whether an image contains high-frequency words in the title text of a news image-text pair. The attribute dictionary is set according to the dataset used. The attribute dictionary consists of 1000 high-frequency words in the text data in the multimodal dataset. The specific calculation steps of the word detection loss are:
[0104] Step 2.4.I) Use the weight matrix W to multiply the image descriptor υ to obtain the probability score s of each word in the top1k word set, which is defined as shown in Formula 2-7:
[0105] s=Wυ#(2-7)
[0106] Step 2.4.II) Calculate in advance which attributes in the attribute dictionary (i.e., high-frequency words) are contained in the title text of each news image-text pair as labels for the classification problem, and use 1000 binary classifiers to calculate the word detection loss L word , as shown in Formula 2-8:
[0107]
[0108] Among them, s i represents the probability score of the i-th word, t i ∈{0, 1} represents whether the i-th word appears in the title text.
[0109] The overall steps of training the dataset are as follows:
[0110] Step 2.4.1) Use the pre-trained ResNet-152 model and fix its weights as the image feature encoder;
[0111] Step 2.4.2) Based on the overall loss function, use the BP algorithm to update the parameters of the model except ResNet-152;
[0112] Step 2.4.3) The above training was performed for 40 rounds, with an initial learning rate of 0.001, which was reduced by a factor of 10 every 20 epochs;
[0113] Step 2.4.4) The weights of ResNet-152 are no longer fixed, and the entire architecture is fine-tuned end-to-end in 50 rounds of training. The initial learning rate is 0.00001 and is decreased 10 times every 20 epochs. During the entire training process, the weight λ1 is fixed to 1 and λ2 is fixed to 0.1.
[0114] Another preferred technical solution provided by the present invention is:
[0115] In the step 3),
[0116] The above-mentioned text-by-image search is that the user uploads a news picture as a search term, and the system inputs it into the trained MSAVT model for forward propagation, calculates its Euclidean coordinates in the joint embedding space, and returns the N news headline text data closest to it, thereby realizing text-by-image search;
[0117] In the text-to-image search, the user uploads the news title text as the search term, and the system inputs it into the trained MSAVT model for forward propagation, calculates its Euclidean coordinates in the joint embedding space, and returns the N news picture data closest to it, thereby realizing text-to-image search.
[0118] The present invention also provides a news event search method based on a multi-level image-text semantic alignment model for news event search. The multi-level visual-text semantic alignment model MSAVT model for image-text matching is used as the algorithm core, and front-end and back-end programming technologies are used to design and implement a news event cross-modal image-text search system. The relationship between two different modal data, title text and accompanying pictures in news reports, is used to achieve retrieval results.
[0119] The beneficial effects of the present invention are:
[0120] News has important social significance, and its expression is mostly in the form of multimodal combination of text and images. The traditional unimodal retrieval form is single, cannot effectively utilize the relationship between different modal information, and cannot meet the current needs of netizens to obtain news. Cross-modal image and text retrieval can use the characteristics of low feature heterogeneity and high semantic correlation between news title text and accompanying pictures in news reports to return retrieval effects of different modalities and enrich people's understanding of the same news event. Therefore, the present invention constructs a multimodal news image and text dataset to fill the gap in this type of dataset; the present invention proposes a multi-level visual-text semantic alignment model MSAVT (Multi-level Semantic Alignments for Visual and Text) for image and text matching; and designs and implements a cross-modal image and text search system for news events to meet current news retrieval needs.
[0121] In the MSAVT model, a clustering loss is added to perform both intra-modal and inter-modal constraints, and a word detection module is added to focus on the alignment of images and texts at the word level, improving the traditional ranking loss function. Compared with the existing technical solutions, the image and text alignment accuracy of this cross-modal retrieval model is higher, and when applied to cross-modal image and text retrieval of news events, there are significant improvements in indicators such as recall rate and average accuracy at multiple levels. At the same time, the introduction of a pre-trained BERT model to extract text features improves the generalization performance of the algorithm. The model uses a common space feature learning method to independently obtain vector representations of images and texts, that is, the vector representation of the retrieval results can be pre-stored, the retrieval time is short, and it can be applied to actual scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0122] Figure 1 A schematic diagram of a prior art cross-modal image-text retrieval method using a common space feature learning method;
[0123] Figure 2 A schematic diagram of the prior art cross-modal image-text retrieval using image and text for attention calculation;
[0124] Figure 3 This is a schematic diagram of the algorithm's initial screening work structure for the data set;
[0125] Figure 4 Schematic diagram of text feature extraction using RoBERTa;
[0126] Figure 5 Schematic diagram of residual learning unit;
[0127] Figure 6 This is a schematic diagram of the ResNet model structure;
[0128] Figure 7 Schematic diagram of two residual modules in ResNet;
[0129] Figure 8 Schematic diagram of extracting image features for ResNet-50;
[0130] Fig. 9 This is a schematic diagram of the structure of the multi-level visual-text semantic alignment model MSAVT model proposed in the present invention;
[0131] Fig.10 This is a schematic diagram of a word detection module;
[0132] Fig.11 This is a schematic diagram of a system application using the method of the present invention. DETAILED DESCRIPTION
[0133] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the accompanying drawings.
[0134] The news event search method based on the multi-level image-text semantic alignment model proposed in the present invention comprises the following steps:
[0135] Step 1), build a multimodal news image and text dataset
[0136] Unlike traditional methods, neural network training requires the support of a large number of samples. An available and high-quality news image and text multimodal dataset is the first step in researching cross-modal search algorithms for news events. Currently, there is no open source news event image and text multimodal dataset, so you have to build your own dataset.
[0137] The specific steps to construct a multimodal news image and text dataset are as follows:
[0138] Step 1.1) News event selection
[0139] In view of the particularity of news as an information genre, we selected mainstream domestic and foreign news websites such as BBC, China Daily, Global Times, TNW, VOA NEWS, People's Daily, Engadget, The New York Times, The Wall Street Journal, etc., and crawled more than 600 news headlines, covering major news types such as politics, technology, sports, entertainment, environment, economy and art. After manually sorting and summarizing the news events, we obtained 250 event names.
[0140] Step 1.2) Acquisition of news data
[0141] Use the event name obtained in step 1.2) as the search term, obtain the matching news report data obtained by searching Google News through a crawler, and extract the picture and title text pair of each news report as a sample data of the event.
[0142] Step 1.3) Data labeling
[0143] In order to reduce the workload of manual data cleaning and improve work efficiency, the obtained data is preprocessed through the algorithm, and the difference between each sample and the cluster center is used as compact information, thereby completing the algorithm initial screening of the data set.
[0144] like Figure 3 As shown, in the step 1.3) of data annotation, the specific steps of the algorithm initial screening include:
[0145] Step 1.3.1) Use the pre-trained RoBERTa model to extract text features and the pre-trained ResNet50 model to extract image features;
[0146] RoBERTa is an improved version of BERT. By improving the training tasks and data generation methods, training longer, using larger batches, using more data, etc., it refreshed the records of multiple NLP tasks when it was released. RoBERTa has two main improvements in training methods: first, it deleted the next sentence prediction target (NextSentence Prediction) training task in BERT that may harm the performance of the model, and second, it improved the static mask in BERT and adopted a dynamic mask, that is, masking is performed every time data is input, so as to avoid each sequence being masked in the same way in each round of training.
[0147] The model structure of RoBERTa is exactly the same as that of BERT. The steps of extracting text features are as follows: Figure 4 shown.
[0148] The headline text of the news is directly input into the pre-trained Chinese RoBERTa model. Since the BERT model segments Chinese characters by word, the model outputs the word vector of each word. All the word vectors of a sentence are added up and averaged to obtain the text features of the sentence.
[0149] The ResNet-50 model structure and the steps of using ResNet-50 to extract image features are described as follows:
[0150] ResNet Introduction:
[0151] Generally speaking, increasing the depth of the network in deep learning can enhance the model's feature extraction capabilities, but with further research on deep neural networks, researchers have found that when the number of layers exceeds a certain number, performance will degrade. In response to this, He et al. proposed the Deep Residual Network (ResNet) in the article "Deep residual learning for image recognition", which solved the degradation problem of deep neural networks.
[0152] The idea of building a residual network is to construct a natural identity mapping for the neural network. Assuming that the input and output dimensions of the nonlinear unit of the neural network are consistent, a residual learning unit can be expressed by the following formula.
[0153]
[0154] Among them, the function to be fitted by the neural network unit is That is, the residual, f is the ReLU activation function, x (l) and x (l-1) They represent the input and output of the lth residual unit respectively. Figure 5 As shown, the residual learning unit is generally implemented in the form of a shortcut connection.
[0155] Practice has proved that ResNet solves the degradation problem of deep CNN networks through residual learning and has become a basic feature extraction network in the field of computer vision.
[0156] The ResNet-50 and ResNet-152 mentioned in the present invention refer to ResNet networks of different depths. For example, the "50" in "ResNet-50" means that the model contains 50 weighted convolutional layers. Figure 6 Describes the specific structures of multiple versions of ResNet.
[0157] There are two types of residual modules in ResNet: basic residual block and bottleneck residual block, whose structures are as follows Figure 7 As shown:
[0158] Figure 7 The left side is the basic residual block, corresponding to Figure 3 The convolutional subnetwork in Figure 7 The right side is the bottleneck residual block, corresponding to Figure 3 The convolutional subnetwork in In ResNet-18 and ResNet-34, the basic residual block on the left is used. In ResNet-50, ResNet-101, and ResNet-152, the bottleneck residual block on the right is used. ResNet is a deep convolutional neural network stacked with these residual modules. For the short-circuit connection in the residual module, when the dimensions of the input and output are the same, the identity mapping can be used, that is, the input is directly added to the output. When the dimensions of the input and output are inconsistent, they cannot be added directly. Generally, a 1x1 convolution is used to increase the dimension of the input to make it the same as the residual dimension.
[0159] The steps of ResNet-50 to extract image features are as follows Figure 8 shown.
[0160] The news picture with a size of 3×224×224 is input into the pre-trained ResNet-50 model, and a 2048-dimensional vector is output, which is the feature vector of the image.
[0161] Step 1.3.2) Each event is considered as a class, and the text center and image center of the class are calculated by taking the average of the text and image features;
[0162] Step 1.3.3) The 20% data closest to the center of the image feature or text feature is determined to be reliable data with high confidence, and their union is taken and retained;
[0163] Step 1.3.4) The remaining data is judged by manual annotation;
[0164] Step 2), establish a multi-level visual-text semantic alignment model MSAVT (Multi-Level Semantic Alignments for Visual and Text) for image-text matching;
[0165] The present invention proposes a multi-level visual-text semantic alignment MSAVT model (Multi-Level SemanticAlignments for Visual and Text) for cross-modal retrieval of images and texts of news events. Fig. 9 This is a schematic diagram of the structure of the multi-level visual-text semantic alignment model MSAVT model proposed in the present invention; combined with Fig. 9 The establishment and application of MSAVT are described as follows:
[0166] In order to solve the problem that the existing cross-modal image-text retrieval model has insufficient alignment accuracy, that is, the evaluation indicators still have a lot of room for improvement, we have made improvements to the classic models represented by VSE++0, and proposed a multi-level visual-text semantic alignment model MSAVT (Multi-level Semantic Alignments for Visual and Text) for image-text matching. The improvements were mainly made in two aspects. One is to propose a clustering loss that simultaneously establishes intra-modal constraints and inter-modal constraints. The other is to add a word detection module to the existing model and propose a word detection loss function to focus on word-level alignment. Finally, we also introduced the pre-trained BERT model to model text, which improved the generalization performance of the model. The following introduces the specific implementation steps after the improvement.
[0167] Step 2.1) Use a deep neural network model to extract image features and text features;
[0168] For image features, the original image I of size 224×224 is input. After using multiple data enhancement methods such as random cropping and horizontal flipping, it is input into the ResNet-152 model to obtain a vector of length 2048 as the visual descriptor υ(I) of the image input, as shown in Formula 2-1.
[0169] υ(I)=f img (I)#(2-1)
[0170] The visual descriptor υ(I) is used to compute the word detection loss in step 2.4).
[0171] For text features, the news headline text corresponding to the image is input into the BERT-base model, and the BERT model can automatically segment the text. Since the BERT model segments Chinese characters by word, the model outputs the word vector of each word. All the word vectors of a sentence are added together and averaged to obtain the text feature of the sentence, which is a vector with a length of 768 dimensions.
[0172] Step 2.2) Mapping the extracted text features and image features to the joint embedding space of image semantics and text semantics;
[0173] For image feature vectors, we input them into an embedding module (a two-layer feedforward neural network) and map them into a 1024-dimensional embedding space. For text feature vectors, we input the 768-dimensional sentence vector output by the BERT model into a gated recurrent neural network GRU and map them into a 1024-dimensional embedding space. At this point, image features and text features are mapped into a joint embedding space, and the similarity of vectors can be measured using indicators such as cosine similarity.
[0174] Step 2.3) proposes a clustering loss that simultaneously establishes intra-modal constraints and inter-modal constraints;
[0175] In the news image and text dataset, many image-text pairs belong to one event. The traditional ranking loss only considers the distance constraint that should be satisfied between images and texts, ignoring the distance constraint relationship between images and images, and between texts. From the perspective of clustering, we simultaneously establish the relationship between modalities and within modalities, and divide the picture of a news event and the title of its related news into the same cluster. Assume that the dataset has K clusters and each cluster contains N sample pairs. Given an object i in cluster k, we can calculate the distance within the cluster.
[0176]
[0177] Among them, r ik is the vector representation of object i in cluster k, μ k is the center of the kth cluster, which is defined as shown in Explanation 2-3:
[0178]
[0179] The definition of variance σ is shown in formula 2-4:
[0180]
[0181] The distance between clusters It can be calculated by formula 2-5:
[0182]
[0183] By minimizing the intra-cluster distance and maximizing the inter-cluster distance, we get the clustering loss L cluster It is defined as shown in Formula 2-6:
[0184]
[0185] The clustering loss makes the samples in the cluster closer, and the distance between the same news events will be smaller in the learned joint embedding space, while the distance between different news events will be larger. Compared with the pure ranking loss, the clustering loss builds constraints from the clustering view. It optimizes all samples in the selected cluster instead of one image-text pair in one iteration, so it converges faster and has better results than the ranking loss.
[0186] At present, cross-modal image and text retrieval tasks mostly use common space feature learning methods. The model framework mainly consists of two parts. First, the image and text are extracted separately through deep neural networks, and then the metric learning method, that is, the loss function is designed to learn to obtain an effective common representation space. Although this type of method has achieved remarkable results, there is still a problem of insufficient accuracy in image and text alignment. Compared with the traditional ranking loss function, the clustering loss helps to make the relevant samples of a news event closer, and the word detection module helps to focus on the fine-grained alignment of images and texts at the word level.
[0187] Step 2.4) Add word detection module loss to focus on word-level alignment based on image features;
[0188] Since the ranking loss only constrains the global representation level, it is difficult to guide the direction of parameter update of ResNet-152, which has a large number of parameters. In actual experiments, it is difficult for model parameters to converge when only the ranking loss is used. In response to this, we designed a word detection module, which adds fine-grained word alignment on the basis of coarse-grained sentence alignment. The design idea of the word detection module is as follows: Fig.10 shown.
[0189] The word detection loss is used to evaluate whether an image contains high-frequency words in its title text in a news image-text pair. The attribute dictionary is set according to the dataset used in this article. The attribute dictionary consists of 1,000 high-frequency words in the text data in the multimodal dataset. Specifically, when training the model on the multimodal dataset, given an image and its corresponding title, check the words in the top1k word set. For each attribute word, a simple binary classifier is used to determine whether the image contains it. By adding a word detection module, we add 1,000 corresponding labels to each image. Compared with the original single task that only uses ranking loss, we added 1,000 strictly constrained tasks, which can effectively avoid the model from falling into the local optimal solution and better guide the parameter convergence direction of ResNet-152. The specific approach to setting the attribute dictionary is as follows.
[0190] Step 2.4.I) Use the weight matrix W to multiply the image descriptor υ to obtain the probability score s of each word in the top1k word set, which is defined as shown in Formula 2-7:
[0191] s=Wυ#(2-7)
[0192] Step 2.4.II) Calculate in advance which attributes in the attribute dictionary (i.e., high-frequency words) are contained in the title text of each news image-text pair as labels for the classification problem, and use 1000 binary classifiers to calculate the word detection loss L word , as shown in Formula 2-8:
[0193]
[0194] Among them, s i represents the probability score of the i-th word, t i ∈{0, 1} represents whether the i-th word appears in the title text.
[0195] Among them, the overall steps of training the data set are as follows:
[0196] Step 2.4.1) Use the pre-trained ResNet-152 model and fix its weights as the image feature encoder;
[0197] Step 2.4.2) Based on the overall loss function, use the BP algorithm to update the parameters of the model except ResNet-152;
[0198] Step 2.4.3) The above training was performed for 40 rounds, with an initial learning rate of 0.001, which was reduced by a factor of 10 every 20 epochs;
[0199] Step 2.4.4) The weights of ResNet-152 are no longer fixed, and the entire architecture is fine-tuned end-to-end in 50 rounds of training. The initial learning rate is 0.00001 and is decreased 10 times every 20 epochs. During the entire training process, the weight λ1 is fixed to 1 and λ2 is fixed to 0.1.
[0200] The clustering loss and word detection loss proposed in step 2.5) can be used as a supplement to the sorting loss in the prior art 1, aiming to improve the network convergence efficiency and the accuracy of image-text matching. The final overall loss function is shown in 2-9:
[0201] L=L Ranking +λ1L cluster +λ2L word #(2-9)
[0202] Step 3) Implement a cross-modal image and text search system for news events
[0203] like Fig.11 As shown in the figure, with the MSAVT model as the core of the algorithm, a cross-modal image and text search system for news events was designed and implemented using front-end and back-end programming technologies such as Vue and SpringBoot. It effectively utilized the relationship between the two different modal data of title text and illustrations in news reports, and achieved richer retrieval results than the single-modal retrieval system.
[0204] The image-text mutual search function is the core function of the system designed and implemented by the present invention, and is the main value provided by the system to users. It mainly includes two main implementation submodules: image-based text search and text-based image search. In the image-based text search function, users upload news pictures as retrieval, and the system inputs them into the trained MSAVT model for forward propagation, calculates their Euclidean coordinates in the joint embedding space, and returns the N news headline text data closest to them, thereby realizing the image-based text search function. Similarly, the implementation process of text-based image search is similar, the difference is that the input and return modes are opposite.
[0205] Key points of the present invention:
[0206] First, we independently built a multimodal news image and text dataset for model training;
[0207] Second, the pre-trained BERT model is used to improve the ability to extract text features;
[0208] Third, it is proposed to establish clustering losses that simultaneously establish intra-modal constraints and inter-modal constraints to improve the loss function.
[0209] Fourth, a word detection module is added when extracting image features to focus on the alignment of image and text at the word level.
[0210] The described embodiments are only a part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
Claims
1. A news event search method based on a multi-level image-text semantic alignment model, characterized in that: The following steps are involved: Step 1), construct a multimodal news image and text dataset; Step 1.1) News event selection; After sorting and summarizing the news events, we get the event names; Step 1.2) Acquisition of news data Using the event name obtained in step 1.1) as a search term, searching for the news report data that matches the event name, extracting the picture and title text pair of each news report as a sample data of the news event; Step 1.3) Data annotation; Preprocess the obtained data through the algorithm to complete the initial algorithm screening of the data set; Step 2), establish a multi-level visual-text semantic alignment model MSAVT for image-text matching; Step 2.1) Use a deep neural network model to extract image features and text features; Step 2.2) Mapping the extracted text features and image features to the joint embedding space of image semantics and text semantics; Step 2.3) proposes a clustering loss that simultaneously establishes intra-modal constraints and inter-modal constraints; The clustering loss in step 2.3) is: Assume that the data set has K clusters and each cluster contains N sample pairs. Given an object i in cluster k, the intra-cluster distance is calculated as formula (2-2): Among them, r ik is the vector representation of object i in cluster k, μ k is the center of the kth cluster, which is defined as shown in Explanation 2-3: The definition of variance σ is shown in formula 2-4: The distance between clusters can be calculated using formula 2-5: By minimizing the intra-cluster distance and maximizing the inter-cluster distance, we get the clustering loss defined as Formula 2-6: Step 2.4) For image features, add word detection loss to focus on word-level alignment; Step 2.5) Clustering loss and word detection loss are used as supplements to the ranking loss to obtain the final overall loss function; Step 3), realize cross-modal image and text search of news events; By searching text by image or searching image by text, cross-modal image and text search of news events can be achieved.
2. The news event search method based on the multi-level image-text semantic alignment model according to claim 1 is characterized in that: In the step 1.3) of data annotation, the specific steps of the algorithm initial screening include: Step 1.3.1) Use the pre-trained RoBERTa model to extract text features and the pre-trained ResNet50 model to extract image features; Step 1.3.2) Each event is considered as a class, and the text center and image center of the class are calculated by taking the average of the text and image features; Step 1.3.3) The 20% data closest to the center of the image feature or text feature is determined to be reliable data with high confidence, and their union is taken and retained; Step 1.3.4) The remaining data are judged by manual annotation.
3. The news event search method based on the multi-level image-text semantic alignment model according to claim 1 is characterized in that: In the step 2.4), the word detection loss is used to evaluate whether an image contains high-frequency words in its title text in a news image-text pair; an attribute dictionary is set according to the dataset used, and the attribute dictionary consists of 1000 high-frequency words of the text data in the multimodal dataset. The specific calculation steps of the word detection loss are: Step 2.4.I) Use the weight matrix W to multiply the image descriptor υ to obtain the probability score s of each word in the top1k word set, which is defined as shown in Formula 2-7: s=Wυ##(2-7) Step 2.4.II) Calculate the high-frequency words in the title text of each news picture-text pair in advance as the labels of the classification problem, and use 1000 binary classifiers to calculate the word detection loss L word , as shown in Formula 2-8: Among them, s i represents the probability score of the i-th word, t i ∈{0, 1} represents whether the i-th word appears in the title text.
4. The news event search method based on the multi-level image-text semantic alignment model according to claim 3 is characterized in that: The overall steps of training the model are as follows: Step 2.4.1) Use the pre-trained ResNet-152 model and fix its weights as the image feature encoder; Step 2.4.2) Based on the overall loss function, use the BP algorithm to update the parameters of the model except ResNet-152; Step 2.4.3) The above training was performed for 40 rounds, with an initial learning rate of 0.001, which was reduced by a factor of 10 every 20 epochs; Step 2.4.4) No longer fix the weights of ResNet-152, but fine-tune the entire architecture end-to-end in 50 rounds of training; The initial learning rate is 0.00001 and decreases 10 times every 20 epochs; during the entire training process, the weight λ1 is fixed to 1 and λ2 is fixed to 0.
1.
5. The news event search method based on the multi-level image-text semantic alignment model according to claim 1 is characterized in that: In the step 3), The above-mentioned text-by-image search is that the user uploads a news picture as a search term, and the system inputs it into the trained MSAVT model for forward propagation, calculates its Euclidean coordinates in the joint embedding space, and returns the N news headline text data closest to it, thereby realizing text-by-image search; In the text-to-image search, the user uploads the news title text as the search term, and the system inputs it into the trained MSAVT model for forward propagation, calculates its Euclidean coordinates in the joint embedding space, and returns the N news picture data closest to it, thereby realizing text-to-image search.
6. A news event search method based on a multi-level image-text semantic alignment model as described in any one of claims 1 to 5, characterized in that: The MSAVT model, a multi-level visual-text semantic alignment model for image-text matching, is used as the core of the algorithm. Front-end and back-end programming technologies are used to design and implement a cross-modal image-text search system for news events. The retrieval results are achieved by utilizing the relationship between the two different modal data, title text and accompanying pictures, in news reports.
