A cross-modal text-video retrieval method based on spatiotemporal relationship enhancement
By using multi-layer spatiotemporal Transformer module and BERT model in cross-modal text-video retrieval, the spatiotemporal relationship characteristics and text features of videos are extracted and interacted with, and the problem of inability to effectively utilize the spatiotemporal relationship in the existing technology is solved, and the further development is achieved. Cross-modal retrieval performance with high accuracy and robustness.
Patent Information
- Application Number
- CN202111312233.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-08
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2041-11-08
AI Technical Summary
Existing cross-modal text-video search technology cannot effectively utilize the complex spatial and temporal relationship between inter-frame and intra-frame objects in video, resulting in the inability to distinguish videos with the same visual components but different visual components relationships, and the inability to achieve high accuracy and high accuracy Search for universality.
The cross-modal text-video search method based on spatiotemporal relationship enhancement is adopted, and the video global and local features are extracted using the pre-trained InceptionResNetV2, I3D, and ResNet-101 models, and the spatiotemporal relationship interaction is performed through the multi-layer spatiotemporal Transformer module, combined with the BERT model to extract it. Text features, mapped to the co-embedded subspace for similarity comparison.
It improves the accuracy and robustness of cross-modal text-video search, can effectively capture advanced fine-grained relationship information in video, and is suitable for simple and complex semantic queries, significantly improving retrieval performance.
Smart Images

