Video time retrieval model training method and device, equipment and storage medium
By acquiring the prediction confidence information and predicted video frame boundaries of sample videos, combining smooth labels and reference video frame boundaries, calculating the loss and training the model, the problem of low accuracy in existing video moment retrieval models is solved, and higher retrieval accuracy is achieved.
Patent Information
- Application Number
- CN202110594901.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-28
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2041-05-28
AI Technical Summary
In existing technologies, video time-of-view retrieval models based on cross-modal interactive networks suffer from low accuracy due to manual annotation of sample boundaries.
By acquiring the prediction confidence information and prediction video frame boundaries of the sample videos, and combining the smoothed labels and reference video frame boundaries, the first loss is calculated. Under certain conditions, the retrieval model for the second video time step is trained, and feature extraction and mapping are performed using text representation sub-model, video representation sub-model, multimodal fusion sub-model, feature pyramid network and convolutional neural network.
This improved the accuracy of the video moment retrieval model, reduced the impact of manual annotation noise on model training, and enhanced the model's training performance.
Smart Images

Figure CN115481279B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a training method, apparatus, device, and storage medium for a video moment retrieval model. Background Technology
[0002] With the increasing number of online videos, video moment retrieval, as one of the core topics in video scene understanding, has received more and more attention. Video moment retrieval refers to the process by which a video moment retrieval model retrieves the most relevant video segment from an unedited video based on a given natural language query, thus obtaining the position of that video segment within the unedited video. In related technologies, cross-modal interaction networks (CMIN) are used as the video moment retrieval model to obtain the position of the most relevant video segment from an unedited video based on a given natural language query. This CMIN model is trained using a fully supervised training method based on sample videos, sample query text, and sample boundaries. The sample boundaries represent the start and end positions of the sample query text within the sample video.
[0003] In the above process, the sample boundaries used to train the CMIN model were manually labeled, resulting in low accuracy of the trained model when performing video moment retrieval. Summary of the Invention
[0004] To address the low accuracy issue of existing video time-of-view retrieval models, this application provides a training method, apparatus, device, and storage medium for such models. The technical solution is as follows:
[0005] Firstly, a training method for a video moment retrieval model is provided, the method comprising:
[0006] Based on the retrieval model of the first video moment, the sample video and the corresponding sample text, the prediction confidence information and prediction video frame boundary of the sample video are obtained. The prediction confidence information is used to represent the correlation between multiple video frames in the sample video and the corresponding sample text, and the prediction video frame boundary is used to represent the range of video frames corresponding to the sample text in the sample video.
[0007] Based on the reference video frame boundaries of the sample video, a smoothing label is determined for the sample video. This smoothing label is used to represent the degree of correlation between multiple video frames and the corresponding sample text.
[0008] Based on the smoothing label, prediction confidence information, prediction video frame boundary, and reference video frame boundary of the sample video, the first loss of the sample video is obtained, which is the prediction error of multiple video frames in the sample video.
[0009] If the first loss of the sample video meets the conditions, the retrieval model for the second video time step is trained based on the sample video.
[0010] In some embodiments, determining the smoothing label of the sample video based on the reference video frame boundaries of the sample video includes:
[0011] For any video frame in the sample video, if the video frame is determined to belong to the first boundary or the third boundary based on the frame number of the video frame, the smooth label of the video frame is obtained based on the Gaussian distribution function and the frame number of the video frame.
[0012] If the video frame is determined to belong to the second boundary based on its frame number, the smoothing label of the video frame is set to the first value.
[0013] If, based on the frame number of the video frame, it is determined that the video frame does not belong to the first boundary, the second boundary, or the third boundary, the smoothing label of the video frame is set to the second value. The first boundary, the second boundary, and the third boundary are obtained by blurring the boundaries of the reference video frame of the sample video.
[0014] In some embodiments, obtaining the first loss of the sample video based on the smoothing label, the prediction confidence information, the predicted video frame boundary, and the reference video frame boundary includes:
[0015] Based on the predicted video frame boundary of the sample video, multiple first video frames and multiple second video frames are determined from multiple video frames of the sample video. The first video frames are video frames related to the corresponding sample text, and the second video frames are video frames unrelated to the corresponding sample text.
[0016] Based on the smoothed label and the prediction confidence information of the sample video, the confidence loss of the multiple first video frames and the confidence loss of the multiple second video frames are obtained. The confidence loss is used to represent the error of the prediction confidence information.
[0017] Based on the predicted video frame boundary and the reference video frame boundary of the sample video, the regression loss of the multiple first video frames is obtained, and the regression loss is used to represent the error of the predicted video frame boundary.
[0018] Based on the confidence loss and regression loss of the multiple first video frames, the loss of the multiple first video frames is obtained, and the confidence loss of the multiple second video frames is used as the loss of the multiple second video frames.
[0019] In some embodiments, obtaining the regression loss of the plurality of first video frames based on the predicted video frame boundary and the reference video frame boundary of the sample video includes:
[0020] The predicted video frame boundary and the reference video frame boundary are respectively expanded by the target frame number to obtain the predicted smooth boundary and the reference smooth boundary;
[0021] Based on the predicted smoothing boundary and the reference smoothing boundary, a length loss is obtained, which is used to represent the difference between the number of video frames within the predicted smoothing boundary and the number of video frames within the reference smoothing boundary.
[0022] For any first video frame, based on the frame number of the first video frame, the predicted smoothing boundary and the reference smoothing boundary, a first distance and a second distance are obtained. The first distance is the distance between the first video frame and the predicted smoothing boundary, and the second distance is the distance between the first video frame and the reference smoothing boundary.
[0023] Based on the first distance and the second distance, an overlap loss is obtained, which is used to represent the difference between the predicted smooth boundary and the reference smooth boundary;
[0024] Based on the length loss and the overlap loss, the regression loss of the first video frame is obtained.
[0025] In some embodiments, if the first loss of the sample video meets the conditions, training the second video time-lapse retrieval model based on the sample video includes:
[0026] Based on the first loss of the sample video, the second loss of the sample video is obtained, which is the global loss of the sample video;
[0027] If the second loss of the sample video meets the conditions, the retrieval model for the second video moment is trained based on the sample video.
[0028] In some embodiments, obtaining a second loss for the sample video based on the first loss of the sample video includes:
[0029] Based on the smoothing label of the sample video, multiple third video frames and multiple fourth video frames are determined from multiple video frames of the sample video. The third video frames are video frames related to the corresponding sample text, and the fourth video frames are video frames unrelated to the corresponding sample text.
[0030] Based on the losses of the multiple third video frames and the multiple fourth video frames, the second loss of the sample video is obtained.
[0031] In some embodiments, if the second loss of the sample video meets the conditions, training the second video moment retrieval model based on the sample video includes:
[0032] Based on the second loss of the multiple sample videos in ascending order, the sample videos with the highest target proportion are selected as the target sample videos.
[0033] The retrieval model for the second video moment is trained based on the target sample video, the sample text corresponding to the target sample video, and the boundary of the reference video frame of the target sample video.
[0034] In some embodiments, the video moment retrieval model includes: a text representation sub-model, a video representation sub-model, a multimodal fusion sub-model, a feature pyramid network, and a convolutional neural network;
[0035] The model, based on the first video moment, retrieves the sample video and the corresponding sample text to obtain the prediction confidence information and prediction video frame boundaries of the sample video, including:
[0036] Based on this text representation sub-model, feature extraction is performed on the sample text corresponding to the sample video to obtain the sample text features;
[0037] Based on this video representation sub-model, feature extraction is performed on the sample video to obtain the sample video features;
[0038] Based on this multimodal fusion sub-model, the text features and video features of the sample are fused to obtain the sample fusion features;
[0039] Based on this feature pyramid network, multiple convolution and upsampling operations are performed on the sample fusion features. The data obtained from these multiple convolution and upsampling operations are then concatenated to obtain the sample concatenated features.
[0040] Based on the convolutional neural network, the splicing features of the sample are mapped to obtain the prediction confidence information of the sample video;
[0041] Based on the prediction confidence information of the sample video, the predicted video frame boundaries of the sample video are obtained.
[0042] Secondly, a training apparatus for a video moment retrieval model is provided, the apparatus comprising multiple functional modules for performing corresponding steps in the training method for the video moment retrieval model provided in the first aspect.
[0043] Thirdly, a computer device is provided, comprising a communication bus, at least one network interface, a memory, and at least one processor. The communication bus is used to transmit information between the aforementioned components, the at least one network interface is used to communicate with other devices or communication networks, the memory stores program code, and the at least one processor implements any step of the training method for the video moment retrieval model in the first aspect by reading and executing the program code stored in the memory.
[0044] Fourthly, a computer-readable storage medium is provided, wherein when the program code in the computer-readable storage medium is executed by the processor of a network element, a computer device is enabled to perform any step of the training method for the video moment retrieval model in the first aspect described above.
[0045] Fifthly, a computer program product or computer program is provided, comprising computer program code stored in a computer-readable storage medium. A processor of a computer device reads the computer program code from the computer-readable storage medium and executes the computer program code, causing the computer device to perform any step of the training method for the video moment retrieval model described in the first aspect. Attached Figure Description
[0046] Figure 1 This is a schematic diagram of the implementation environment for a training method for a video moment retrieval model provided in an embodiment of this application;
[0047] Figure 2 This is a schematic diagram of the structure of a computer device 200 provided in an embodiment of this application;
[0048] Figure 3 This is a schematic diagram of the structure of a video moment retrieval model provided in an embodiment of this application;
[0049] Figure 4 This is a flowchart illustrating the steps of a training method for a video moment retrieval model provided in an embodiment of this application;
[0050] Figure 5 This is a schematic diagram of a training method for a video moment retrieval model provided in an embodiment of this application;
[0051] Figure 6 This is a comparison chart of the results of smoothing labels provided in an embodiment of this application;
[0052] Figure 7 This is a schematic diagram of the structure of a training device for a video moment retrieval model provided in an embodiment of this application. Detailed Implementation
[0053] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0054] Figure 1 This is an implementation environment for a training method for a video moment retrieval model provided in this application embodiment. The implementation environment includes: a terminal 101 and a server 102.
[0055] Terminal 101 and server 102 can be connected directly or indirectly via wired or wireless networks, and this embodiment of the application does not limit this connection. Optionally, terminal 101 can be a smartphone, tablet, laptop, desktop computer, etc., but is not limited to these. Terminal 101 can provide server 102 with information required for training the video moment retrieval model, such as training parameters, sample videos, sample text, and reference video frame boundaries.
[0056] Server 102 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. Server 102 is used to train a video time-lapse retrieval model based on the information provided by terminal 101.
[0057] Optionally, during the training of the video time-retrieval model, server 102 undertakes the main computational work and terminal 101 undertakes the secondary computational work; or, server 102 undertakes the secondary computational work and terminal 101 undertakes the main computational work; or, server 102 or terminal 101 can each undertake the computational work independently.
[0058] Optionally, terminal 101 generally refers to one of multiple terminals; this embodiment only uses terminal 101 as an example. Those skilled in the art will understand that the number of terminals 101 can be greater. For example, there may be dozens or hundreds, or even more, terminals 101. In this case, the implementation environment of the training method for the video moment retrieval model may also include other terminals. This application embodiment does not limit the number of terminals or the type of device.
[0059] Both the aforementioned servers and terminals can be considered as computer devices. Figure 2 This is a schematic diagram of the structure of a computer device 200 provided in an embodiment of this application. Figure 2 The computer device 200 shown is used to perform operations involved in the training method of the video time-of-view retrieval model, such as... Figure 2 As shown, the computer device 200 includes at least one processor 201, a communication bus 202, a memory 203, and at least one network interface 204.
[0060] Processor 201 may be, for example, a general-purpose central processing unit (CPU), a network processor (NP), a graphics processing unit (GPU), a neural-network processing unit (NPU), a data processing unit (DPU), a microprocessor, or one or more integrated circuits for implementing the embodiments of this application. For example, processor 201 may include an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. A PLD may be, for example, a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0061] The communication bus 202 is used to transmit information between the aforementioned components. The communication bus 202 can optionally be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, Figure 2 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0062] Memory 203 may be, for example, read-only memory (ROM) or other types of static storage devices capable of storing static information and instructions; random access memory (RAM) or other types of dynamic storage devices capable of storing information and instructions; electrically erasable programmable read-only memory (EEPROM); compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed discs, laser discs, optical discs, digital universal discs, Blu-ray discs, etc.); magnetic disk storage media or other magnetic storage devices; or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but not limited thereto. Memory 203 may exist independently and be connected to processor 201 via communication bus 202. Alternatively, memory 203 and processor 201 may be integrated together.
[0063] Network interface 204 uses any transceiver-like device for communicating with other devices or communication networks. Network interface 204 includes a wired network interface and optionally also includes a wireless network interface. The wired network interface is, for example, an Ethernet interface. The Ethernet interface is, for example, an optical interface, an electrical interface, or a combination thereof. The wireless network interface is, for example, a wireless local area network (WLAN) interface, a cellular network interface, or a combination thereof.
[0064] In some embodiments, processor 201 includes one or more CPUs, such as Figure 2 CPU0 and CPU1 are shown in the diagram.
[0065] In some embodiments, the computer device 200 may optionally include a plurality of processors, such as Figure 2 The processors 201 and 205 are shown. Each of these processors is, for example, a single-core processor or a multi-core processor. A processor here may optionally refer to one or more devices, circuits, and / or processing cores used to process data (such as computer program instructions).
[0066] In some embodiments, the computer device 200 further includes output devices and input devices. The output device may optionally display information in various ways. For example, the output device may be a liquid crystal display (LCD), a light-emitting diode (LED) display device, a cathode ray tube (CRT) display device, or a projector, etc. The input device communicates with the processor 201 and may optionally receive user input in various ways. For example, the input device may be a mouse, keyboard, touchscreen device, or sensing device, etc.
[0067] Optionally, the processor 201 implements the method in the following embodiments by reading the program code 210 stored in the memory 203, or the processor 201 implements the method in the following embodiments by internally stored program code. When the processor 201 implements the method in the following embodiments by reading the program code 210 stored in the memory 203, the memory 203 stores program code that implements the training method for the video moment retrieval model provided in the embodiments of this application.
[0068] For more details on how processor 201 implements the above functions, please refer to the descriptions in the various method embodiments below, which will not be repeated here.
[0069] This application also provides a computer-readable storage medium including program code, such as a memory 203 including program code, which can be executed by the processor 201 of the computer device 200 to complete a training method for a video moment retrieval model. Optionally, the computer-readable storage medium may be read-only memory (ROM), random access memory (RAM), compact-disc read-only memory (CD-ROM), magnetic tape, floppy disk, and optical data storage device, etc.
[0070] This application also provides a computer program product or computer program, which includes computer program code stored in a computer-readable storage medium. A processor of a computer device reads the computer program code from the computer-readable storage medium and executes the computer program code, causing the computer device to perform a training method for the video moment retrieval model.
[0071] To more clearly explain the training method of the video moment retrieval model provided in this application, the video moment retrieval model provided in the embodiments of this application will be described first below. Figure 3This is a schematic diagram of the structure of a video moment retrieval model provided in an embodiment of this application. This video moment retrieval model is used to retrieve video segments related to the text based on input text and video, such as... Figure 3 As shown, the video moment retrieval model includes: a text representation sub-model 301, a video representation sub-model 302, a multimodal fusion sub-model 303, a feature pyramid network 305, and a convolutional neural network 305. Specifically, the text representation sub-model 301 is used to obtain text features based on the input text; the video representation sub-model 302 is used to obtain video features based on the input video; the multimodal fusion sub-model 303 is used to obtain fused features based on text and video features; the feature pyramid network 304 is used to obtain spliced features based on the fused features; and the convolutional neural network 305 is used to obtain prediction confidence information for the video based on the spliced features. Optionally, this video moment retrieval model is implemented using the PyTorch deep learning framework.
[0072] The aforementioned video moment retrieval model can be trained based on sample videos, corresponding sample text, and corresponding reference video frame boundaries. This training process is achieved through multiple iterations. Taking the server executing this training process as an example, in any iteration, the server trains the model based on a batch of sample videos, corresponding sample text, and corresponding reference video frame boundaries. Optionally, the batch sampling size is 128. The following section combines... Figure 4 and Figure 5 Taking a sample video, its corresponding sample text, and the corresponding reference video frame boundary from the first iteration of training as an example, the training method of the retrieval model at that video moment is explained. The sample video is denoted as V = {v...} i} n v i Let $n$ represent the $i$-th video frame in the sample video, and $n$ represent the number of video frames in the sample video. The corresponding sample text is denoted as $Q = {q}$. j} m q j Let m represent the j-th word in the sample text, and m represent the number of words in the sample text.
[0073] Figure 4 This is a flowchart illustrating the steps of a training method for a video moment retrieval model provided in an embodiment of this application. Figure 4 As shown, the method includes the following steps:
[0074] 401. The server retrieves the model, sample video, and corresponding sample text based on the first video moment, and obtains the prediction confidence information and prediction video frame boundaries of the sample video. The prediction confidence information is used to represent the degree of correlation between multiple video frames in the sample video and the corresponding sample text, and the prediction video frame boundaries are used to represent the range of video frames corresponding to the sample text in the sample video.
[0075] In some embodiments, the server initializes the first video moment retrieval model, configures the network parameters of the first video moment retrieval model as initialization parameters, and obtains the prediction confidence information and prediction video frame boundaries of the sample video based on the initialized first video moment retrieval model, sample video and corresponding sample text.
[0076] Optionally, the server randomly selects initialization parameters and configures the network parameters of the first video moment retrieval model as initialization parameters. Optionally, the terminal provides an initialization parameter setting function, allowing developers to set the initialization parameters through the terminal. In response to the developer's submission of the initialization parameters, the terminal sends the initialization parameters to the server, which then initializes the first video moment retrieval model based on the received initialization parameters. This application embodiment does not limit the initialization method.
[0077] Optionally, the server is associated with a database that stores training data for the retrieval model at the first video moment. This training data includes sample videos, sample text, and corresponding reference video frame boundaries. These reference video frame boundaries are used to obtain smoothed labels and a first loss for the sample videos, enabling model training. The server can retrieve the sample video and corresponding sample text from the database and, based on the retrieval model at the first video moment, obtain prediction confidence information and prediction video frame boundaries for the sample video.
[0078] In some embodiments, the process by which the server obtains the prediction confidence information and prediction video frame boundaries of the sample video is implemented by steps 401A to 401F:
[0079] 401A. The server extracts features from the sample text based on the text representation sub-model of the retrieval model at the first video moment, thus obtaining the sample text features.
[0080] In some embodiments, the text representation sub-model includes: a global vectors for word representation sub-model, a first bidirectional gated recurrent network, and a syntactic graph network. The server first uses the global vectors for word representation (GloVe) sub-model to represent the words in the sample text using vectors, obtaining multiple word vectors corresponding to the sample text, denoted as... Then, the server uses a first bi-directional gated recurrent neural network (BiGRU) and multiple word vectors from the sample text to obtain the contextual information of each word in the sample text. Finally, it further learns the contextual information of each word in the sample text using syntactic graph convolution networks (GCN) to obtain the dependency information of adjacent words in the sample text. This dependency information of adjacent words is the sample text feature, denoted as .
[0081] It should be noted that the above process of obtaining sample text features based on the text representation sub-model can be understood as follows: the sample text is input into the text representation sub-model, the global vector sub-model of the text representation sub-model processes the sample text, outputs multiple word vectors to the first bidirectional gated recurrent network of the text representation sub-model, the first bidirectional gated recurrent network processes the multiple word vectors, outputs the context information of the sample text to the syntactic graph network of the text representation sub-model, the syntactic graph network processes the context information, and outputs the sample text features.
[0082] 401B. The server extracts features from the sample video based on the video representation sub-model of the first video moment retrieval model to obtain the sample video features.
[0083] In some embodiments, the video representation sub-model includes: a three-dimensional convolutional neural network, a multi-head self-attention unit, and a second bidirectional gated recurrent network. The server first extracts features from the sample video based on the three-dimensional convolutional neural network to obtain initial video features, denoted as... Then, the server maps the initial video features based on a multi-head self-attention unit to obtain the dependency information between any video frame and other video frames in the sample video. Finally, it further learns this dependency information based on a second bidirectional gated recurrent network to obtain the sample video features of the sample video, denoted as .
[0084] It should be noted that the above process of obtaining sample video features based on the video representation sub-model can be understood as follows: the sample video is input into the video representation sub-model, the three-dimensional convolutional neural network of the video representation sub-model processes the sample video, outputs initial video features to the multi-head self-attention unit of the video representation sub-model, the multi-head self-attention unit processes the initial video features, outputs the dependency information between video frames to the second bidirectional gated recurrent network of the video representation sub-model, the second bidirectional gated recurrent network processes the dependency information, and outputs sample video features.
[0085] 401C. The server, based on the multimodal fusion sub-model of the first video moment retrieval model, fuses the text features and video features of the sample to obtain the sample fusion features.
[0086] In some embodiments, the multimodal fusion sub-model includes: an attention unit, an interaction gate, and a bilinear fusion sub-model. The server acquires sample fusion features based on the following four processes:
[0087] Process 1: The server obtains the attention information between any video frame and any word based on the attention unit, sample text features and sample video features, as shown in formula (1).
[0088]
[0089] in, and Let b be a relative parameter matrix. m Let ω be the bias vector. T M is a row vector of parameters. ij This represents the attention information between the i-th video frame and the j-th word.
[0090] Process 2: For any video frame, the server aggregates the sample text features related to the video frame based on the attention information to obtain the aggregated text features of the video frame. The method for obtaining the aggregated text features is shown in formula (2).
[0091]
[0092] in, Let be the aggregated text features of the i-th video frame in the sample video.
[0093] Process 3: Based on the obtained aggregated text features, sample video features and interaction gates, the server emphasizes key features and weakens irrelevant features to obtain aggregated text features filtered by video gating information and sample video features filtered by text gating information, as shown in formula (3).
[0094]
[0095] Among them, W v and W s Let b be the parameter matrix. v and b s This is the bias vector, and ⊙ represents element-wise multiplication. This refers to the video gating information for the i-th video frame in the sample video. Let be the text gating information of the i-th video frame in the sample video. These are the aggregated text features after being filtered by video gating information. These are the features of the sample video after being filtered by text-gated information.
[0096] Process 4: The server further fuses the filtered sample video features and aggregated text features based on the bilinear fusion sub-model to obtain the sample fusion features, as shown in formula (4).
[0097]
[0098] Among them, P f Let b be the coefficient vector. f f is the bias vector. i Let f be the sample fusion feature of the i-th video frame in the sample video. The sample fusion feature of this sample video can be represented as f = {f1, f2, ..., f...} n Let the dimension of the fused features of this sample be denoted as S0×D.
[0099] 401D: The server performs multiple convolution and upsampling operations on the sample fusion features based on the feature pyramid subnetwork of the retrieval model at the first video moment. The data obtained from these multiple convolution and upsampling operations are then concatenated to obtain the sample concatenated features.
[0100] In some embodiments, the feature pyramid networks (FPN) consist of multiple network layers {B1, B2, ..., B} from bottom to top. o} and multiple network layers {T1, T2, ... T} from top to bottom o The network consists of layers}, where o represents the number of layers. The multiple layers from bottom to top are convolutional layers, used to perform convolution operations on the input data. The input data of the bottommost convolutional layer B1 is the sample fusion feature, and its output data is the input data of the next higher-level convolutional layer. The input data of any convolutional layer other than the bottommost layer is the output data of the next higher-level convolutional layer. The output data of these multiple layers from bottom to top are denoted as}. The dimension of the output data is represented by S. The first dimension of the output data of any convolutional layer is half the dimension of the input data of that convolutional layer. k+1 =0.5*S k In this context, the previous level convolutional layer refers to the next lower level convolutional layer, and the next level convolutional layer refers to the next higher level convolutional layer. For example, the previous level convolutional layer of B3 is B2, and the next level convolutional layer of B3 is B4. The calculation process of this bottom-up multiple network layers is shown in formula (5).
[0101]
[0102] Among them, Bk () indicates the k-th network layer from bottom to top.
[0103] In a top-down network of multiple layers, the highest layer T o The input data is T o Used for data F o Add T element-wise to the data itself. o The output data is denoted as In a top-down network structure, all layers except the highest one are upsampling layers. These layers upsample the input data, doubling the first dimension of the input data. Specifically, the upsampling layer T... o-1 The input data is T o Output data Except T o-1 The input data for any upsampling layer outside the previous layer is obtained by element-wise summing the output data of the previous upsampling layer with the output data of the corresponding convolutional layer of the previous upsampling layer, and then processing the summed data using a target convolutional layer. Optionally, the convolutional kernel in the target convolutional layer has a dimension of 3×3. The data processed by the convolutional layer is denoted as... Here, the previous upsampling layer refers to the next higher upsampling layer. For example, the previous upsampling layer of T3 is T4. The calculation process of this top-down multi-network layer is shown in formula (6).
[0104]
[0105] in, `expand()` represents element-wise addition, and `expand()` represents upsampling. The server processes data obtained from multiple top-down network layers. The data is processed to unify its dimensions to S0×D', and the data after unification is denoted as... The data after unifying the dimension are concatenated to obtain the sample concatenation features, as shown in formula (7).
[0106]
[0107] Where Concat() represents the concatenation operation, C f This refers to the features of sample splicing.
[0108] 401E: The server uses a convolutional neural network based on the first video time step retrieval model to map the spliced features of the sample and obtain the prediction confidence information of the sample video.
[0109] In some embodiments, the server maps the concatenated features of the sample to a confidence space based on the convolutional neural network to obtain the prediction confidence information of the sample video, denoted as Conf = {Conf}. i , i∈[1,n]}. For example, this convolutional neural network contains 4 convolutional layers and a sigmoid function. The convolutional kernels in the 4 convolutional layers have a dimension of 1×3 and the activation function is the ReLU function.
[0110] 401F: Based on the prediction confidence information of the sample video, the server obtains the predicted video frame boundaries of the sample data.
[0111] The predicted video frame boundary is used to indicate the range of video frames corresponding to the sample text in the sample video. The predicted video frame boundary is from the prediction start frame number to the prediction end frame number.
[0112] In some embodiments, the server determines multiple target video frames from multiple video frames of the sample video based on the prediction confidence information of the sample video. The target video frames are video frames with prediction confidence information greater than 0. The minimum frame number among the frame numbers corresponding to the multiple target video frames is used as the prediction start frame number of the prediction video frame boundary, and the maximum frame number among the frame numbers corresponding to the multiple target video frames is used as the prediction end frame number of the prediction video frame boundary, denoted as τ'=(s',e').
[0113] 402. Based on the reference video frame boundaries of the sample video, the server determines the smoothing label of the sample video. The smoothing label is used to represent the degree of correlation between multiple video frames and the corresponding sample text.
[0114] The smoothing label of the sample video is a vector containing multiple elements, where each element represents the smoothing label of a video frame within the sample video. The reference video frame boundary represents the range of video frames corresponding to this text within the sample video; this boundary extends from the reference start frame number to the reference end frame number, denoted as .
[0115] In some embodiments, the server can directly determine the label of the sample video based on the reference video boundary. The label is used to indicate whether multiple video frames in the sample video are related to the corresponding sample text. For example, the label of the video frame that belongs to the reference video frame boundary is set to 1, and the label of the video frame that does not belong to the reference video frame boundary is set to 0, as shown in formula (8).
[0116]
[0117] Where ls(i) represents the label of the i-th video frame in the sample video.
[0118] It should be noted that since the reference video frame boundaries are obtained based on manual annotation, noise is often present. That is, the start and end points of the reference video frame boundaries are not completely accurate. Therefore, the labels of the sample videos obtained based on the above method cannot avoid the influence of noise on the model. Training the model based on these labels will lead to poor training results. Therefore, the labels are smoothed to reduce the impact of noise on the model to some extent.
[0119] In some embodiments, the server determines the smoothing label of the sample video based on the reference video frame boundaries, including any of the following:
[0120] Method 1: For any video frame in the sample video, if the server determines that the video frame belongs to the boundary of the reference video frame based on the frame number of the video frame, the smoothing label of the video frame is obtained based on the first parameter, which is a preset value in the server that is less than 1 and greater than 0. If the server determines that the video frame does not belong to the boundary of the reference video frame based on the frame number of the video frame, the smoothing label of the video frame is obtained based on the hyperparameter and the number of video frames in the sample video. The process of obtaining the smoothing label based on Method 1 is shown in Formula (9).
[0121]
[0122] Where ∈ is the first parameter, D l The number of video frames in the sample video.
[0123] Method 2: For any video frame in the sample video, if the server determines that the video frame belongs to the first boundary or the third boundary based on the frame number, the smoothing label of the video frame is obtained based on the Gaussian distribution function and the frame number. If the server determines that the video frame belongs to the second boundary based on the frame number, the smoothing label of the video frame is set to a first value, optionally 1. If the server determines that the video frame does not belong to the first boundary, the second boundary, or the third boundary based on the frame number, the smoothing label of the video frame is set to a second value, optionally 0. The first boundary, the second boundary, and the third boundary are obtained by blurring the boundary of the reference video frame of the sample video.
[0124] The blurring of the reference video frame boundary for the sample video refers to expanding the range of the reference video frame boundary based on the target frame number to obtain the first boundary, second boundary, and third boundary, which includes the following three processes:
[0125] Process 1: The server determines the first frame number and the second frame number based on the reference starting frame number and the target frame number of the reference video frame boundary. The first frame number is the reference starting frame number minus the target frame number, and the second frame number is the reference starting frame number plus the target frame number.
[0126] Process 2: The server determines the third and fourth frame numbers based on the reference end frame number and the target frame number at the reference video frame boundary. The third frame number is the reference end frame number minus the target frame number, and the fourth frame number is the reference end frame number plus the target frame number.
[0127] Process 3: Based on the first frame number, second frame number, third frame number, and fourth frame number, the server determines the first boundary, the second boundary, and the third boundary. The first boundary has the first frame number and the second frame number as its two endpoints, the second boundary has the second frame number and the third frame number as its two endpoints, and the third boundary has the third frame number and the fourth frame number as its two endpoints.
[0128] The process of obtaining smooth labels based on method 2 is shown in formula (10).
[0129]
[0130] Where i represents the frame number of the video frame in the sample video, ls(i) represents the smoothing label of the i-th video frame in the sample video, and ρ represents the target frame number. Indicates the first frame number. Indicates the second frame number. Indicates the third frame number. Indicates the fourth frame number. This represents the first boundary, and the average frame number of multiple video frames within the first boundary is set to... This represents the variance of the first boundary. It is calculated based on the average frame number of multiple video frames within the first boundary and the frame number of multiple video frames within the first boundary. Indicates the second boundary. To represent the third boundary, the average frame number of multiple video frames within the third boundary is set to... The variance of the third boundary is represented. It is calculated based on the average frame number of multiple video frames in the third boundary and the frame number of multiple video frames in the third boundary.
[0131] Figure 6 The results of obtaining smooth labels based on Method 1 and Method 2 described above are shown. Figure 6 As can be seen, Method 1 obtains smooth labels by changing the values of the labels, while Method 2 weakens the importance of the boundaries by blurring the boundaries of the reference video frames. Furthermore, it improves the fault tolerance of the smooth labels by obtaining the smooth labels for the first and third boundaries based on a Gaussian distribution, thereby reducing the impact of noise on model training. Therefore, the smooth labels obtained by Method 2 are superior. Thus, in this embodiment, the smooth labels obtained by Method 2 are used to perform subsequent training steps.
[0132] 403. Based on the smoothing label, prediction confidence information, prediction video frame boundary, and reference video frame boundary of the sample video, the server obtains the first loss of the sample video, which is the prediction error of multiple video frames in the sample video.
[0133] In some embodiments, such as Figure 5 As shown in section 501, step 403 is implemented by steps 403A to 403D:
[0134] 403A. Based on the predicted video frame boundaries of the sample video, the server determines multiple first video frames and multiple second video frames from multiple video frames of the sample video. The first video frame is a video frame related to the corresponding sample text, that is, the smoothing label corresponding to the first video frame is greater than 0. The second video frame is a video frame unrelated to the corresponding sample text, that is, the smoothing label corresponding to the second video frame is equal to 0.
[0135] 403B. Based on the smoothed label and prediction confidence information of the sample video, the server obtains the confidence loss of the multiple first video frames and the confidence loss of the multiple second video frames. The confidence loss is used to represent the error of the prediction confidence information.
[0136] In some embodiments, the confidence loss is obtained as shown in formula (11).
[0137]
[0138] Where i represents the frame number of the video frame in the sample video, L c (i) represents the confidence loss of the i-th video frame in the sample video. i This represents the prediction confidence information of the i-th video frame in the sample video. It should be noted that if the prediction confidence information of any video frame is 0, the second parameter is used to replace the prediction confidence information of that video frame. Optionally, the second parameter is 10⁻⁸.
[0139] 403C. The server obtains the regression loss of the plurality of first video frames based on the predicted video frame boundary and the reference video frame boundary of the sample video. The regression loss is used to represent the error of the predicted video frame boundary.
[0140] In some embodiments, the server obtains the regression loss for any first video frame through the following four processes:
[0141] Process 1: Obtain the length loss, which represents the difference between the number of video frames within the predicted smoothing boundary and the number of video frames within the reference smoothing boundary. The server expands the predicted video frame boundary and the reference video frame boundary by the target frame number, respectively, to obtain the predicted smoothing boundary and the reference smoothing boundary. The predicted smoothing boundary is denoted as... The reference smooth boundary is denoted as Based on the predicted smoothing boundary and the reference smoothing boundary, the length loss is obtained, and this length loss is denoted as... The value represents the number of video frames within the reference smooth boundary, u' represents the number of video frames within the predicted smooth boundary, and l() is the l1 loss function.
[0142] Process 2: Obtain a first distance and a second distance. The first distance is the distance between the first video frame and the predicted smooth boundary, and the second distance is the distance between the first video frame and the reference smooth boundary. The server obtains the first distance and the second distance based on the frame number of the first video frame, the predicted smooth boundary, and the reference smooth boundary. Since the predicted smooth boundary includes two endpoints, the first distance includes the distance from the first video frame to the two endpoints of the predicted smooth boundary. Since the reference smooth boundary includes two endpoints, the second distance includes the distance from the first video frame to the two endpoints of the reference smooth boundary. The method for obtaining the first distance and the second distance is shown in formula (12).
[0143]
[0144] Where i represents the frame number of the video frame in the sample video. and This represents the first distance of the i-th video frame in the sample video. and This represents the second distance of the i-th video frame in the sample video.
[0145] Process 3: Obtain the overlap loss, which represents the difference between the predicted smooth boundary and the reference smooth boundary. The server obtains the overlap (IoU) loss based on the first distance and the second distance, and the method for obtaining the overlap loss is shown in formula (13).
[0146]
[0147] Among them, L iou (i) represents the overlap loss of the i-th video frame in the sample video.
[0148] Step 4: Obtain the regression loss. Based on the length loss and the overlap loss, the server obtains the regression loss of the first video frame. The method for obtaining the regression loss is shown in formula (14).
[0149]
[0150] Where i represents the frame number of the video frame in the sample video, L r (i) represents the regression loss of the i-th video frame in the sample video.
[0151] 403D. The server obtains the loss of the multiple first video frames based on the confidence loss and the regression loss of the multiple first video frames, as shown in formula (15). The confidence loss of the multiple second video frames is used as the loss of the multiple second video frames. That is, the loss L(i) of any second video frame is L(i) = L c L(i) represents the loss of the i-th video frame in the sample video.
[0152] L(i)=αL c (i)+L r (i) (15)
[0153] Where i represents the frame number of the video frame in the sample video, and α represents the weight parameter used to balance the regression loss and confidence loss.
[0154] 404. If the first loss of the sample video meets the conditions, the server trains the retrieval model for the second video time step based on the sample video.
[0155] In some embodiments, step 404 is implemented by steps 404A to 404B:
[0156] 404A. Based on the first loss of the sample video, the server obtains the second loss of the sample video, which is the global loss of the sample video.
[0157] In some embodiments, the server determines multiple third video frames and multiple fourth video frames from multiple video frames of the sample video based on the smoothing label of the sample video. The third video frames are video frames related to the corresponding sample text, that is, the smoothing label of the third video frame is greater than 0. The fourth video frames are video frames unrelated to the corresponding sample text, that is, the smoothing label of the fourth video frame is equal to 0. Based on the loss of the multiple third video frames and the loss of the multiple fourth video frames, the second loss of the sample video is obtained. The method for obtaining the second loss is shown in formula (16).
[0158]
[0159] Where i represents the frame number of the video frame in the sample video, i t Indicates the frame number of multiple third video frames, i f N represents the frame number of multiple fourth video frames. p L represents the number of the fourth video frame. f This indicates the second loss.
[0160] 404B. If the second loss of the sample video meets the conditions, the server trains the retrieval model for the second video moment based on the sample video.
[0161] In some embodiments, such as Figure 5 As shown in section 502, Figure 5 In part 502, N represents the number of sample videos. This step 404B includes the following three processes:
[0162] Process 1: The server retrieves multiple sample videos from the database and denotes these multiple sample videos as B. The second loss of these multiple sample videos is obtained. According to the order of the second loss of these multiple sample videos from smallest to largest, the sample videos located at the first target proportion are taken as target sample videos. The method for obtaining target sample videos is shown in formula (17).
[0163] B h =argmin B’:|B’|<p L f (h, B') (17)
[0164] Where B' represents any one of the multiple sample videos, p represents the target proportion, h represents the retrieval model at the first video time step, and L f (h, B') represents the second loss B' obtained based on the retrieval model at the first video moment, where B' is the second loss. h This indicates the target sample data corresponding to the retrieval model at the first video moment.
[0165] Process 2: The server trains the second video moment retrieval model based on the target sample video, the sample text corresponding to the target sample video, and the reference video frame boundary of the target sample video. The method for training the second video moment retrieval model is shown in formula (18).
[0166]
[0167] Among them, w g Here are the network parameters for the retrieval model at the second video time step, where η is the learning rate. Here, ω' is the gradient operator, g represents the retrieval model at the second video time step. g For B-based h The network parameters of the retrieved model in the updated second video moment.
[0168] Process 3: The server is based on ω' g The updated second video moment retrieval model is obtained.
[0169] In step 404B, by sorting the second loss of multiple sample videos, the sample video with the smaller global loss is determined as the target sample video, and the model is trained based on the target sample video. Since the loss of the sample video with more noise is greater than that of the sample video with less noise, training the model based on the target sample video can remove the sample video with more noise, thereby further reducing the impact of noise on the model training.
[0170] In some embodiments, for steps 401 to 404 above, the server can train multiple video moment retrieval models in parallel. The method provided in this application embodiment further includes: the server obtains target sample videos corresponding to multiple video moment retrieval models based on a method similar to steps 401 to 404, wherein the first video moment retrieval model is any one of the multiple video moment retrieval models, the second video moment retrieval model is any one of the multiple video moment retrieval models other than the first video moment retrieval model, and the first video moment retrieval model is trained based on the target sample videos corresponding to the second video moment retrieval model, as shown in formula (19).
[0171]
[0172] Among them, L f (g, B') represents the second loss B' obtained based on the retrieval model at the second video time step, where B' is the second loss. g This represents the target sample data corresponding to the retrieval model at the second video moment, ω. h To retrieve the network parameters of the model for the first video moment, For B-based g The updated network parameters of the first video moment retrieval model are based on ω'. h The updated second video moment retrieval model is obtained.
[0173] For example, taking the target sample video of two video moment retrieval models as an example, the two video moment retrieval models are the first video moment retrieval model and the second video moment retrieval model, such as... Figure 5 As shown, for a batch of sample data B, the server obtains the target sample video B corresponding to the retrieval model at the first video moment based on the same method as in steps 401 to 404. h The target sample video B corresponding to the second video moment retrieval model g Based on B hTrain the second video moment retrieval model g to obtain the updated second video moment retrieval model, based on B. g Train the first video moment retrieval model h to obtain the updated first video moment retrieval model.
[0174] Optionally, the above training process is implemented by the Adam optimizer, with the learning rate set to 10 during model training. -8 The forgetting rate was set to 0.2, and the weight decay coefficient was set to 10. -7 .
[0175] By acquiring target sample videos corresponding to multiple video moment retrieval models, each model can be trained using low-loss sample videos from other models, avoiding the phenomenon of error accumulation in the same model. At the same time, during the training process, multiple video moment retrieval models can all reduce the noise in the boundary of the reference video frame, thereby further improving the training effect and effectively improving the accuracy of the model when performing video moment retrieval.
[0176] It should be noted that after steps 401 to 404, the server obtains the updated video time-of-view retrieval model. Then, based on the updated model, the server performs the next iteration of training. The specific training process is similar to steps 401 to 404, except that in steps 401 and 403, the server executes the relevant steps based on the initialized model, while in the next iteration, it executes them based on the updated model. Through this iterative training method, the network parameters of the video time-of-view retrieval model are iteratively updated until the target training conditions are met, resulting in the trained model.
[0177] The experimental results of this application and related methods are described below based on the ActivityCaption dataset and the TACOS dataset.
[0178] Table 1 compares the results of multiple methods under different levels of noise based on the ActivityCaption dataset. As shown in Table 1, the value of Noise in the first row represents the proportion of noise contained in the boundary of the reference video frame. That is, the larger the value of Noise, the greater the noise in the boundary of the reference video frame used to train the model. Under the same level of noise, "@0.3", "@0.5", and "mIoU" are used as evaluation criteria to compare the performance of different methods. Here, "@0.3" represents the proportion of predicted video frame boundaries with an IoU greater than 0.3 among all the sample videos used for testing, "@0.5" represents the proportion of predicted video frame boundaries with an IoU greater than 0.5 among all the sample videos used for testing, and "mIoU" represents the mean of "@0.1", "@0.3", "@0.5", and "@0.7". The meanings of "@0.1" and "@0.7" are the same as those of "@0.3" and "@0.5". IoU is the degree of overlap between the predicted video frame boundary and the reference video frame boundary. The higher the overlap, the higher the accuracy of the model. That is, the higher the values of "@0.3", "@0.5", and "mIoU", the higher the accuracy of the corresponding model. The first column of Table 1 represents the different methods. "Base" is the video time-of-view retrieval model provided in this application, but it is not trained using the training method provided in this application. "Base+LS" is the video time-of-view retrieval model provided in this application and trained using the smoothed labels provided in this application. "Base+LS+RG" is the video time-of-view retrieval model provided in this application and trained using the smoothed labels and regression loss provided in this application, that is, trained using the first loss provided in this application. "Base+LS+RG+IL" is the video time-of-view retrieval model provided in this application and trained using the training method provided in this application. CTRL, CMIN, and 2D-TAN are related models in the prior art. Among them, CTRL is the cross-modal temporal regression localizer (CTRL), CMIN is the cross-modal interaction network (CMIN), and 2D-TAN is the 2D temporal adjacent network (2D-TAN). Table 2 compares the results of multiple methods under different levels of noise based on the TACoS dataset. The evaluation criteria and methods used in Table 2 are the same as those in Table 1, and will not be repeated here.
[0179] The data highlighted in bold in Tables 1 and 2 represent the best results under the same evaluation criterion, while the data highlighted in underline represent the second-best results under the same evaluation criterion. As can be seen from the data in Tables 1 and 2, the performance of some models drops sharply after training with noisy reference video boundaries, resulting in a significant decrease in accuracy for video moment retrieval. However, the model trained using the method provided in this application maintains good performance regardless of whether the reference video frame boundaries contain noise or not. Especially when the noise increases, the model trained using the method provided in this application still maintains high accuracy in video moment retrieval, and its performance is significantly better than other related models. Therefore, the method proposed in this application can reduce the impact of noise in the reference video frame boundaries on model training, resulting in a model with high accuracy in video moment retrieval.
[0180] Table 1
[0181]
[0182] Table 2
[0183]
[0184] The training method for the video moment retrieval model provided in this application involves obtaining the prediction confidence information and predicted video frame boundaries of the sample data through a first video moment retrieval model. Then, a smoothing label is obtained for the sample data. This smoothing label blurs the reference video frame boundaries, reducing the impact of reference video frame boundary noise on model training. Subsequently, a first loss is obtained for the sample video using the smoothing label, prediction confidence information, predicted video frame boundaries, and corresponding reference video frame boundaries. Based on sample videos that meet the first loss criteria, a second video moment retrieval model is trained. This avoids the accumulation of errors from the same model during training, thereby further improving the model's training effect. Therefore, the method proposed in this application can reduce the adverse effects of noise on model training while improving the model's training effect, thus effectively improving the accuracy of the video moment retrieval model.
[0185] Figure 7 This is a schematic diagram of a training device for a video time-of-view retrieval model provided in an embodiment of this application. This training device is used to execute the steps of the training method for the video time-of-view retrieval model described above. (See also...) Figure 7 The training device for the video moment retrieval model includes: an acquisition module 701, a determination module 702, and a training module 703.
[0186] The acquisition module 701 is used to retrieve the model, sample video and corresponding sample text based on the first video moment, and to acquire the prediction confidence information and prediction video frame boundary of the sample video. The prediction confidence information is used to represent the correlation between multiple video frames in the sample video and the corresponding sample text, and the prediction video frame boundary is used to represent the range of video frames corresponding to the sample text in the sample video.
[0187] The determination module 702 is used to determine the smooth label of the sample video based on the reference video frame boundary of the sample video. The smooth label is used to represent the degree of correlation between multiple video frames and the corresponding sample text.
[0188] The acquisition module 701 is used to acquire a first loss of the sample video based on the smoothing label, the prediction confidence information, the predicted video frame boundary and the reference video frame boundary of the sample video. The first loss is the prediction error of multiple video frames in the sample video.
[0189] Training module 703 is used to train a retrieval model for the second video time step based on the sample video if the first loss of the sample video meets the conditions.
[0190] In some embodiments, the determining module 702 is configured to, for any video frame in the sample video, if the video frame is determined to belong to a first boundary or a third boundary based on the frame number of the video frame, obtain a smoothing label for the video frame based on the Gaussian distribution function and the frame number of the video frame; if the video frame is determined to belong to a second boundary based on the frame number of the video frame, set the smoothing label of the video frame to a first value; if the video frame is determined not to belong to the first boundary, the second boundary, or the third boundary based on the frame number of the video frame, set the smoothing label of the video frame to a second value, wherein the first boundary, the second boundary, and the third boundary are obtained by blurring the boundaries of a reference video frame of the sample video.
[0191] In some embodiments, the acquisition module 701 includes:
[0192] The determination submodule is used to determine multiple first video frames and multiple second video frames from multiple video frames of the sample video based on the predicted video frame boundary of the sample video. The first video frames are video frames related to the corresponding sample text, and the second video frames are video frames unrelated to the corresponding sample text.
[0193] The first acquisition submodule is used to acquire the confidence loss of the plurality of first video frames and the confidence loss of the plurality of second video frames based on the smoothing label and the prediction confidence information of the sample video. The confidence loss is used to represent the error of the prediction confidence information.
[0194] The first acquisition submodule is used to acquire the regression loss of the plurality of first video frames based on the predicted video frame boundary and the reference video frame boundary of the sample video. The regression loss is used to represent the error of the predicted video frame boundary.
[0195] The first acquisition submodule is used to acquire the loss of the multiple first video frames based on the confidence loss and the regression loss of the multiple first video frames, and to use the confidence loss of the multiple second video frames as the loss of the multiple second video frames.
[0196] In some embodiments, the first acquisition submodule is configured to expand the predicted video frame boundary and the reference video frame boundary by a target number of frames respectively to obtain a predicted smooth boundary and a reference smooth boundary; based on the predicted smooth boundary and the reference smooth boundary, obtain a length loss, which represents the difference between the number of video frames within the predicted smooth boundary and the number of video frames within the reference smooth boundary; for any first video frame, based on the frame number of the first video frame, the predicted smooth boundary, and the reference smooth boundary, obtain a first distance and a second distance, where the first distance is the distance between the first video frame and the predicted smooth boundary, and the second distance is the distance between the first video frame and the reference smooth boundary; based on the first distance and the second distance, obtain an overlap loss, which represents the difference between the predicted smooth boundary and the reference smooth boundary; and based on the length loss and the overlap loss, obtain a regression loss for the first video frame.
[0197] In some embodiments, the training module 703 includes:
[0198] The second acquisition submodule is used to acquire the second loss of the sample video based on the first loss of the sample video, and the second loss is the global loss of the sample video;
[0199] The training submodule is used to train the retrieval model for the second video moment based on the sample video if the second loss of the sample video meets the conditions.
[0200] In some embodiments, the second acquisition submodule is configured to determine, based on the smoothing label of the sample video, a plurality of third video frames and a plurality of fourth video frames from a plurality of video frames of the sample video, wherein the third video frames are video frames related to the corresponding sample text and the fourth video frames are video frames unrelated to the corresponding sample text; and to acquire a second loss of the sample video based on the loss of the plurality of third video frames and the loss of the plurality of fourth video frames.
[0201] In some embodiments, the first training submodule is used to select the sample videos located at the previous target proportion as target sample videos according to the second loss of the plurality of sample videos in ascending order; and to train the second video moment retrieval model based on the target sample videos, the sample text corresponding to the target sample videos, and the reference video frame boundaries of the target sample videos.
[0202] In some embodiments, the video moment retrieval model includes: a text representation sub-model, a video representation sub-model, a multimodal fusion sub-model, a feature pyramid network, and a convolutional neural network;
[0203] The acquisition module 701 is used to extract features from the sample text corresponding to the sample video based on the text representation sub-model to obtain sample text features; extract features from the sample video based on the video representation sub-model to obtain sample video features; fuse the sample text features and the sample video features based on the multimodal fusion sub-model to obtain sample fusion features; perform multiple convolution and upsampling operations on the sample fusion features based on the feature pyramid network, and concatenate the data obtained based on the multiple convolution and upsampling operations to obtain sample concatenated features; map the sample concatenated features based on the convolutional neural network to obtain the prediction confidence information of the sample video; and obtain the predicted video frame boundaries of the sample video based on the prediction confidence information of the sample video.
[0204] In some embodiments, the acquisition module 701 is used to acquire target sample videos corresponding to multiple video moment retrieval models, wherein the first video moment retrieval model is any one of the multiple video moment retrieval models, and the second video moment retrieval model is any one of the multiple video moment retrieval models other than the first video moment retrieval model.
[0205] The training module 703 is used to train the first video moment retrieval model based on the target sample video corresponding to the second video moment retrieval model.
[0206] It should be noted that the training device for the video time-lapse retrieval model provided in the above embodiments is only illustrated by the division of the above functional modules when training the video time-lapse retrieval model. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the training device for the video time-lapse retrieval model provided in the above embodiments and the training method embodiments for the video time-lapse retrieval model belong to the same concept, and the specific implementation process is detailed in the method embodiments, which will not be repeated here.
[0207] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0208] The above are merely optional embodiments of this application and are not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A training method for a video moment retrieval model, characterized in that, The method includes: Based on the first video moment retrieval model, sample video and corresponding sample text, the prediction confidence information and prediction video frame boundaries of the sample video are obtained. The prediction confidence information is used to represent the correlation between multiple video frames in the sample video and the corresponding sample text, and the prediction video frame boundaries are used to represent the range of video frames corresponding to the sample text in the sample video. Based on the reference video frame boundaries of the sample video, a smoothing label is determined for the sample video. The smoothing label is used to represent the degree of correlation between multiple video frames and the corresponding sample text. Based on the smoothing label, prediction confidence information, prediction video frame boundary, and reference video frame boundary of the sample video, a first loss of the sample video is obtained, wherein the first loss is the prediction error of multiple video frames in the sample video. Based on the first loss of the sample video, a second loss of the sample video is obtained, which is the global loss of the sample video; if the second loss of the sample video meets the conditions, a second video time step retrieval model is trained based on the sample video.
2. The method according to claim 1, characterized in that, Determining the smoothing label of the sample video based on the reference video frame boundaries includes: For any video frame in the sample video, if the video frame is determined to belong to the first boundary or the third boundary based on the frame number of the video frame, the smooth label of the video frame is obtained based on the Gaussian distribution function and the frame number of the video frame. If, based on the frame number of the video frame, it is determined that the video frame belongs to the second boundary, the smoothing label of the video frame is set to the first value. If, based on the frame number of the video frame, it is determined that none of the video frames belong to the first boundary, the second boundary, or the third boundary, the smoothing label of the video frame is set to a second value. The first boundary, the second boundary, and the third boundary are obtained by blurring the boundaries of the reference video frames of the sample video.
3. The method according to claim 1, characterized in that, The first loss obtained from the sample video based on the smoothing label, the prediction confidence information, the predicted video frame boundary, and the reference video frame boundary includes: Based on the predicted video frame boundaries of the sample video, multiple first video frames and multiple second video frames are determined from multiple video frames of the sample video. The first video frames are video frames related to the corresponding sample text, and the second video frames are video frames unrelated to the corresponding sample text. Based on the smoothing labels and prediction confidence information of the sample videos, the confidence loss of the plurality of first video frames and the confidence loss of the plurality of second video frames are obtained, wherein the confidence loss is used to represent the error of the prediction confidence information; Based on the predicted video frame boundaries and the reference video frame boundaries of the sample video, the regression loss of the plurality of first video frames is obtained, and the regression loss is used to represent the error of the predicted video frame boundaries. Based on the confidence loss and regression loss of the plurality of first video frames, the loss of the plurality of first video frames is obtained, and the confidence loss of the plurality of second video frames is used as the loss of the plurality of second video frames.
4. The method according to claim 3, characterized in that, The regression loss for obtaining the plurality of first video frames based on the predicted video frame boundaries and the reference video frame boundaries of the sample video includes: The predicted video frame boundary and the reference video frame boundary are respectively expanded by the target frame number to obtain the predicted smooth boundary and the reference smooth boundary; Based on the predicted smoothing boundary and the reference smoothing boundary, a length loss is obtained, which is used to represent the difference between the number of video frames within the predicted smoothing boundary and the number of video frames within the reference smoothing boundary. For any first video frame, based on the frame number of the first video frame, the predicted smoothing boundary, and the reference smoothing boundary, a first distance and a second distance are obtained, where the first distance is the distance between the first video frame and the predicted smoothing boundary, and the second distance is the distance between the first video frame and the reference smoothing boundary. Based on the first distance and the second distance, an overlap loss is obtained, which is used to represent the difference between the predicted smooth boundary and the reference smooth boundary; The regression loss of the first video frame is obtained based on the length loss and the overlap loss.
5. The method according to claim 1, characterized in that, The process of obtaining the second loss of the sample video based on the first loss of the sample video includes: Based on the smoothing labels of the sample video, multiple third video frames and multiple fourth video frames are determined from multiple video frames of the sample video. The third video frames are video frames related to the corresponding sample text, and the fourth video frames are video frames unrelated to the corresponding sample text. Based on the losses of the plurality of third video frames and the plurality of fourth video frames, a second loss is obtained for the sample video.
6. The method according to claim 1, characterized in that, If the second loss of the sample video meets the conditions, training the second video time-lapse retrieval model based on the sample video includes: According to the second loss of the multiple sample videos in ascending order, the sample video located at the front target ratio is taken as the target sample video; The second video moment retrieval model is trained based on the target sample video, the sample text corresponding to the target sample video, and the reference video frame boundaries of the target sample video.
7. The method according to claim 1, characterized in that, The video moment retrieval model includes: a text representation sub-model, a video representation sub-model, a multimodal fusion sub-model, a feature pyramid network, and a convolutional neural network; The step of obtaining the prediction confidence information and prediction video frame boundaries of the sample video based on the retrieval model at the first video moment, the sample video, and the corresponding sample text includes: Based on the text representation sub-model, feature extraction is performed on the sample text corresponding to the sample video to obtain sample text features; Based on the video representation sub-model, feature extraction is performed on the sample video to obtain sample video features; Based on the multimodal fusion sub-model, the sample text features and the sample video features are fused to obtain sample fusion features; Based on the feature pyramid network, multiple convolution and upsampling operations are performed on the sample fusion features. The data obtained from the multiple convolution and upsampling operations are then concatenated to obtain the sample concatenation features. Based on the convolutional neural network, the splicing features of the samples are mapped to obtain the prediction confidence information of the sample video; Based on the prediction confidence information of the sample video, the predicted video frame boundaries of the sample video are obtained.
8. The method according to any one of claims 1 to 7, characterized in that, The method further includes: Obtain target sample videos corresponding to multiple video moment retrieval models, wherein the first video moment retrieval model is any one of the multiple video moment retrieval models, and the second video moment retrieval model is any one of the multiple video moment retrieval models other than the first video moment retrieval model. The first video moment retrieval model is trained based on the target sample video corresponding to the second video moment retrieval model.
9. A training device for a video moment retrieval model, characterized in that, The device includes: The acquisition module is used to retrieve the model, sample video and corresponding sample text based on the first video moment, and to acquire the prediction confidence information and prediction video frame boundaries of the sample video. The prediction confidence information is used to represent the correlation between multiple video frames in the sample video and the corresponding sample text, and the prediction video frame boundaries are used to represent the range of video frames corresponding to the sample text in the sample video. The determination module is used to determine the smoothing label of the sample video based on the reference video frame boundary of the sample video. The smoothing label is used to represent the degree of correlation between multiple video frames and the corresponding sample text. The acquisition module is used to acquire a first loss of the sample video based on the smoothing label, the prediction confidence information, the prediction video frame boundary, and the reference video frame boundary of the sample video. The first loss is the prediction error of multiple video frames in the sample video. The training module includes: a second acquisition submodule, used to acquire a second loss of the sample video based on a first loss of the sample video, wherein the second loss is the global loss of the sample video; and a training submodule, used to train a second video time-lapse retrieval model based on the sample video if the second loss of the sample video meets certain conditions.
10. The apparatus according to claim 9, characterized in that, The determining module is configured to, for any video frame in the sample video, if based on the frame number of the video frame, determine that the video frame belongs to a first boundary or a third boundary, and obtain a smoothing label of the video frame based on the Gaussian distribution function and the frame number of the video frame; if based on the frame number of the video frame, determine that the video frame belongs to a second boundary, and set the smoothing label of the video frame to a first value; if based on the frame number of the video frame, determine that the video frame does not belong to the first boundary, the second boundary, or the third boundary, and set the smoothing label of the video frame to a second value, wherein the first boundary, the second boundary, and the third boundary are obtained by blurring the boundaries of the reference video frame of the sample video.
11. The apparatus according to claim 9, characterized in that, The acquisition module includes: The determination submodule is used to determine multiple first video frames and multiple second video frames from multiple video frames of the sample video based on the predicted video frame boundaries of the sample video. The first video frames are video frames related to the corresponding sample text, and the second video frames are video frames unrelated to the corresponding sample text. The first acquisition submodule is used to acquire the confidence loss of the plurality of first video frames and the confidence loss of the plurality of second video frames based on the smoothing label and the prediction confidence information of the sample video, wherein the confidence loss is used to represent the error of the prediction confidence information; The first acquisition submodule is used to acquire the regression loss of the plurality of first video frames based on the predicted video frame boundary and the reference video frame boundary of the sample video, wherein the regression loss is used to represent the error of the predicted video frame boundary. The first acquisition submodule is used to acquire the loss of the plurality of first video frames based on the confidence loss and the regression loss of the plurality of first video frames, and to use the confidence loss of the plurality of second video frames as the loss of the plurality of second video frames.
12. The apparatus according to claim 11, characterized in that, The first acquisition submodule is configured to expand the predicted video frame boundary and the reference video frame boundary by a target number of frames respectively to obtain a predicted smooth boundary and a reference smooth boundary; based on the predicted smooth boundary and the reference smooth boundary, obtain a length loss, which represents the difference between the number of video frames within the predicted smooth boundary and the number of video frames within the reference smooth boundary; for any first video frame, based on the frame number of the first video frame, the predicted smooth boundary, and the reference smooth boundary, obtain a first distance and a second distance, where the first distance is the distance between the first video frame and the predicted smooth boundary, and the second distance is the distance between the first video frame and the reference smooth boundary; based on the first distance and the second distance, obtain an overlap loss, which represents the difference between the predicted smooth boundary and the reference smooth boundary; and based on the length loss and the overlap loss, obtain the regression loss of the first video frame.
13. The apparatus according to claim 9, characterized in that, The second acquisition submodule is used to determine multiple third video frames and multiple fourth video frames from multiple video frames of the sample video based on the smoothing labels of the sample video, wherein the third video frames are video frames related to the corresponding sample text, and the fourth video frames are video frames unrelated to the corresponding sample text; and to obtain a second loss of the sample video based on the loss of the multiple third video frames and the loss of the multiple fourth video frames.
14. The apparatus according to claim 9, characterized in that, The training submodule is used to select the sample videos located at the top target proportion as target sample videos according to the second loss of the plurality of sample videos in ascending order. The second video moment retrieval model is trained based on the target sample video, the sample text corresponding to the target sample video, and the reference video frame boundaries of the target sample video.
15. The apparatus according to claim 9, characterized in that, The video moment retrieval model includes: a text representation sub-model, a video representation sub-model, a multimodal fusion sub-model, a feature pyramid network, and a convolutional neural network; The acquisition module is used to: extract features from the sample text corresponding to the sample video based on the text representation sub-model to obtain sample text features; extract features from the sample video based on the video representation sub-model to obtain sample video features; fuse the sample text features and the sample video features based on the multimodal fusion sub-model to obtain sample fusion features; perform multiple convolution and upsampling operations on the sample fusion features based on the feature pyramid network, and concatenate the data obtained based on the multiple convolution and upsampling operations to obtain sample concatenated features; map the sample concatenated features based on the convolutional neural network to obtain the prediction confidence information of the sample video; and obtain the prediction video frame boundaries of the sample video based on the prediction confidence information of the sample video.
16. The apparatus according to any one of claims 9 to 15, characterized in that, The acquisition module is used to acquire target sample videos corresponding to multiple video moment retrieval models, wherein the first video moment retrieval model is any one of the multiple video moment retrieval models, and the second video moment retrieval model is any one of the multiple video moment retrieval models other than the first video moment retrieval model. The training module is used to train the first video moment retrieval model based on the target sample video corresponding to the second video moment retrieval model.
17. A computer device, characterized in that, The computer device includes a communication bus, at least one network interface, a memory, and at least one processor. The communication bus is used to transmit information between the above components. The at least one network interface is used to communicate with other devices or communication networks. The memory stores program code. The at least one processor implements the training method of any one of the video time-of-view retrieval models as described in claims 1-8 by reading and executing the program code stored in the memory.
18. A computer-readable storage medium, characterized in that, When the program code in the computer-readable storage medium is executed by the processor of the network element, the computer device is able to perform the training method of any of the video moment retrieval models as described in claims 1-8.
