Training method and device of video time sequence positioning model
Through the video temporal positioning model based on dual-branch contrastive learning, the training set is screened and the similarity matrix is generated, which solves the problem of over-reliance on text modality in the existing technology and improves the stability of the model and the ability to understand video content.
Patent Information
- Application Number
- CN202410690340.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-30
- Publication Date
- 2024-08-23
AI Technical Summary
The potential correlation between text and annotation time in the existing video temporal positioning model in the data set leads to over-reliance on text modality, which reduces the model's ability to understand video content and its stability.
By screening the training set according to the two-dimensional distribution probability density of sample labeling time, a video temporal positioning model based on dual-branch contrastive learning is established, word segmentation and encoding text features are performed, video features are resampled, a similarity matrix is generated, and the model is optimized through contrastive loss. Avoid over-reliance on a single modality.
It improves the stability of the video timing positioning model and the ability to understand video content, and can effectively detect the performance of the model without relying on text priors.
Smart Images

Figure CN118537778A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer science and technology, and in particular to a training method and device for a video temporal positioning model. Background Art
[0002] Dynamic multimedia represented by video, combined with audio and video, is the king of Internet traffic at present and in the future. Video users, including short videos, account for about 20% of user time and the vast majority of traffic. At the same time, the scale of online video users is also increasing year by year. The access rate of the Internet is increasing day by day. As the way closest to human daily perception, video can convey more information per unit time than individual pictures, audio and text, thus having a wider user stickiness. With the update and iteration of Internet infrastructure, network speed is gradually increasing while costs are gradually decreasing. Video has become the mainstream form of Internet media. The existing video data capacity is huge and is still growing at a very fast speed. These video data can generate very huge value, but in order to mine the value of these video data, a huge technical barrier is to let computers understand the video content. Video understanding is an important task in the field of computer science, especially in the field of computer vision. The goal of understanding video is to match the continuous 2D pixel frame images corresponding to the video with its semantic content description. Video temporal localization is a common simplified way of understanding videos. Its goal is to retrieve a specific video segment corresponding to a given text from a long video. It is a typical video understanding task and one of the basic tasks in multimedia intelligence research. It has great value in various application scenarios of video data, such as video retrieval, video summarization, behavior analysis, event detection, etc.
[0003] In recent years, deep learning methods have made significant progress in video temporal localization tasks. Researchers use various deep neural network structures to extract video features and model video temporal information, such as convolutional neural networks (CNN), recurrent neural networks (RNN), long short-term memory networks (LSTM), attention mechanisms, etc. These methods have achieved good results in temporal localization tasks, especially in the processing of long-term dependencies and complex temporal relationships. Videos contain multimodal information such as vision and speech. Researchers are committed to effectively integrating this information to improve the accuracy of temporal localization. Some studies use multimodal neural network structures or attention mechanisms to fuse information from different modalities to better understand video content and temporal relationships.
[0004] However, existing technologies lack constraints on models in the process of information fusion of video and text modalities. Due to the high redundancy of video information, large data volume and difficulty in modeling, the information density of text modality is relatively higher. In addition, due to the existence of a large number of pre-trained models, computers have a stronger ability to understand text modality information. This leads to an unconstrained video timing positioning model that is overly dependent on text modality information, and it is easy to establish a decision shortcut from text modality to positioning time, which reduces the stability of the model.
[0005] In addition, existing video temporal localization models usually adopt supervised training methods, and their performance optimization is heavily dependent on the quality of training data. The potential correlation between text and annotation time in the current dataset exacerbates the model's reliance on text modality. This results in the test dataset implicitly prompting the model to make simple decisions based on text, which cannot accurately evaluate the model's ability to understand video content. Summary of the invention
[0006] In view of the defects existing in the prior art, the purpose of the present invention is to provide a training method and device for a video timing localization model, which can solve the problem in the prior art that the potential correlation between text and annotation time in the current data set aggravates the model's dependence on text modality and cannot accurately evaluate the model's ability to understand video content.
[0007] In order to achieve the above purpose, the technical solution adopted by the present invention is:
[0008] On the one hand, the present invention provides a method for training a video temporal positioning model, comprising:
[0009] According to the two-dimensional distribution probability density of the annotation time of each sample, a training set is selected from the sample set;
[0010] Establish a video temporal localization model based on dual-branch contrastive learning;
[0011] The video temporal positioning model performs word segmentation and encoding on the text of the samples in the training set to obtain a text feature vector, and resamples the video to obtain a video feature vector including multiple clip elements of set time length;
[0012] Generate a time series matrix based on the video feature vector, predict the similarity between each video clip and the text in the time series matrix, and obtain a similarity matrix;
[0013] The contrast loss between the video clip and the text is calculated based on the similarity matrix, and the video timing positioning model is optimized until the set round of video timing positioning model training optimization is completed.
[0014] In some optional solutions, the step of selecting a training set from a sample set according to the two-dimensional distribution probability density of the annotation time of each sample includes:
[0015] The kernel density estimation method is used to estimate the probability density of the sample in the overall distribution;
[0016] The samples whose probability density in the overall distribution is greater than the set probability density threshold are selected as training sets.
[0017] In some alternative schemes, the kernel density estimation function Determine the probability density of the ith sample in the overall distribution Among them, K is the Gaussian kernel function, n is the number of labeled samples in the entire video temporal positioning dataset, (t start ,t end ) is the start time and end time of the text annotated by the target sample in the video. is the start time and end time corresponding to the text annotated in the video of the i-th sample in the dataset.
[0018] In some optional solutions, the video temporal localization model performs word segmentation and encoding on the text of the samples in the training set to obtain a text feature vector, including:
[0019] The video temporal localization model performs word segmentation on the text of the samples in the training set to obtain the Token sequence T = {t1, t2, ..., t L}, L is the number of elements in sequence T;
[0020] Use the pre-trained vector dictionary M to transform each Token sequence element t i Mapped into an n-dimensional vector, we get the initialized Token vector sequence Among them, Pos(i) is the position information encoded by the position encoding function, M(t i ) is an n-dimensional vector mapped from discrete text tokens using a vector dictionary, corresponding to the semantic information of a single token;
[0021] The initialized Token vector sequence is encoded using the pre-trained text model Distill-BERT based on the self-attention mechanism, and the encoded result is pooled to obtain a text feature vector F corresponding to the entire text. text .
[0022] In some optional solutions, the video is resampled to obtain a video feature vector including multiple segment elements of set time length, including:
[0023] Use the pre-trained convolutional neural network to preliminarily extract the frame sequence features of the video;
[0024] The frame sequence features are sampled at set time intervals to obtain a regular video feature vector. t is the total number of segments obtained by sampling the input video according to the set duration.
[0025] In some optional solutions, a time matrix is generated according to the video feature vector, including:
[0026] The video feature vector is encoded twice using a self-attention encoder to obtain a starting feature sequence and an ending feature sequence;
[0027] Each starting feature is connected with each ending feature to obtain the video clip prediction feature and form a time series matrix.
[0028] In some optional solutions, the similarity between each video clip and the text in the time series matrix is predicted to obtain a similarity matrix, including:
[0029] The cosine similarity between the video segment prediction feature and the text feature vector of the input query text is used as its prediction confidence;
[0030] The confidence is calculated for each valid vector in the time series matrix to obtain a similarity matrix.
[0031] In some optional schemes, the contrast loss between the video clip and the text is calculated based on the similarity matrix, and the video temporal localization model is optimized using a back propagation algorithm.
[0032] In some optional solutions, according to the formula L = L bce +λL nce Calculate the loss L, where L bce is the binary classification loss, L nce For NCE losses.
[0033] On the other hand, the present invention provides a training device for a video temporal positioning model, comprising:
[0034] A screening module is used to screen out a training set from a sample set according to the two-dimensional distribution probability density of the annotation time of each sample;
[0035] A model building module, which is used to build a video temporal localization model based on dual-branch contrast learning;
[0036] A training data processing module is used to segment and encode the text of the samples in the training set using the video temporal positioning model to obtain a text feature vector, and resample the video to obtain a video feature vector including multiple set time length segment elements;
[0037] A similarity prediction module is used to generate a time series matrix according to the video feature vector, and predict the similarity between each video clip and the text in the time series matrix to obtain a similarity matrix;
[0038] The training module is used to calculate the contrast loss between the video clip and the text according to the similarity matrix, and optimize the video timing positioning model until the set round of video timing positioning model training optimization is completed.
[0039] Compared with the prior art, the advantages of the present invention are: the scheme selects a training set from a sample set according to the two-dimensional distribution probability density of the annotation time of each sample; establishes a video timing positioning model based on dual-branch contrast learning; the video timing positioning model performs word segmentation and encoding on the text of the sample in the training set to obtain a text feature vector, resamples the video, and obtains a video feature vector including multiple set time length segment elements; generates a timing matrix according to the video feature vector, predicts the similarity between each video segment and the text in the timing matrix, and obtains a similarity matrix; calculates the contrast loss between the video segment and the text according to the similarity matrix, and optimizes the video timing positioning model until the set round of video timing positioning model training optimization is completed. By isolating the processing branches of the video and the text, the system avoids excessive dependence on a single input, and improves the stability of the video timing positioning model. In addition, the data is reorganized according to the annotated distribution characteristics of the data set, the training set is selected, and a new independent distribution test set is divided, which can effectively detect the performance of the model without relying on text priors. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0041] Figure 1 is a flow chart of a training method for a video temporal positioning model in an embodiment of the present invention;
[0042] Figure 2 This is a text encoding branch flow chart in an embodiment of the present invention;
[0043] Figure 3 The present invention is a flowchart of generating a branch timing matrix for video encoding in an embodiment of the present invention. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are 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 this field without making creative work are within the scope of protection of this application.
[0045] The embodiments of the present invention are further described in detail below with reference to the accompanying drawings.
[0046] like Figure 1 As shown, on the one hand, the present invention provides a training method for a video temporal positioning model, comprising the following steps:
[0047] S1: Filter out the training set from the sample set according to the two-dimensional distribution probability density of the annotation time of each sample.
[0048] Analyze the distribution of the dataset and re-divide the dataset into a training set and an independent distribution test set. For a given dataset D, according to the similarity threshold t sim Divide the data set.
[0049] In some optional embodiments, step S1 includes:
[0050] S11: Use kernel density estimation method to estimate the probability density of the sample in the overall distribution.
[0051] S12: Filter out samples whose probability density in the overall distribution is greater than a set probability density threshold as a training set.
[0052] Specifically, for all samples in the data set, the kernel density estimation method is used to estimate the overall probability density distribution. According to the kernel density estimation function Determine the probability density of the ith sample in the overall distribution Among them, K is the Gaussian kernel function, n is the number of labeled samples in the entire video temporal positioning dataset, (t start ,t end ) is the start time and end time of the text annotated by the target sample in the video. is the start time and end time of the text annotated in the video of the i-th sample in the dataset. For each sample, calculate its probability density in the overall distribution and add it at the threshold t sim For a specific sample i, if Then divide it into the training set D train , otherwise add it to the independent distribution test set D test-ood After all samples are processed, the data set reorganization process ends.
[0053] For all samples in the video temporal positioning dataset, each video-text pair is annotated with the start and end time of the content in the corresponding video. Define T as the text in the sample, V as the video, and the start time of the text corresponding to the video segment as t start , the end time is t end .
[0054] S2: Establish a video temporal localization model based on dual-branch contrastive learning.
[0055] In order to avoid a single modality having too great an impact on the prediction results, the encoding processes of the text and video modalities in the present invention are completely isolated, and no additional interaction is performed before the final decision. Based on this, a video temporal localization model based on dual-branch contrastive learning is established.
[0056] S3: The video temporal positioning model performs word segmentation and encoding on the text of the samples in the training set to obtain a text feature vector, and resamples the video to obtain a video feature vector including multiple segment elements of set time length.
[0057] like Figure 2 As shown in the figure, for the input text T, word segmentation and vector mapping are first performed. The video temporal positioning model performs word segmentation and encoding on the text of the samples in the training set to obtain the text feature vector, including:
[0058] A1: The video temporal localization model performs word segmentation on the text of the samples in the training set to obtain a Token sequence T = {t1, t2, …, t L}, L is the number of elements in sequence T, t i is the i-th participle.
[0059] B1: Use the pre-trained vector dictionary M to transform each Token sequence element t i Mapped into an n-dimensional vector, we get the initialized Token vector sequence Where Pos(i) is the position information encoded by the position encoding function, M(t i ) is an n-dimensional vector mapped from discrete text Tokens using a vector dictionary, corresponding to the semantic information of a single Token. This vector is combined with the position feature to initialize the features of a single Token in the entire sequence.
[0060] C1: Encode the initialized Token vector sequence using the pre-trained text model Distill-BERT based on the self-attention mechanism, and perform maximum pooling on the encoded result to convert it into a text feature vector F corresponding to the entire text text .
[0061] For video input, only the visual content of the video, i.e. all frame images, is considered in this example.
[0062] like Figure 3 As shown, the video is resampled to obtain a video feature vector including multiple set time length segment elements, including:
[0063] A2: Use a pre-trained convolutional neural network to perform preliminary extraction of video frame sequence features.
[0064] B2: Sample the frame sequence features at set time intervals to obtain a regular video feature vector t is the total number of clips obtained by sampling the input video according to the set duration, This is the first video clip.
[0065] In this example, the duration is set to 1 second, and each feature vector element corresponds to a 1-second segment in the original video.
[0066] Based on the above steps, the encoding processes of the two modalities of data, text and video, are completely isolated.
[0067] S4: Generate a two-dimensional time series matrix according to the video feature vector, calculate the similarity between each video clip and the text in the time series matrix for prediction, and obtain a similarity matrix.
[0068] Among them, a two-dimensional time series matrix is generated according to the video feature vector, including:
[0069] A3: Use the self-attention encoder to encode the video feature vector twice to obtain the starting feature sequence and end feature sequence
[0070] Specifically, given a video feature sequence First, position coding is used to embed timing information to obtain the video timing sequence Among them, Pos video (i) is the position information of the i-th video segment encoded by the position encoding function, is the i-th video clip. Then, the stacked self-attention module is used to perform start-end dual-branch encoding on the video features, respectively encoding the feature vector with a certain clip as the starting node / end node. The two branches have the same structure but independent parameters. The encoding results of the two branches are recorded as the starting feature sequence and end feature sequence The target timing matrix M is a t×t matrix.
[0071] B3: For each starting feature, connect it with each ending feature to obtain the video segment prediction feature to form a time series matrix
[0072] For each starting feature With each ending feature Connect and get the video clip prediction features is the i-th starting feature, is the jth ending feature, and fills in the position with coordinates (i, j) in the timing matrix. This forms the timing matrix Each vector in the lower triangular part of the timing matrix corresponds to a possible timing prediction.
[0073] Each vector in the lower triangular part of the timing matrix corresponds to a possible timing prediction.
[0074] In some optional embodiments, the similarity between each video clip and the text in the time sequence matrix is predicted to obtain a similarity matrix, including:
[0075] A4: Use the cosine similarity between the video segment prediction feature and the text feature vector of the input query text as its prediction confidence.
[0076] Specifically, the prediction confidence is calculated for each video segment prediction feature vector in the time series matrix. The cosine similarity between the video segment prediction feature and the text feature vector of the input query text is used as its prediction confidence
[0077] B4: Calculate the confidence of each valid vector in the time series matrix to obtain the similarity matrix.
[0078] Specifically, the confidence of each valid vector in the time series matrix is calculated separately to obtain the prediction matrix S = {s i,j ; i, j∈[1,t]}, where (j≥i), F text is a text feature vector F corresponding to the entire text text .
[0079] S5: Calculate the contrast loss between the video clip and the text according to the similarity matrix, and optimize the video timing positioning model until the set round of video timing positioning model training optimization is completed.
[0080] In some optional embodiments, the contrast loss between the video clip and the text is calculated based on the similarity matrix, and the video timing positioning model is optimized until a set round of video timing positioning model training optimization is completed.
[0081] Initialize the training round \(m = 0\), the target training round is \(e\). If the completed training round \(m < e\), for each set of data in the training set, the contrast loss needs to be calculated according to the similarity matrix, and then the backpropagation algorithm is used to optimize the model. After the training is completed, the completed training round \(m\) is incremented by 1. Otherwise, the matching degree between the predicted time and the annotated time for all the data in the test set needs to be calculated as the data for measuring the model performance.
[0082] In this example, the contrast loss between the video clip and the text is calculated according to the similarity matrix, and the backpropagation algorithm is used to optimize the video temporal localization model.
[0083] According to the formula \(L = L\) bce +\(\lambda L\) nce Calculate the loss \(L\), where \(L\) bce is the binary classification loss, \(L\) nce is the NCE loss, and \(\lambda\) is the hyperparameter used to balance the relative numerical sizes of the two loss functions.
[0084] Specifically, initialize the training round \(m = 0\), and the target training round is \(e = 50\).
[0085] If \(m < e\), then perform one round of training. The training process is as follows. For each input, the input is processed according to steps S3 and S4 to obtain the text feature vector \(F\) text and the temporal matrix \(M\), and the similarity prediction matrix \(S=\{s\) i,j ; \(i,j\in[1,t]\}\), and then the loss function is calculated according to the above results. The calculation method of the loss function is:
[0086] \(L = L\) bce +\(\lambda L\) nce
[0087] The loss function consists of two parts, namely the binary classification loss for supervising the prediction result and the NCE loss for supervising the alignment effect of the video and text branches. Among them
[0088] where \(i\) is the starting feature serial number, \(j\) is the ending feature serial number, \(N\) i is the set of all possible predictions for the segment with the starting segment serial number \(i\), \(y\) i,j is the supervision signal corresponding to the video segment with the starting and ending segments being \(i\) and \(j\) respectively, and its specific calculation method is as follows:
[0089] To improve the accuracy of the model, in the present invention, \(y\) i,j , a supervision target obtained by scaling based on the IoU value \(o\) i,j between the predicted segment and the target time is used to evaluate the accuracy of the model prediction. The scaling parameter \(t\) min \(= 0.5\), \(t\)max =1.
[0090]
[0091] In addition, the contrast loss is calculated as follows:
[0092]
[0093] Sim(Q,V)=exp(f Q ·f V ),
[0094]
[0095] Among them, i is the serial number of the sample in the data set, k is the total number of samples in the training set, is the contrast loss related to the text features in the i-th sample, is the contrast loss related to the video features in the i-th sample, Sim represents the cosine similarity of the two parameters, Q represents the input query text, and f Q is the text feature, corresponding to the previous F text , V is a video clip (i, j), f V is the feature of the video clip, corresponding to the previous exp represents an exponential function with a natural constant as the base, V i is the video clip corresponding to Q in sample i, is a set of negative samples consisting of text features different from the query text Q in the dataset. It is a set of negative samples consisting of video clip features in the dataset that are inconsistent with the target video clips.
[0096] The obtained loss function uses the Adam optimization algorithm to update and optimize the parameters of the model. After traversing all samples in the training set, one round of training is completed, m+1, and step S5 is repeated.
[0097] If m≥e, then test and calculate the similarity matrix S={s i,j ; i, j ∈ [1, t]}, and then select the s with the highest prediction confidence i,j The corresponding time (i, j) is used as the prediction result for the current sample, and the IoU value between the prediction result and the marked segment start and end time is calculated. i,j. Based on the IoU results between the predicted results of all samples and the actual time, the predicted accuracy recall rate is calculated as follows: select a threshold μ, calculate the proportion of all IoU values greater than the threshold μ, and obtain the recall rate with the threshold μ. In this embodiment, μ can be selected as 0.5 and 0.7. Since the text prior obtained by the model in the training set is invalid, the test conducted on the independent distribution test set can effectively reflect the performance of the model without relying on the prior of a single modality.
[0098] In a second aspect, the present invention also provides a method for training a video temporal positioning model, comprising: a screening module, a model building module, a training data processing module, a similarity prediction module and a training module.
[0099] Among them, the screening module is used to filter out the training set from the sample set according to the two-dimensional distribution probability density of the annotation time of each sample; the model building module is used to establish a video timing positioning model based on dual-branch contrastive learning; the training data processing module is used to use the video timing positioning model to segment and encode the text of the samples in the training set to obtain a text feature vector, resample the video, and obtain a video feature vector including multiple set time length segment elements; the similarity prediction module is used to generate a timing matrix according to the video feature vector, predict the similarity between each video segment and the text in the timing matrix, and obtain a similarity matrix; the training module is used to calculate the contrast loss between the video segment and the text according to the similarity matrix, and optimize the video timing positioning model until the set round of video timing positioning model training optimization is completed.
[0100] In summary, this scheme selects the training set from the sample set according to the two-dimensional distribution probability density of the annotation time of each sample; establishes a video temporal localization model based on dual-branch contrastive learning; the video temporal localization model performs word segmentation and encoding on the text of the samples in the training set to obtain a text feature vector, resamples the video, and obtains a video feature vector including multiple set time length segment elements; generates a temporal matrix according to the video feature vector, predicts the similarity between each video segment and the text in the temporal matrix, and obtains a similarity matrix; calculates the contrast loss between the video segment and the text according to the similarity matrix, and optimizes the video temporal localization model until the set round of video temporal localization model training optimization is completed. By isolating the processing branches of video and text, the system avoids excessive dependence on a single input and improves the stability of the video temporal localization model. In addition, the data is reorganized according to the annotated distribution characteristics of the data set, the training set is selected, and a new independent distribution test set is divided, which can effectively detect the performance of the model without relying on text priors.
[0101] In the description of the present application, it should be noted that the terms "upper", "lower", etc. indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present application. Unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be an indirect connection through an intermediate medium, or it can be a connection between the two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present application can be understood according to the specific circumstances.
[0102] It should be noted that, in this application, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0103] The above description is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest range consistent with the principles and novel features applied for herein.
Claims
1. A training method for a video temporal positioning model, characterized in that: include: According to the two-dimensional distribution probability density of the annotation time of each sample, a training set is selected from the sample set; Establish a video temporal localization model based on dual-branch contrastive learning; The video temporal positioning model performs word segmentation and encoding on the text of the samples in the training set to obtain a text feature vector, and resamples the video to obtain a video feature vector including multiple clip elements of set time length; Generate a time series matrix based on the video feature vector, predict the similarity between each video clip and the text in the time series matrix, and obtain a similarity matrix; The contrast loss between the video clip and the text is calculated based on the similarity matrix, and the video timing positioning model is optimized until the set round of video timing positioning model training optimization is completed.
2. The video temporal positioning model training method according to claim 1, characterized in that: The method of selecting a training set from a sample set according to the two-dimensional distribution probability density of the annotation time of each sample includes: The kernel density estimation method is used to estimate the probability density of the sample in the overall distribution; The samples whose probability density in the overall distribution is greater than the set probability density threshold are selected as training sets.
3. The training method of the video temporal positioning model as claimed in claim 2, characterized in that: According to the kernel density estimation function Determine the probability density of the i-th sample in the overall distribution Among them, K is the Gaussian kernel function, n is the number of labeled samples in the entire video temporal positioning dataset, (t start ,t end ) is the start time and end time of the text annotated by the target sample in the video. is the start time and end time corresponding to the text annotated in the video of the i-th sample in the dataset.
4. The training method of the video temporal positioning model as claimed in claim 1, characterized in that: The video temporal positioning model performs word segmentation and encoding on the text of the samples in the training set to obtain a text feature vector, including: The video temporal localization model performs word segmentation on the text of the samples in the training set to obtain the Token sequence T = {t1, t2, ..., t L }, L is the number of elements in sequence T; Use the pre-trained vector dictionary M to transform each Token sequence element t i Mapped into an n-dimensional vector, we get the initialized Token vector sequence Among them, Pos(i) is the position information encoded by the position encoding function, M(t i ) is an n-dimensional vector mapped from discrete text tokens using a vector dictionary, corresponding to the semantic information of a single token; The initialized Token vector sequence is encoded using the pre-trained text model Distill-BERT based on the self-attention mechanism, and the encoded result is pooled to obtain a text feature vector F corresponding to the entire text. text .
5. The video temporal positioning model training method according to claim 1, characterized in that: The video is resampled to obtain a video feature vector including multiple segment elements of set time length, including: Use the pre-trained convolutional neural network to preliminarily extract the frame sequence features of the video; The frame sequence features are sampled at set time intervals to obtain a regular video feature vector. t is the total number of clips obtained by sampling the input video according to the set duration, This is the first video clip.
6. The training method of the video temporal positioning model as claimed in claim 5, characterized in that: Generate a timing matrix based on the video feature vector, including: The video feature vector is encoded twice using a self-attention encoder to obtain a starting feature sequence and an ending feature sequence; Each starting feature is connected with each ending feature to obtain the video clip prediction feature and form a time series matrix.
7. The video temporal positioning model training method according to claim 6, characterized in that: The similarity between each video clip and the text in the time series matrix is predicted to obtain a similarity matrix, including: The cosine similarity between the video segment prediction feature and the text feature vector of the input query text is used as its prediction confidence; The confidence is calculated for each valid vector in the time series matrix to obtain a similarity matrix.
8. The video temporal positioning model training method as claimed in claim 7, characterized in that: The contrast loss between video clips and texts is calculated based on the similarity matrix, and the video temporal localization model is optimized using the back propagation algorithm.
9. The video temporal positioning model training method as claimed in claim 8, characterized in that: According to the formula L = L bce +λL nce Calculate the loss L, where L bce is the binary classification loss, L nce is the NCE loss, and λ is a hyperparameter used to balance the relative numerical sizes of the two loss functions.
10. A training device for a video temporal positioning model, characterized in that: include: A screening module is used to screen out a training set from a sample set according to the two-dimensional distribution probability density of the annotation time of each sample; A model building module, which is used to build a video temporal localization model based on dual-branch contrast learning; A training data processing module is used to segment and encode the text of the samples in the training set using the video temporal positioning model to obtain a text feature vector, and resample the video to obtain a video feature vector including multiple set time length segment elements; A similarity prediction module is used to generate a time series matrix according to the video feature vector, and predict the similarity between each video clip and the text in the time series matrix to obtain a similarity matrix; The training module is used to calculate the contrast loss between the video clip and the text according to the similarity matrix, and optimize the video timing positioning model until the set round of video timing positioning model training optimization is completed.
Citation Information
Patent Citations
Method and system for cross-mode-based video time location, and storage medium
CN108932304A
Cross-modal video clip retrieval method based on pre-training language model adaptation network
CN116662609A
Cited By
Long video understanding method and device, equipment and storage medium
CN119380240A
A method, apparatus, device, and storage medium for long video understanding
CN119380240B
Training method of video time positioning model, video time positioning method, equipment and medium
CN121722937A