Figure CN114048351B_ABST
Abstract
Description
Technical Field
[0001] The present invention mainly relates to the field of artificial intelligence technology, in particular to the field of video retrieval technology, and specifically is a multimedia information retrieval method. Background Art
[0002] The cross-modal text-video retrieval algorithm aims to retrieve videos or texts related to the query content given a query text or video, and the results are sorted according to their similarity to the query.
[0003] In recent years, with the exponential growth of multimedia data (such as videos, images, and text), this phenomenon has increased the demand for more efficient and accurate cross-modal retrieval. However, due to the temporal changes between consecutive frames of a video and the dynamic relationships between objects in the video, video data is different from static images, resulting in the inability of existing video retrieval techniques to distinguish between videos with the same visual components but different relationships between them.
[0004] Existing research on cross-modal text-video retrieval technology follows a trend: measuring the similarity between text and video based on the embedding of text and video features. Generally, video features are obtained by first sampling the continuous video stream to obtain a series of video frames, and then inputting the video frames into a 2D or 3D convolutional neural network (CNN) to extract global-level video features; or the video frames are passed through a pre-trained convolutional neural network (GCN) to obtain a series of local-level regional features, and then the regional features are input into a graph convolutional network to extract features. Based on the granularity of feature representation, existing work can be roughly divided into methods based on global features and methods based on fine-grained features.
[0005] Methods based on global features, such as Figure 1 As shown in Figure 2, this method usually uses global features to represent the entire video and query sentence respectively, but ignores the local details in the video and text. For simple scenes with only one or a few objects in the video and no complex interactions between objects, this method performs well. However, when it comes to complex and more realistic scenes, the performance of these methods is usually unsatisfactory.
[0006] The fine-grained feature-based methods focus on the local details of the video or text and perform semantic alignment of the text and video modalities by detecting objects in the video and text, such as Figure 2As shown in the figure: By modeling the interaction between fine-grained text and video modalities, the performance of cross-modal text-video retrieval has been significantly improved, but existing research only captures simple video object relationships through graph convolutional neural networks or uses the attention mechanism as a cross-modal interaction module to achieve semantic alignment between different modalities. Since the video object relationship modeling based on graph convolutional neural networks is manually handcrafted and heavily relies on expert knowledge and experience, this method may not be able to effectively mine and model higher-level fine-grained visual relationships. At the same time, for the interaction model based on the attention mechanism, although it can selectively align the key information in the video and text, it ignores the fine-grained relationship information in the video.
[0007] The above video features do not fully utilize the complex spatiotemporal relationships between different frames of the video and between objects in different regions within the frame, resulting in their inability to distinguish videos with the same visual components but different relationships between them. Summary of the invention
[0008] In the prior art, for cross-modal text-video retrieval tasks, most methods are based on extracting single video (text) features using different neural networks and performing similarity comparison to obtain the video or text with the highest similarity to the query conditions; however, whether it is a method based on extracting global video features or a method based on extracting fine-grained local features from objects in different frames of the video for feature alignment, these methods do not fully utilize the spatial and temporal relationships between objects in the video, and thus cannot achieve a highly accurate and universal cross-modal text-video retrieval method.
[0009] The present invention mainly provides a cross-modal text-video retrieval method based on spatiotemporal relationship enhancement, which is used to solve the problem that the cross-modal text-video retrieval method proposed in the above-mentioned prior art cannot achieve high accuracy and high universality.
[0010] The technical solution adopted by the present invention to solve the above technical problems is:
[0011] A cross-modal text-video retrieval method based on spatiotemporal relationship enhancement, wherein the cross-modal text-video retrieval method comprises the following steps: (1) in terms of video, using the InceptionResNetV2 model, I3D model, and ResNet-101 model pre-trained on a large-scale dataset to extract video global features and video local object features respectively, mapping the two features to the same dimension through affine transformation, and then inputting them into a multi-layer spatiotemporal Transformer module for further spatiotemporal relationship interaction to obtain video features after spatiotemporal relationship enhancement;
[0012] (2) For text, the query sentence is first decomposed into a word sequence consisting of individual words using a word segmenter, and then the word sequence is input into the WordPiece model to obtain preliminary word embedding vector features, which are then input into the pre-trained BERT model to obtain text features containing sentence context information;
[0013] (3) Finally, the two features of the video modality and the features of the text modality are mapped to two common embedding subspaces for similarity comparison. If the text and video are related, the similarity is high, otherwise the similarity is low, so as to retrieve related videos.
[0014] Compared with the prior art, the present invention has the following beneficial effects:
[0015] The fine-grained spatiotemporal relationship features in the video are learned through a multi-layer spatiotemporal Transformer module to learn the spatiotemporal relationship between local objects in the video, capturing more advanced fine-grained relationship information.
[0016] The present invention utilizes the global visual information and fine-grained relational information in the video to greatly improve the accuracy of the cross-modal text-video retrieval task. The present invention is not only applicable to query conditions with simple semantics, but can also achieve accurate retrieval for queries containing more complex semantics, thereby enhancing the robustness of video retrieval tasks with complex relationships, thereby improving the cross-modal text-video retrieval performance as a whole.
[0017] The present invention will be explained in detail below with reference to the accompanying drawings and specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 It is a flowchart of a method based on global features in the prior art;
[0019] Figure 2 It is a flow chart of a method based on fine-grained features in the prior art;
[0020] Figure 3 It is a schematic diagram of the method flow of the present invention; DETAILED DESCRIPTION
[0021] In order to enable those skilled in the art to better understand the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0022] The present invention mainly provides a cross-modal text-video retrieval method based on spatiotemporal relationship enhancement. This method performs fine-grained spatiotemporal modeling on the relationship between objects within and between frames in a video, capturing higher-level spatiotemporal relationship features; at the same time, the spatiotemporal relationship features of the video and the global features of the video are respectively mapped to the common embedding space as relational embedding learning and video embedding learning, and the similarity is compared with the text embedding learning. The combination of the two can greatly improve the accuracy of text-video retrieval and the robustness of complex object relationship video retrieval.
[0023] The present invention includes a visual spatiotemporal relationship enhancement model, which processes video features through a spatiotemporal Transformer model for efficient text-video retrieval; the Transformer consists of three parts: a multi-head self-attention (MSA) submodule, a multi-layer perceptron (MLP) submodule and a layer normalization (LN) submodule; the above model greatly enhances the expression ability of video features by interactively modeling the spatiotemporal relationship between different objects in the video.
[0024] Transformer first linearly transforms the input feature X (matrix dimension n×d) into three different parts: query Q, key K, value V, and then applies the dot product attention mechanism on Q, K, V. The specific expression is: Q = W Q X, K = W K X, V = W V X;
[0025] MSA(Q,K,V)=Concat(head1,…,head M )W O ,
[0026] Among them, W Q , W K , W V It is the parameter to be trained in the model, and Concat() is the feature cascade operation.
[0027] The MLP layer is connected after the multi-head self-attention submodule for feature change and nonlinear processing. The specific expression is: MLP(X)=GELU(XW1+b1)W2+b2;
[0028] Among them, GELU is an activation function, and W1, W2, b1, and b2 are the parameters to be trained in the model.
[0029] The LN layer is used in Transformer for stable training and faster convergence, and is also a key part of Transformer. The specific expression is:
[0030] Where μ and η are the mean and standard deviation of the input feature x, ⊙ is the matrix multiplication, and γ and β are the training parameters.
[0031] like Figure 3 As shown, in the video processing aspect of the present invention, spatiotemporal modeling is performed on the global features and local features of the video respectively, and the cross-modal text-video retrieval method comprises the following main steps: (1) in the video aspect, the InceptionResNetV2 model, I3D model, and ResNet-101 model pre-trained on a large-scale data set are used to extract the global features of the video and the local object features of the video respectively, and after mapping the two features to the same dimension through affine transformation, they are input into a multi-layer spatiotemporal Transformer module for further spatiotemporal relationship interaction, so as to obtain the video features after the spatiotemporal relationship is enhanced;
[0032] (2) For text, the query sentence is first decomposed into a word sequence consisting of individual words using a word segmenter, and then the word sequence is input into the WordPiece model to obtain preliminary word embedding vector features, which are then input into the pre-trained BERT model to obtain text features containing sentence context information;
[0033] (3) Finally, the two features of the video modality and the features of the text modality are mapped to two common embedding subspaces for similarity comparison. If the text and video are related, the similarity is high, otherwise the similarity is low, so as to retrieve related videos.
[0034] In the embodiment of the present invention, let O and q represent a video dataset and a query statement respectively, and the query statement includes a description of the video content to be queried. The goal of text-video retrieval is to find the video o that is most relevant to the query statement q from the video dataset O. The cross-modal text-video retrieval method mainly includes the following workflow:
[0035] (1) Video embedding vector learning: For a video o, first sample it to obtain a long sequence of T video frames, use a pre-trained 2D convolutional neural network to extract appearance features, and use a pre-trained 3D convolutional neural network to obtain its motion features; then merge these two features to obtain the final global video feature Fg; then input the global video feature Fg into a standard multi-layer Transformer module to perform temporal interaction between video frame features along the time dimension of the feature, and finally obtain the global video feature Fg with enhanced spatiotemporal relationship.
[0036] (2) Object relationship embedding vector learning: For a long sequence of T video frames, a pre-trained FasterRCNN model is used to detect the object region in each frame. For each video frame, N object regions are extracted. where y t is the feature of the tth local object area, and then Y t Input into the spatiotemporal Transformer, and interact and fuse the features along the time dimension and space dimension respectively; the specific expression is as follows:
[0037]
[0038] Where l = 1, 2, …, L represents the total number of layers of the spatiotemporal Transformer, and finally the fine-grained video relationship feature Fr is obtained.
[0039] (3) Text embedding vector learning: For the query text part, the BERT model pre-trained on a large-scale dataset is used to encode the query sentence. The model can learn the contextual relationship between each word in the query sentence. BERT includes a 12-layer Transformer module. The query sentence is input into BERT, and the global text feature Ft is finally obtained.
[0040] (4) Joint embedding vector learning: After extracting the features of the two modalities of video and text, the ultimate goal is to compare the similarity between the two modalities, so that the video features and text features with similar semantic content are close in distance in the joint embedding space (high similarity), while the two features with different semantic content are far apart (low similarity). In order to achieve the above effect, a sorting-based ternary loss function is used to train the video features Fg, Fr and the text features Ft. The specific expression of the sorting-based ternary loss function is:
[0041] Among them, δ is the spacing parameter set in advance, S(V i ,T i ) indicates video V i and text T iThe similarity between them is expressed as:
[0042] S(V i ,T i )=λ·cosine(F r ,F t )+(1-λ)·cosine(F g ,F t );
[0043] Among them, λ is a weight factor set in advance, Fr, Fg, Ft represent fine-grained video relationship features, global video features, and global text features, respectively, and cosine(,) is the cosine similarity calculation. The specific expression is:
[0044] In the actual testing phase of the present invention, the model of the present invention is used to calculate the feature vectors of the video and text to be queried in the joint embedding space, respectively. According to the feature vector, the corresponding features of another modality with similar semantics can be retrieved.
[0045] 1. Experimental Setup
[0046] Experimental tests were conducted on two benchmark datasets: MSR-VTT and MSVD, to evaluate the performance of the model proposed in this paper.
[0047] The MSR-VTT dataset contains 10,000 video clips, each of which is matched with 20 different description texts. It is tested on two different splits: 1) the training set of the 7K Data Split contains 7,010 video clips and the test set contains 1,000 video clips; 2) the training set of the 9k Data Split contains 9,000 video clips and the test set contains 1,000 video clips.
[0048] The MSVD dataset contains 1970 Youtube video clips, each of which has about 40 description sentences corresponding to it. In this experiment, a commonly used segmentation method is used, 1200 video clips are used for training, 100 video clips are used for verification, and 670 videos are used for testing.
[0049] 2. Evaluation indicators
[0050] The experiment used the median rank (MedR) and the recall rate at topK (R@K) as evaluation indicators of the model retrieval accuracy. The median rank measures the median of the ranking of positive samples in the samples returned by the retrieval. The lower the value, the higher the accuracy of the model. The topK recall rate measures the proportion of positive samples in the top K samples in the samples returned by the retrieval. The higher the value, the higher the accuracy of the model.
[0051] 3. Experimental results
[0052] Table 1 Comparison of results on the MSR-VTT dataset
[0053]
[0054] Table 2 Comparison of results on the MSVD dataset
[0055]
[0056]
[0057] As shown in Table 1-2 above, the model of the present invention has superior retrieval performance than most methods on both data sets, which shows that the model of the present invention can enhance the global feature expression of the video by utilizing the fine-grained spatiotemporal relationship features in the video.
[0058] The model first proposed to learn the spatiotemporal relationship between local objects in the video through a multi-layer spatiotemporal Transformer module based on the fine-grained spatiotemporal relationship features in the video, thus capturing more advanced fine-grained relationship information.
[0059] The present invention utilizes the global visual information and fine-grained relational information in the video to greatly improve the accuracy of the cross-modal text-video retrieval task. The present invention is not only applicable to query conditions with simple semantics, but can also achieve accurate retrieval for queries containing more complex semantics, thereby enhancing the robustness of video retrieval tasks with complex relationships, thereby improving the cross-modal text-video retrieval performance as a whole.
[0060] Finally, it should be noted that the above examples are only used to illustrate the present invention and are not intended to limit the technical solutions described in the present invention. Therefore, although this specification has described the present invention in detail with reference to the above examples, a person skilled in the art should understand that the present invention can still be modified or replaced by equivalents. All technical solutions and improvements that do not depart from the spirit and scope of the invention should be included in the scope of the claims of the present invention.
Claims
1. A cross-modal text-video retrieval method based on spatiotemporal relationship enhancement, characterized in that: The cross-modal text-video retrieval method comprises the following steps: (1) in terms of video, using the InceptionResNetV2 model, I3D model, and ResNet-101 model pre-trained on a large-scale dataset to extract video global features and video local object features respectively, mapping the two features to the same dimension through affine transformation, and then inputting them into a multi-layer spatiotemporal Transformer module for further spatiotemporal relationship interaction to obtain video features with enhanced spatiotemporal relationship; (2) For text, the query sentence is first decomposed into a word sequence consisting of individual words using a word segmenter, and then the word sequence is input into the WordPiece model to obtain preliminary word embedding vector features, which are then input into the pre-trained BERT model to obtain text features containing sentence context information; (3) Finally, the two features of the video modality and the features of the text modality are mapped to two common embedding subspaces for similarity comparison. If the text and video are related, the similarity is high, and vice versa, the similarity is low, so as to retrieve related videos; The cross-modal text-video retrieval method further includes the following specific steps: (1) Video embedding vector learning: For a video o, first sample it to obtain a long sequence of T video frames, use a pre-trained 2D convolutional neural network to extract appearance features, and use a pre-trained 3D convolutional neural network to obtain its motion features; then merge these two features to obtain the final global video feature Fg; then input the global video feature Fg into a standard multi-layer Transformer module to perform temporal interaction between video frame features along the time dimension of the feature, and finally obtain the global video feature Fg with enhanced spatiotemporal relationship; (2) Object relationship embedding vector learning: For a long sequence of T video frames, a pre-trained Faster RCNN model is used to detect the object region in each frame. For each video frame, N object regions are extracted. where y t is the feature of the tth local object area, and then Y t Input into the spatiotemporal Transformer, and interact and fuse the features along the time dimension and space dimension respectively; the specific expression is as follows: Where l = 1, 2, ..., L represents the total number of layers of the spatiotemporal Transformer, and finally the fine-grained video relationship feature Fr is obtained; (3) Text embedding vector learning: For the query text part, the BERT model pre-trained on a large-scale dataset is used to encode the query sentence. The model can learn the contextual relationship between each word in the query sentence. BERT includes a 12-layer Transformer module. The query sentence is input into BERT to finally obtain the global text feature Ft. (4) Joint embedding vector learning: After extracting the features of the two modalities of video and text, a sorting-based ternary loss function is used to train the video features Fg, Fr and the text features Ft. The expression of the sorting-based ternary loss function is as follows: S(V i , T i ) indicates video V i and text T i The similarity between them is expressed as: S(V i , T i )=λ·cosine(F r , F t )+(1-λ)·cosine(F g , F t ); cosine(,) is the cosine similarity calculation, the expression is:
2. The cross-modal text-video retrieval method according to claim 1, characterized in that: The spatiotemporal Transformer includes a multi-head self-attention submodule, a multi-layer perceptron submodule, and a layer normalization submodule. The spatiotemporal Transformer also includes: linearly transforming the input feature X into three different parts: query Q, key K, value V, and then applying a dot product attention mechanism on Q, K, and V. The specific expression is: Q=W Q X,K=W K X,V=W V X; A multi-layer perceptron submodule is connected after the multi-head self-attention submodule for feature change and nonlinear processing. The specific expression is: MLP(X)=GELU(XW1+b1)W2+b2; The LN layer is used in Transformer to stabilize training and converge faster. The specific expression is:
