Model training method, video positioning method, system, equipment, product and medium
By introducing visual and audio extended clips into video positioning and optimizing the video positioning model, the problem of insufficient event positioning accuracy caused by ignoring contextual information in traditional methods is solved, achieving higher accuracy and robustness.
Patent Information
- Application Number
- CN202410853496.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2044-06-28
AI Technical Summary
The traditional AVEL method ignores the relationship and contextual information between a visual segment and its adjacent or other segments in the same video in video positioning, resulting in a decrease in the accuracy of event positioning.
By obtaining training video data, we determine the visual expansion segments and audio expansion segments, and optimize the video positioning model to more comprehensively consider the continuity of events in time and space, and improve the accuracy and robustness of event positioning.
It effectively avoids the limitation of local information, enables the model to more comprehensively understand and analyze events in the video, and improves the accuracy and robustness of event location.
Smart Images

Figure CN118395196B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of video positioning, and in particular to a model training method, a video positioning method, a system, a device, a product and a medium. Background Art
[0002] In the traditional AVEL (Audio-Visual Event Localization) method, locating events often only relies on the currently analyzed visual segments, while ignoring the relationship and contextual information between these segments and other adjacent, separated or belonging to the same video.
[0003] Specifically, events usually continue or change in time and space. Only analyzing the feature information of a single segment and ignoring the association with adjacent segments or other segments in the same video will limit the complete understanding of the time and process of the event, resulting in the inability to obtain the contextual information of the event in the entire video sequence, which in turn leads to a decrease in the accuracy of event positioning. Summary of the invention
[0004] The purpose of the present invention is to provide a model training method, video positioning method, system, device, product and medium, which, by introducing extended segments, more comprehensively considers the continuity of events in time and space, effectively avoids the limitations of local information, enables the model to more comprehensively understand and analyze events in the video, and improves the accuracy and robustness of event positioning.
[0005] In order to solve the above technical problems, the present invention provides a model training method, comprising:
[0006] Acquire training video data, wherein the training video data includes a plurality of video clips, each of the video clips includes a visual clip and a plurality of audio clips;
[0007] Determine a visual extension segment corresponding to each visual segment according to the start time and the end time of each visual segment, wherein the visual extension segment includes the visual segment and the time length of the visual extension segment is greater than the time length of the visual segment;
[0008] Determine an audio extension segment corresponding to each audio segment according to the start time and the end time of each audio segment, wherein the audio extension segment includes the audio segment and the time length of the audio extension segment is greater than the time length of the audio segment;
[0009] The video positioning model is optimized according to the visual extension segment and the audio extension segment to obtain a target video positioning model, and the target video positioning model is used to locate the category label of the video data to be processed.
[0010] After obtaining the training video data, the following steps are also included:
[0011] Determine a first candidate set based on all the visual segments, and determine a second candidate set based on all the audio segments;
[0012] Determining a visual extension segment corresponding to each visual segment according to the start time and the end time of each visual segment includes:
[0013] Determine a visual extension segment corresponding to each visual segment from the first candidate set according to the start time and the end time of each visual segment;
[0014] Determining an audio extension segment corresponding to each audio segment according to the start time and the end time of each audio segment includes:
[0015] An audio extension segment corresponding to each audio segment is determined from the second candidate set according to the start time and the end time of each audio segment.
[0016] The step of determining a first candidate set according to all the visual segments and determining a second candidate set according to all the audio segments includes:
[0017] For each sub-segment, determining whether the sub-segment belongs to an event segment or a background segment, and whether the sub-segment is the visual segment or the audio segment;
[0018] Integrate or delete all the event segments and / or the background segments to obtain a j-th candidate set;
[0019] When the sub-segment is the visual segment, j is one; when the sub-segment is the audio segment, j is two.
[0020] For each sub-segment, determining whether the sub-segment belongs to an event segment or a background segment includes:
[0021] Acquire a sub-feature corresponding to each of the sub-segments, where the sub-feature is a visual feature or an audio feature;
[0022] According to the video-guided category label and each of the sub-features, using a category-independent attention branch, an attention value of each of the sub-features is calculated to obtain an attention sequence; the attention sequence represents the degree to which each of the sub-segments is independent of the video-guided category label;
[0023] Comparing the attention value of each of the sub-features with a preset threshold;
[0024] Determining that the sub-segment whose attention value of the sub-feature is less than the preset threshold belongs to the background segment;
[0025] It is determined that the sub-segment whose attention value of the sub-feature is not less than the preset threshold belongs to the event segment.
[0026] Wherein, all the event segments and / or the background segments are integrated or deleted to obtain the j-th candidate set, including:
[0027] Set time length threshold;
[0028] Determine whether there are a number of consecutive event segments whose time lengths are shorter than the time length threshold among all the event segments;
[0029] If yes, then a plurality of consecutive event segments whose time lengths are all less than the time length threshold are integrated;
[0030] The integrated event segments, other event segments whose time lengths are not less than the time length threshold, and the set of the background segments are taken as the j-th candidate set.
[0031] Wherein, for each sub-segment, after determining whether the sub-segment belongs to an event segment or a background segment, the method further includes:
[0032] Inputting each of the sub-segments into an initial classification model to obtain a first predicted category label for each of the sub-segments output by the initial classification model;
[0033] Optimizing the model parameters of the initial classification model according to the first predicted category label and the video guided category label to obtain a target classification model;
[0034] All the event segments and / or the background segments are integrated or deleted to obtain the jth candidate set, including:
[0035] Inputting all the event segments and / or the background segments into the target classification model to obtain a second predicted category label for each of the event segments and / or the background segments;
[0036] All the event segments and / or the background segments are integrated or deleted according to the second predicted category label to obtain the j-th candidate set.
[0037] The step of inputting each of the sub-segments into an initial classification model to obtain a first predicted category label for each of the sub-segments output by the initial classification model comprises:
[0038] Acquire a sub-feature corresponding to each of the sub-segments, where the sub-feature is a visual feature or an audio feature;
[0039] According to the video-guided category label and each of the sub-features, using a category-independent attention branch, an attention value of each of the sub-features is calculated to obtain an attention sequence; the attention sequence represents the degree to which each of the sub-segments is independent of the video-guided category label;
[0040] Based on the video-guided category label and each of the sub-segments, a category activation segment corresponding to the sub-feature is calculated through a category-related branch, wherein the category activation segment represents the correlation between the sub-segment and the video-guided category label;
[0041] determining a category suppression segment according to the attention sequence and the category activation segment;
[0042] The category label probability of each of the sub-segments is determined through a classification layer according to the category activation segment and the category inhibition segment.
[0043] Wherein, determining the category suppression segment according to the attention sequence and the category activation segment comprises:
[0044] The attention sequence and the category activation segment are multiplied to obtain the category inhibition segment.
[0045] After determining the category inhibition segment according to the attention sequence and the category activation segment, the method further includes:
[0046] Sorting the activation values in the category activation fragment, selecting k activation values with larger activation values, and obtaining the target category activation fragment;
[0047] Sorting the inhibition values in the category inhibition fragment, selecting k inhibition values with larger inhibition values, and obtaining the target category inhibition fragment;
[0048] Determining the category label probability of each of the sub-segments through a classification layer according to the category activation segment and the category inhibition segment, including:
[0049] The category label probability of each of the sub-segments is determined through a classification layer according to the target category activation segment and the target category inhibition segment.
[0050] The method of optimizing the model parameters of the initial classification model according to the first predicted category label and the video guided category label to obtain the target classification model includes:
[0051] constructing a first loss function according to the first predicted category label of each of the sub-segments and the video guided category label;
[0052] The parameters of the initial classification model are optimized according to the first loss function to obtain the target classification model.
[0053] Among them, the expression of the first loss function is:
[0054] ;
[0055] in, is the first loss function, C is the number of event segments, c is an integer not greater than C+1, the video-guided category labels corresponding to the category activation segments, a first predicted category label corresponding to the category activation segment, The video guidance category label corresponding to the category suppression segment, A first predicted category label corresponding to the category suppressed segment.
[0056] The step of optimizing the video positioning model according to the visual extension segment and the audio extension segment to obtain the target video positioning model includes:
[0057] In the process of optimizing the video positioning model according to the visual extension segment and the audio extension segment, determining whether a preset iteration end condition is met;
[0058] If so, the video positioning model that meets the preset iteration end condition is determined as the target video positioning model;
[0059] If not, the step of re-entering the step of calculating the category activation segment corresponding to the sub-feature through category-related branches based on the video-guided category label and each of the sub-segments.
[0060] The step of determining the visual extension segment corresponding to each visual segment according to the start time and end time of each visual segment, or determining the audio extension segment corresponding to each audio segment according to the start time and end time of each audio segment, includes:
[0061] Extend the start time of each sub-segment forward to obtain the start extension time;
[0062] Extending the end time of each sub-segment backward to obtain an end extension time;
[0063] Determine the sub-expansion segment according to the start expansion time and the end expansion time;
[0064] Among them, when the sub-segment is the visual segment, the sub-extended segment is the visual extended segment; when the sub-segment is the audio segment, the sub-extended segment is the audio extended segment.
[0065] The step of optimizing the video positioning model according to the visual extension segment and the audio extension segment to obtain the target video positioning model includes:
[0066] Acquire the first features of all the visual expansion segments to obtain a first feature sequence;
[0067] Acquire the second features of all the audio extension segments to obtain a second feature sequence;
[0068] Fusing the first feature sequence and the second feature sequence to obtain a fused visual feature sequence and a fused audio feature sequence;
[0069] Inputting the fused visual feature sequence and the fused audio feature sequence into the video localization model to obtain a second predicted category label;
[0070] Calculate a second loss function based on the second predicted category label and the video guided category label;
[0071] The parameters of the video positioning model are optimized according to the second loss function, and the video positioning model that meets the preset optimization conditions is determined as the target video positioning model.
[0072] The first feature sequence and the second feature sequence are fused to obtain a fused visual feature sequence and a fused audio feature sequence, including:
[0073] Performing a self-attention mechanism calculation and a cross-modal attention mechanism calculation on the first feature sequence according to the first feature sequence and the second feature sequence to obtain the fused visual feature sequence;
[0074] A self-attention mechanism calculation and a cross-modal attention mechanism calculation are performed on the second feature sequence according to the first feature sequence and the second feature sequence to obtain the fused audio feature sequence.
[0075] The first feature sequence and the second feature sequence are fused to obtain a fused visual feature sequence and a fused audio feature sequence, including:
[0076] The first feature sequence and the second feature sequence are fused according to a preset formula to obtain a fused visual feature sequence and a fused audio feature sequence;
[0077] The preset formula is: ;
[0078] in, is the i-th feature in the first feature sequence, is the i-th feature in the second feature sequence, f vis the first characteristic sequence, f a is the second characteristic sequence, T is the number of video clips, i is an integer not greater than T, , , g sa is the self-attention function, g ca is the cross-modal attention function, is the fused visual feature sequence, is the fused audio feature sequence, d is the scaling factor, softmax is the softmax function, is the first weight, is the second weight, for f a The transposed matrix of .
[0079] In order to solve the above technical problems, the present invention provides a video positioning method, comprising:
[0080] A to-be-processed data acquisition unit, which acquires to-be-processed video data, wherein the to-be-processed video data at least includes a to-be-processed video segment and a to-be-processed audio segment;
[0081] A label positioning unit, used for inputting the video data to be processed into a target video positioning model to obtain a category label of the video data to be processed;
[0082] The target video positioning model is obtained according to the model training method described above.
[0083] In order to solve the above technical problems, the present invention provides a model training system, comprising:
[0084] An acquisition unit, configured to acquire training video data, wherein the training video data includes a plurality of video segments, each of which includes a visual segment and a plurality of audio segments;
[0085] A visual expansion unit, configured to determine a visual expansion segment corresponding to each visual segment according to a start time and an end time of each visual segment, wherein the visual expansion segment includes the visual segment and a time length of the visual expansion segment is greater than a time length of the visual segment;
[0086] An audio extension unit, used to determine an audio extension segment corresponding to each audio segment according to the start time and the end time of each audio segment, wherein the audio extension segment includes the audio segment and the time length of the audio extension segment is greater than the time length of the audio segment;
[0087] The model optimization unit is used to optimize the video positioning model according to the visual extension segment and the audio extension segment to obtain a target video positioning model, and the target video positioning model is used to locate the category label of the video data to be processed.
[0088] In order to solve the above technical problems, the present invention provides an electronic device, comprising:
[0089] Memory for storing computer programs;
[0090] A processor is used to implement the steps of the above-mentioned model training method or the steps of the above-mentioned video positioning method when storing a computer program.
[0091] In order to solve the above technical problems, the present invention provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the above-mentioned model training method or the steps of the above-mentioned video positioning method.
[0092] In order to solve the above technical problems, the present invention provides a non-volatile storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned model training method or the steps of the above-mentioned video positioning method are implemented.
[0093] The present application provides a model training method, a video positioning method, a system, a device, a product and a medium, which relate to the field of video positioning and are used to solve the problem of insufficient accuracy of event positioning due to ignoring contextual information in traditional methods. The solution obtains training video data, determines the visual extension segment and the audio extension segment according to the start time and end time of each visual segment and audio segment, and optimizes the video positioning model according to the visual extension segment and the audio extension segment to obtain a target video positioning model; the video data to be processed is input into the target video positioning model to obtain the positioning label of the video data to be processed. By introducing extended segments, the continuity of events in time and space is more comprehensively considered, effectively avoiding the limitation of local information, so that the model can more comprehensively understand and analyze events in the video, and improve the accuracy and robustness of event positioning. BRIEF DESCRIPTION OF THE DRAWINGS
[0094] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0095] Figure 1 A flow chart of a model training method provided by the present invention;
[0096] Figure 2 A schematic diagram of the overall process of a model training method provided by the present invention;
[0097] Figure 3 A schematic diagram of a video positioning method provided by the present invention;
[0098] Figure 4 A schematic diagram of a video positioning system provided by the present invention;
[0099] Figure 5 A schematic diagram of an electronic device provided by the present invention;
[0100] Figure 6 A schematic diagram of a non-volatile storage medium provided by the present invention. DETAILED DESCRIPTION
[0101] The core of the present invention is to provide a model training method, video positioning method, system, equipment, product and medium. By introducing extended segments, the continuity of events in time and space is more comprehensively considered, effectively avoiding the limitations of local information, so that the model can more comprehensively understand and analyze events in the video, thereby improving the accuracy and robustness of event positioning.
[0102] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0103] To solve the above technical problems, Figure 1 As shown, the present invention provides a model training method, comprising:
[0104] S11: Acquire training video data, where the training video data includes a plurality of video clips, each of the video clips includes a visual clip and a plurality of audio clips;
[0105] Specifically, these training video data contain multiple video clips, each of which includes a visual clip and multiple audio clips. These clips can be understood as segments of the video, each of which has a specific start time and end time. The visual clip refers to the image content in the video, while the audio clip refers to the sound content in the video.
[0106] The process of obtaining training video data is to build an effective video localization model. Through this data, the relationship between different visual and audio clips and their temporal characteristics in the entire video can be learned. These clips can come from different videos, covering a variety of different scenes and situations, which can ensure that the model has a certain generalization ability and can adapt to different types and styles of video content.
[0107] During the training phase, these video clips may be annotated to indicate the specific event or activity type contained in each clip. This annotation is to train the model to accurately identify and locate specific events or activities in the video, making the subsequent video location process more accurate and reliable.
[0108] In a specific implementation, the video data S is obtained = (S A ,S V) , S A is the audio data, S V The video data S is visual data, the length of the video data S is N seconds, and the audio-visual data is divided into a plurality of non-overlapping audio-visual segments according to a preset division method. Preferably, the video data is divided into a plurality of video segments according to a preset time length. For example, the video segments are divided into 1 second segments, and the visual mode and the audio mode in each video segment are an audio-visual pair, and the video segments are obtained. , and the audiovisual event category label corresponding to the clip .like Figure 2 As shown, audio S A Sample at 44100HZ, convert the Mel spectrum, and use the VGGish network to extract audio features f i a , Video S V Images are acquired at 24 frames per second, and visual features are extracted using the I3D network.
[0109] In summary, the principle of this step is to use a large amount of training video data, including visual and audio clips, through machine learning and deep learning technology, so that the system can understand and learn the relationship between different clips, thereby establishing a powerful video localization model for accurately identifying and locating target events or activities in the video.
[0110] S12: determining a visual extension segment corresponding to each visual segment according to the start time and the end time of each visual segment, wherein the visual extension segment includes the visual segment and the time length of the visual extension segment is greater than the time length of the visual segment;
[0111] The principle and function of this step is to expand and enhance the contextual information of each visual segment, thereby improving the performance and accuracy of the video localization model. First of all, a visual segment refers to the image content in a short continuous period of time in a video. In practical applications, videos may be divided into different segments due to factors such as editing, clipping, or storage format. These segments may be too short, making it difficult for the model to accurately capture the complete context and background information of the events or activities contained in the segments.
[0112] Therefore, the key to this step is to determine the start and end time of each visual segment, and then find a longer visual extension segment for each segment. The time length of this extension segment is longer than the original visual segment, and can be a continuous video frame sequence that includes a certain period of time before and after the original segment. This extension allows the model to better understand and analyze the occurrence process and background environment of events or activities in the video.
[0113] By increasing the length of the visual extension segment, the model can better capture the temporal and spatial relationship of the event, improving the ability to understand and infer the video content. This processing method helps to reduce the shortcomings of the local features of a single segment and improve the overall video positioning model's recognition and positioning accuracy for complex events or actions.
[0114] In summary, this step generates more complete and rich visual information by extending the temporal range of each visual clip, providing more context and background information for the video localization model, thereby enhancing the performance and accuracy of the model, enabling it to more accurately identify and locate target events or activities in the video.
[0115] S13: determining an audio extension segment corresponding to each audio segment according to the start time and the end time of each audio segment, where the audio extension segment includes the audio segment and the time length of the audio extension segment is greater than the time length of the audio segment;
[0116] Similarly, in this step, the audio extension segment is similar to the audio segment, but its duration is longer than the duration of the original audio segment. The core purpose of this process is to increase the system's understanding and analysis capabilities of the audio content by extending the duration of the audio segment. In the context of video positioning, audio segments usually correspond to sound information in the video, such as dialogue, background music, or environmental sounds. Just as visual segments have their start and end times, audio segments also have specific timestamps. However, sometimes relying solely on the information in the original audio segment may not be enough to fully capture the full context and content of the event. Therefore, by extending the duration of the audio segment, audio information can be obtained over a wider time range, which helps to improve the overall understanding and positioning accuracy of events or activities in the video.
[0117] The generation of audio extension segments can be done in different ways, such as extending the original audio segment for a period of time or merging adjacent audio segments into a larger audio extension segment. This extension can be achieved through signal processing technology or specific audio processing algorithms to ensure that the extended segment still retains the semantic and contextual information related to the original audio segment, so as not to lose the original information and meaning.
[0118] In short, the principle of this step is to increase the system's ability to understand and analyze audio content by extending the length of the audio clip, thereby providing richer and more comprehensive audio information support for the subsequent video positioning model, so as to improve the accuracy of positioning and understanding of events or activities in the video.
[0119] S14: Optimize the video localization model according to the visual extension segment and the audio extension segment to obtain a target video localization model, which is used to locate the category label of the video data to be processed.
[0120] The process of optimizing the video localization model in this step involves further improving and adjusting the previously constructed model to improve its performance and effect in the video localization task.
[0121] First, the visual extension clips and audio extension clips obtained by steps S12 and S13 provide a more comprehensive perspective of the video data. These extension clips are longer than the original clips and contain more contextual information. In this step, these clips are used to optimize the video localization model, which involves using machine learning and deep learning techniques to further improve the learning and generalization capabilities of the model.
[0122] By leveraging the rich information in the visual extension clips and the audio extension clips, the video localization model can learn more visual and audio features. These features may involve visual features such as color, texture, and motion of the image, as well as audio features such as frequency, rhythm, and semantic content of the sound. Through effective feature learning, the model can more accurately understand and distinguish different video contents. Based on the visual and audio extension clips, the structure and parameters of the video localization model can be adjusted and optimized. This includes selecting a suitable model architecture (such as convolutional neural networks, recurrent neural networks, etc.), adjusting the network hierarchy, optimizing the loss function, etc. Through these steps, the model can better capture the spatiotemporal relationships and contextual information of events in the video during training and prediction.
[0123] Using longer visual and audio clips can enhance the generalization ability of the model, enabling it to handle video clips of various lengths and contents. This helps improve the model's performance on new video data and reduces the performance degradation caused by changes in video clips.
[0124] During the optimization process, the model needs to be evaluated and tuned. This includes using validation sets or cross-validation to evaluate the performance of the model, identifying and resolving possible problems with the model, such as overfitting or underfitting. Through continuous optimization and adjustment, the video positioning model can be ensured to have efficient and accurate performance in practical applications.
[0125] Furthermore, the trained video localization model is applied to analyze and classify new video data. First, the video data to be processed can be any video clips that need to be located for events or activities. These video clips may come from real-time streaming, recordings in storage devices, videos captured by surveillance cameras, etc. These data may contain a variety of scenes and dynamic events, such as traffic monitoring, sports games, social activities, etc.
[0126] The target video localization model has been trained and optimized in the above process, and it has the ability to identify and locate different events or activities. In this step, inputting the video data to be processed into the model means that the system will pass the video clip through the model's reasoning process. This reasoning process involves converting the video data into a data format that the model can understand and process, usually through the extraction and processing of image and audio features. The target video localization model analyzes various features in the video clip and determines the specific events or activities present in the video based on the knowledge and model parameters obtained from previous training.
[0127] Finally, the target video localization model will output one or more category labels, which represent the event type or activity type identified and located by the target video localization model. These labels can include various pre-defined event categories, such as "vehicle crossing a red light", "scoring action in a basketball game", etc. Through these labels, automatic analysis and classification of video content can be achieved, helping users to understand and process large amounts of video data more quickly.
[0128] Among them, the video localization model or the target video localization model can be a bimodal model based on the attention mechanism, such as ViLBERT (Vision-and-Language BERT, visual language pre-training model), LXMERT (Cross-ModalTransformer, cross-modal Transformer model), ERNIE-ViL (Knowledge Enhanced Vision-Language Representations, knowledge enhanced visual language representation model), etc.
[0129] In summary, this step uses the trained and optimized video positioning model to classify and label the new video data to be processed, so as to achieve accurate identification and positioning of video content, providing strong support and assistance for applications such as real-time monitoring and event detection.
[0130] In one embodiment, after obtaining the training video data, the method further includes:
[0131] Determine a first candidate set based on all visual clips, and determine a second candidate set based on all audio clips;
[0132] The visual extension segment corresponding to each visual segment is determined according to the start time and end time of each visual segment, including:
[0133] Determine the visual extension segment corresponding to each visual segment from the first candidate set according to the start time and the end time of each visual segment;
[0134] The audio extension segment corresponding to each audio segment is determined according to the start time and end time of each audio segment, including:
[0135] An audio extension segment corresponding to each audio segment is determined from the second candidate set according to the start time and the end time of each audio segment.
[0136] In this embodiment, firstly, all visual segments and audio segments are extracted from the training video data. Then, a first candidate set and a second candidate set are formed according to the segments. The two candidate sets respectively include multiple visual segments and audio segments, which represent candidates for potential events or activities extracted from the training data.
[0137] Further, for each visual segment and audio segment, a corresponding extended segment is determined according to its specific start time and end time. The visual extended segment is determined from the first candidate set according to the time range of the visual segment, and these extended segments may be longer than the time length of the original visual segment in order to contain more context information and relevant visual content.
[0138] Similarly, the audio extension segment is determined from the second candidate set according to the time range of the audio segment, and is also intended to extend the time length of the original audio segment to include more relevant audio features and background information.
[0139] The purpose of this process is to provide a more comprehensive and specific data foundation for subsequent model training and optimization through the formation of candidate sets and extended segments. These candidate sets and extended segments not only help the model better understand and capture the relationship between video and audio segments, but also improve the accuracy and generalization ability of the model in event location and classification tasks.
[0140] In one embodiment, determining a first candidate set according to all visual segments and determining a second candidate set according to all audio segments includes:
[0141] For each sub-clip, determining whether the sub-clip belongs to an event clip or a background clip, and whether the sub-clip is a visual clip or an audio clip;
[0142] Integrate or delete all event segments and / or background segments to obtain the jth candidate set;
[0143] When the sub-segment is a visual segment, j is one; when the sub-segment is an audio segment, j is two.
[0144] In this embodiment, all visual segments and audio segments are first extracted from the training video data. Then, for each segment, it is determined whether it belongs to an event segment or a background segment based on its content and features. Specifically, for a visual segment, it is evaluated whether it contains visual information related to the event, such as a specific action, object or scene, so as to determine whether it belongs to an event segment or a background segment. Similarly, for an audio segment, it is analyzed whether it contains sound signals or background noise related to the event, so as to determine whether it belongs to an event segment or a background segment.
[0145] After determining the event or background attributes of each clip, all event clips and / or background clips will be integrated or deleted according to these classification results to form the jth candidate set. The purpose of this process is to construct a more accurate and complete candidate set by effectively classifying and screening visual and audio clips. These candidate sets will serve as the basis for subsequent event localization model training. In this way, key events or activities in the video can be better identified and captured, and the accuracy and efficiency of event localization and classification can be improved.
[0146] In one embodiment, for each sub-segment, determining whether the sub-segment belongs to an event segment or a background segment includes:
[0147] Obtaining sub-features corresponding to each sub-segment, where the sub-features are visual features or audio features;
[0148] According to the video-guided category label and each sub-feature, the category-independent attention branch is used to calculate the attention value of each sub-feature to obtain an attention sequence; the attention sequence represents the degree to which each sub-segment is independent of the video-guided category label;
[0149] Compare the attention value of each sub-feature with a preset threshold;
[0150] Determine that a sub-segment whose attention value of a sub-feature is less than a preset threshold belongs to a background segment;
[0151] It is determined that the sub-segment whose attention value of the sub-feature is not less than a preset threshold belongs to the event segment.
[0152] In this embodiment, for each video sub-segment, the corresponding visual features or audio features are first obtained, which may include the color, texture, and motion information of the visual segment, and the frequency, sound intensity, etc. of the audio segment.
[0153] Next, using the video-guided category labels, which indicate predefined event or activity categories in the video, the system uses a category-agnostic attention branch to evaluate the importance or saliency of each sub-feature in the entire video by calculating an attention value for each sub-feature. This attention value represents the degree to which each sub-segment is independent of the video-guided category label, that is, its relative importance in the overall video content.
[0154] Then, the attention value of each sub-feature is compared with a preset threshold. If the attention value of a sub-feature is less than the preset threshold, the sub-segment is determined to be a background segment because it does not have significant event-related information in the entire video content. Conversely, if the attention value of the sub-feature is not less than the preset threshold, the sub-segment is determined to be an event segment because it is considered to have high event relevance in the video.
[0155] Among them, a preprocessing model can be used to obtain sub-features. For example, a CNN-based (Convolutional Neural Network based) model can be used to obtain visual features, such as an I3D (Interactive three dimensions) model, ResNet50, etc.; a VGGish model can be used to obtain audio features.
[0156] This embodiment uses the attention mechanism and the setting of preset thresholds to enable the system to automatically distinguish and classify event clips and background clips in the video, thereby providing an accurate data basis and reference basis for subsequent event location and classification tasks.
[0157] In one embodiment, all event segments and / or background segments are integrated or deleted to obtain the jth candidate set, including:
[0158] Set time length threshold;
[0159] Determine whether there are several consecutive event segments whose time lengths are less than the time length threshold in all event segments;
[0160] If so, several consecutive event segments whose time lengths are all less than the time length threshold are integrated;
[0161] The set of the integrated event segments, other event segments whose time length is not less than the time length threshold, and background segments is taken as the jth candidate set.
[0162] In this embodiment, a time length threshold is first set for all event segments and background segments, and the threshold is used to determine whether the duration of each event segment meets the set standard, so as to facilitate subsequent integration or deletion operations.
[0163] Then all event segments are checked to determine whether there are several consecutive event segments whose duration is less than the set duration threshold. If it is found that the duration of consecutive event segments is less than the threshold, these consecutive event segments are integrated. The integration process means merging these shorter event segments into a longer event segment, thereby reducing the number of fragmented event segments in the candidate set and improving the efficiency and accuracy of subsequent event location and classification.
[0164] At the same time, the unaffected single event clips with a time length greater than or equal to the time length threshold and the background clips are integrated into the jth candidate set. This set consists of the integrated event clips, single event clips with longer time lengths, and background clips, providing a clearer and more actionable data foundation for the subsequent video event location model training and evaluation.
[0165] The first candidate set includes the event candidate set P v event , Background Candidate Set P v bkg ,The final temporal candidate set in the training phase is expressed as,the first candidate set: P v = P v event + P v bkg , the second candidate set: P a = P a event + P a bkg When testing, you only need to P v event and P a event .
[0166] By setting time length thresholds and integration strategies for continuous event segments, the system can effectively optimize the structure of the candidate set, reduce noise and irrelevant information, and improve the accuracy and overall performance of event location.
[0167] In one embodiment, for each sub-segment, after determining whether the sub-segment belongs to an event segment or a background segment, the method further includes:
[0168] Input each sub-segment into an initial classification model to obtain a first predicted category label for each sub-segment output by the initial classification model;
[0169] Optimizing the model parameters of the initial classification model according to the first predicted category label and the video guided category label to obtain a target classification model;
[0170] All event segments and / or background segments are integrated or deleted to obtain the jth candidate set, including:
[0171] Inputting all event segments and / or background segments into a target classification model to obtain a second predicted category label for each event segment and / or background segment;
[0172] All event segments and / or background segments are integrated or deleted according to the second predicted category label to obtain the jth candidate set.
[0173] In this embodiment, first, for each video sub-segment, it is determined whether it belongs to an event segment or a background segment. Once the classification of the sub-segment is determined, each sub-segment is input into an initial classification model for processing. The initial classification model generates a first predicted category label based on the visual or audio features of the sub-segment, that is, the initial category that the initial classification model believes the sub-segment belongs to.
[0174] Next, based on these initial predicted category labels and video guided category labels, the model parameters of the initial classification model are optimized to generate a target classification model. This process may include adjusting the weights of the initial classification model, changing the structure of the new initial classification model, or selecting a feature representation method that is more suitable for the current task to improve the accuracy and robustness of the classification model in the video segment classification task.
[0175] All event segments and / or background segments are then fed into the optimized target classification model. The target classification model makes a second prediction for each segment, generating a second predicted class label. These labels indicate the final classification decision of the model for each segment after optimization.
[0176] Finally, all event segments and / or background segments are integrated or deleted according to the second predicted category label to obtain the jth candidate set. This set includes event segments and background segments determined according to the final classification decision of the model. Through such a screening and integration process, it is ensured that the segments in the candidate set are more representative and relevant, providing a more accurate and useful data basis for subsequent event positioning and further analysis.
[0177] It can be seen that this embodiment can combine preliminary classification and final optimization to effectively improve the classification precision and accuracy of video clips, thereby supporting more complex and sophisticated video content analysis and application requirements.
[0178] In one embodiment, each sub-segment is input into an initial classification model to obtain a first predicted category label for each sub-segment output by the initial classification model, including:
[0179] Obtaining sub-features corresponding to each sub-segment, where the sub-features are visual features or audio features;
[0180] According to the video-guided category label and each sub-feature, the category-independent attention branch is used to calculate the attention value of each sub-feature to obtain an attention sequence; the attention sequence represents the degree to which each sub-segment is independent of the video-guided category label;
[0181] Based on the video-guided category label and each sub-segment, the category activation segment corresponding to the sub-feature is calculated through the category-related branch, and the category activation segment represents the correlation between the sub-segment and the video-guided category label;
[0182] The category suppression episodes were determined based on the attention sequence and the category activation episodes;
[0183] The category label probability of each sub-segment is determined by the classification layer based on the category activation segment and the category suppression segment.
[0184] In one embodiment, determining a category suppression segment according to an attention sequence and a category activation segment includes: multiplying the attention sequence and the category activation segment to obtain the category suppression segment.
[0185] In this embodiment, for each video sub-segment, the system first obtains its corresponding visual features or audio features, which are used as inputs for the subsequent classification model. Then, the attention value of each sub-feature is calculated using the video-guided category label, i.e., the predefined video category information, and each sub-feature using a category-independent attention branch. These attention values constitute an attention sequence, which is used to indicate the degree of relevance of each sub-segment to the video-guided category label in the entire video.
[0186] Furthermore, the class activation segments corresponding to the sub-features are calculated by using the video-guided category labels and each sub-clip through the category-related branches. The class activation segments reflect the relevance of each sub-clip to the predefined video category, that is, how it is associated with the expected event or activity in terms of visual or audio features.
[0187] Subsequently, the category suppression segments are determined based on the attention sequence and the category activation segments. This step involves the multiplication of the attention sequence and the category activation segments. Through such a product operation, the obtained category suppression segments reflect the degree of suppression of each sub-segment for the predefined video category under the attention weighting.
[0188] Finally, with the help of the classification layer, the system can determine the category label probability of each sub-segment based on the category activation segment and category suppression segment. These probability values represent the possibility of the sub-segment being classified into different predefined video categories, helping the system to classify and label the video content more accurately.
[0189] Through the above steps, the attention mechanism and category-related feature activation are combined to effectively improve the accuracy and sophistication of video sub-segment classification, thereby supporting more complex and accurate video content analysis and application needs.
[0190] In one embodiment, after determining the category suppression segment according to the attention sequence and the category activation segment, the method further includes:
[0191] Sort the activation values in the category activation fragment, select k activation values with larger activation values, and obtain the target category activation fragment;
[0192] Sort the inhibition values in the category inhibition fragment, select k inhibition values with larger inhibition values, and obtain the target category inhibition fragment;
[0193] The category label probability of each sub-segment is determined through the classification layer according to the category activation segment and the category inhibition segment, including:
[0194] The category label probability of each sub-segment is determined by the classification layer based on the target category activation segment and the target category suppression segment.
[0195] In this embodiment, the activation values and inhibition values in each segment are first sorted according to the previously calculated class activation segments and class inhibition segments. These sorting operations are intended to identify key features with higher activation values and inhibition values in each segment, so as to further optimize the classification process.
[0196] Specifically, for the category activation segments, the top k values with the largest activation values are selected to form the target category activation segments. These selected activation values represent the feature parts of each sub-segment that are highly correlated with the predefined video category in terms of visual or audio features.
[0197] Similarly, for the category suppressed segments, the top k values with the largest suppression values are selected to form the target category suppressed segments. These selected suppression values reflect the feature parts of each sub-segment that are suppressed or irrelevant to the predefined video category in terms of visual or audio features.
[0198] Finally, after sorting and selecting the target category activation segments and target category suppression segments, the system uses these segments as input to calculate the category label probability of each sub-segment through the classification layer. This process comprehensively considers the activation and suppression levels of key features in the segment to more accurately predict and determine the probability that the sub-segment belongs to each predefined video category.
[0199] Through such a classification mechanism, it is possible to more accurately distinguish each sub-segment when analyzing and identifying video content, and provide a more reliable and efficient data processing basis for subsequent video event location and classification tasks.
[0200] In one embodiment, optimizing the model parameters of the initial classification model according to the first predicted category label and the video guided category label to obtain the target classification model includes:
[0201] constructing a first loss function according to the first predicted category label of each sub-segment and the video guided category label;
[0202] The parameters of the initial classification model are optimized according to the first loss function to obtain the target classification model.
[0203] In one embodiment, the expression of the first loss function is:
[0204] ;
[0205] in, is the first loss function, C is the number of event fragments, c is an integer not greater than C+1, The video-guided category labels corresponding to the category activation segments, is the first predicted category label corresponding to the category activation segment, The video-guided category labels corresponding to the category-suppressed segments, The first predicted category label corresponding to the category suppression segment.
[0206] In this embodiment, for each video sub-segment, a first predicted category label is generated by the initial classification model, which represents the model's initial guess as to which category each sub-segment belongs to. At the same time, the system also has predefined video guidance category labels to guide and determine the expected video category.
[0207] Next, a first loss function is constructed based on the first predicted category label of each sub-segment and the video guided category label. The purpose of designing this first loss function is to measure the gap or error between the predicted category of each sub-segment and the expected video category. Generally, this first loss function can take the form of a cross entropy loss function or other loss function suitable for classification tasks to quantify the difference between the predicted label and the true label.
[0208] Subsequently, the constructed first loss function is used to optimize the parameters of the initial classification model. The optimization process aims to adjust the weights and biases of the model to minimize the loss function so that the model can more accurately predict the category label of each sub-segment.
[0209] Finally, through this optimization process, the target classification model is obtained. Compared with the initial model, this target model has been adjusted and optimized according to the actual prediction and video guidance categories, making it more accurate and reliable when classifying video sub-segments. This method ensures that the model can more effectively identify and classify various types of video content in practical applications, thereby improving the performance and usability of the overall system.
[0210] In one embodiment, optimizing the video positioning model according to the visual extension segment and the audio extension segment to obtain the target video positioning model includes:
[0211] In the process of optimizing the video positioning model according to the visual extension clip and the audio extension clip, determining whether the preset iteration end condition is met;
[0212] If so, the video positioning model that meets the preset iteration end condition is determined as the target video positioning model;
[0213] If not, the step of re-entering the step of calculating the category activation segment corresponding to the sub-feature through the category-related branch based on the video-guided category label and each sub-segment is performed.
[0214] In this embodiment, the process of optimizing the video localization model involves iteratively training the model using visual extension segments and audio extension segments. In each iteration, the category activation segments corresponding to the sub-features are calculated using the category-related branches through the video-guided category label and each sub-segment. After each iteration, it is determined whether the current model meets the preset iteration end conditions. These conditions may include reaching a certain accuracy, the loss function value converges to a certain range, or reaching a predetermined number of iterations.
[0215] If the model meets the preset iteration end conditions, the current model will be determined as the target video positioning model, indicating that the model has reached the expected performance standard and completed the optimization process. If the conditions are not met, the calculation step of the category activation segment will be re-entered to continue the next round of iterative optimization.
[0216] Through this iterative optimization method, it is ensured that the video localization model can gradually improve its performance and accuracy, and finally a fully trained and optimized target video localization model is obtained, which is used to more accurately locate and classify video events.
[0217] In one embodiment, determining the visual extended segment corresponding to each visual segment according to the start time and the end time of each visual segment, or determining the audio extended segment corresponding to each audio segment according to the start time and the end time of each audio segment, includes:
[0218] Extend the start time of each sub-segment forward to obtain the start extension time;
[0219] Extend the end time of each sub-segment backward to obtain the end extension time;
[0220] Determine the sub-expansion segment according to the start expansion time and the end expansion time;
[0221] Among them, when the sub-clip is a visual clip, the sub-extended clip is a visual extended clip; when the sub-clip is an audio clip, the sub-extended clip is an audio extended clip.
[0222] In this embodiment, when processing a video segment, richer context information is obtained by extending the time range of each sub-segment to improve the accuracy and completeness of event location. Specifically, for each sub-segment (whether a visual segment or an audio segment), its start time and end time are first determined. Then, in order to generate an extended segment, the start time of each sub-segment is extended forward by a certain time length to obtain a new start extended time; at the same time, the end time is extended backward by a certain time length to obtain a new end extended time. Through this time extension method, the originally shorter sub-segment is extended to a sub-extended segment containing more context information.
[0223] For visual segments, this expansion process generates visually extended segments, i.e., visual content with a longer time range; for audio segments, it generates audio extended segments, i.e., audio content with more background and context. This expansion not only captures more information around each sub-segment, but also provides a more complete sequence of events or activities during model training and optimization.
[0224] For example, specifically, the candidate set corresponding to the i-th visual segment is , select The length is extended from front to back, that is, the candidate box time length is extended before the start time point and after the end time point, recorded as After connecting these three candidate sets, use the FC layer to fix the output dimension. , .
[0225] This design idea helps overcome the limitation of relying on a single clip for event location, because events usually have continuity and variability in time and space. By introducing extended clips, the system can better understand and capture the occurrence process and background information of events in the video, thereby significantly improving the accuracy and robustness of event location in subsequent model training, optimization and practical applications.
[0226] In general, this method can effectively improve the performance of the video localization model by expanding the time range forward and backward to generate extended segments containing more contextual information, helping the system to more accurately identify and classify various events and activities in the video.
[0227] In one embodiment, optimizing the video positioning model according to the visual extension segment and the audio extension segment to obtain the target video positioning model includes:
[0228] Obtain the first features of all visual expansion segments to obtain a first feature sequence;
[0229] Obtaining the second features of all audio extension segments to obtain a second feature sequence;
[0230] Fusing the first feature sequence and the second feature sequence to obtain a fused visual feature sequence and a fused audio feature sequence;
[0231] Inputting the fused visual feature sequence and the fused audio feature sequence into the video localization model to obtain a second predicted category label;
[0232] Calculate a second loss function based on the second predicted category label and the video guided category label;
[0233] The parameters of the video positioning model are optimized according to the second loss function, and the video positioning model that meets the preset optimization conditions is determined as the target video positioning model.
[0234] In this embodiment, the video localization model is first optimized by obtaining the features of all visual extension segments and audio extension segments, thereby obtaining a target video localization model. Specifically, the first feature is extracted from the visual extension segment to form a complete first feature sequence; at the same time, the second feature is extracted from the audio extension segment to form a second feature sequence. These feature sequences represent the temporal feature changes of the visual and audio content, respectively.
[0235] Next, the first feature sequence and the second feature sequence are fused. The fusion process can adopt a variety of methods, such as splicing, weighted averaging, or using a more complex fusion algorithm, the purpose of which is to combine the visual and audio features to obtain a fused visual feature sequence and a fused audio feature sequence. Through this fusion, the visual information and audio information in the video can be comprehensively considered to capture more comprehensive event features.
[0236] The fused visual feature sequence and audio feature sequence are then input into the video localization model, which generates a second predicted category label based on these fused feature sequences. The second predicted category label represents the model's latest prediction results for classifying the video clip, which are more accurate and comprehensive because they combine visual and audio information.
[0237] In order to optimize the model, a second loss function is calculated based on the second predicted category label and the video guided category label. The second loss function reflects the gap between the model prediction result and the actual category label. Usually, this loss function will take the form of cross entropy loss or other loss functions suitable for classification tasks to quantify the prediction error. In this embodiment, the first loss function and the second loss function take the same form.
[0238] Subsequently, the parameters of the video positioning model are optimized using the second loss function. The optimization process may involve optimization algorithms such as gradient descent, which minimize the loss function value by adjusting the model parameters, thereby improving the classification accuracy and robustness of the model. Finally, when the optimization process of the model parameters meets the preset optimization conditions, such as when the loss function value converges to a certain range or reaches a predetermined number of iterations, the video positioning model at this time is determined as the target video positioning model. This target video positioning model has been fully trained and optimized, and can more accurately locate and classify video events.
[0239] Through this method, visual and audio feature information are comprehensively utilized to iteratively optimize the video localization model, thereby improving the accuracy of event localization and the overall performance of the model.
[0240] In one embodiment, the first feature sequence and the second feature sequence are fused to obtain a fused visual feature sequence and a fused audio feature sequence, including:
[0241] According to the first feature sequence and the second feature sequence, a self-attention mechanism and a cross-modal attention mechanism are calculated on the first feature sequence to obtain a fused visual feature sequence;
[0242] According to the first feature sequence and the second feature sequence, a self-attention mechanism calculation and a cross-modal attention mechanism calculation are performed on the second feature sequence to obtain a fused audio feature sequence.
[0243] In one embodiment, the first feature sequence and the second feature sequence are fused to obtain a fused visual feature sequence and a fused audio feature sequence, including:
[0244] The first feature sequence and the second feature sequence are fused according to a preset formula to obtain a fused visual feature sequence and a fused audio feature sequence;
[0245] The default formula is: ;
[0246] in, is the i-th feature in the first feature sequence, is the i-th feature in the second feature sequence, f v is the first characteristic sequence, f a is the second characteristic sequence, T is the number of video clips, i is an integer not greater than T, , , g sa is the self-attention function, g ca is the cross-modal attention function, To fuse visual feature sequences, is the fused audio feature sequence, d is the scaling factor, softmax is the softmax function, is the first weight, is the second weight, for f a The transposed matrix of .
[0247] In this embodiment, a first feature sequence from the visual extension segment and a second feature sequence from the audio extension segment are first extracted and processed. In order to effectively fuse these feature sequences, a self-attention mechanism and a cross-modal attention mechanism are used, which are critical in processing and integrating information from different modalities.
[0248] The role of the self-attention mechanism is to enhance the correlation within each feature sequence. Specifically, the self-attention mechanism is calculated for the first feature sequence, which evaluates the relationship and importance of each element in the feature sequence to other elements in the sequence, thereby capturing the long-range dependencies and important patterns within the visual feature sequence. Similarly, the self-attention mechanism is calculated for the second feature sequence to enhance the correlation within the audio feature sequence, ensuring that the dynamic changes and important features of the audio features over time can be understood.
[0249] The cross-modal attention mechanism is used to fuse visual and audio features to ensure that information from two different modalities can reference and complement each other. The specific operation is to interact the first feature sequence with the second feature sequence, and calculate through the cross-modal attention mechanism to obtain a fused feature sequence. When processing the first feature sequence, the second feature sequence will be referenced to adjust and optimize the feature values in the first feature sequence, so as to obtain a more accurate and comprehensive fused visual feature sequence. Similarly, when processing the second feature sequence, the information of the first feature sequence will be referenced to adjust and optimize the second feature sequence to obtain a fused audio feature sequence.
[0250] By combining the self-attention mechanism and the cross-modal attention mechanism, the internal dependencies of visual and audio features can be effectively captured, while realizing information interaction and integration between the two modalities. This dual attention mechanism not only enhances the internal consistency of feature sequences, but also improves the complementarity of features of different modalities, ensuring that the system can utilize more information sources when processing and understanding video content, and improving the accuracy and robustness of overall video event positioning.
[0251] Finally, the fused visual feature sequence and the fused audio feature sequence will be input into the video localization model to further improve the model's ability to classify video clips and locate events. Through this complex but effective feature fusion method, the system can analyze video content more comprehensively and accurately, providing higher quality event localization results.
[0252] In general, the logic of this application is as follows Figure 2 As shown, first, visual data and audio data are obtained, and then multiple visual segments are obtained according to the visual data, and multiple audio segments are obtained according to the audio data. A multi-instance model is used to obtain the corresponding first candidate set and second candidate set, and the context extension module is used to expand the first candidate set and the second candidate set to obtain the expanded first candidate set and the second candidate set. Feature fusion is then performed and the sets are input into the classification layer for classification to obtain corresponding positioning labels, so as to train the video positioning model according to the positioning labels.
[0253] To solve the above technical problems, Figure 3 As shown, the present invention provides a video positioning method, comprising:
[0254] S31: Obtaining video data to be processed, where the video data to be processed at least includes a video segment to be processed and an audio segment to be processed;
[0255] S32: Input the video data to be processed into the target video positioning model to obtain the category label of the video data to be processed;
[0256] The target video positioning model is obtained according to the above-mentioned model training method.
[0257] To solve the above technical problems, Figure 4 As shown, the present invention provides a model training system, comprising:
[0258] An acquisition unit 31 is used to acquire training video data, where the training video data includes a plurality of video clips, each of which includes a visual clip and a plurality of audio clips;
[0259] A visual expansion unit 32, configured to determine a visual expansion segment corresponding to each visual segment according to a start time and an end time of each visual segment, wherein the visual expansion segment includes the visual segment and a time length of the visual expansion segment is greater than a time length of the visual segment;
[0260] An audio extension unit 33, configured to determine an audio extension segment corresponding to each audio segment according to a start time and an end time of each audio segment, wherein the audio extension segment includes the audio segment and a time length of the audio extension segment is greater than a time length of the audio segment;
[0261] The model optimization unit 34 is used to optimize the video positioning model according to the visual extension segment and the audio extension segment to obtain a target video positioning model, and the target video positioning model is used to locate the category label of the video data to be processed.
[0262] For the description of the model training system, please refer to the above embodiments, and this application will not go into details here.
[0263] In order to solve the above technical problems, the present invention provides a video positioning system, comprising:
[0264] A to-be-processed video data acquisition unit, used to acquire the to-be-processed video data, where the to-be-processed video data at least includes a to-be-processed video segment and a to-be-processed audio segment;
[0265] A label positioning unit, used for inputting the video data to be processed into the target video positioning model to obtain the category label of the video data to be processed;
[0266] The target video positioning model is obtained according to the above-mentioned model training method.
[0267] For the description of the video positioning system, please refer to the above embodiments, and this application will not go into details here.
[0268] To solve the above technical problems, Figure 5 As shown, the present application also provides an electronic device, including:
[0269] A memory 41, used for storing computer programs;
[0270] The processor 42 is used to implement the steps of the above-mentioned model training method or the steps of the above-mentioned video positioning method when storing the computer program.
[0271] For the description of the electronic device, please refer to the above embodiments, and this application will not go into details here.
[0272] To solve the above technical problems, the present application also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the above model training method or the steps of the above video positioning method.
[0273] For the description of the computer program product, please refer to the above embodiments, and this application will not go into details here.
[0274] To solve the above technical problems, Figure 6 As shown, the present invention provides a non-volatile storage medium 51, on which a computer program 52 is stored. When the computer program 52 is executed by a processor, the steps of the above-mentioned model training method or the steps of the above-mentioned video positioning method are implemented.
[0275] For the description of the non-volatile storage medium 51 , please refer to the above-mentioned embodiment, and this application will not go into details here.
[0276] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0277] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A model training method, characterized in that: include: Acquire training video data, wherein the training video data includes a plurality of video clips, each of the video clips includes a visual clip and a plurality of audio clips; Determine a visual extension segment corresponding to each visual segment according to the start time and the end time of each visual segment, wherein the visual extension segment includes the visual segment and the time length of the visual extension segment is greater than the time length of the visual segment; Determine an audio extension segment corresponding to each audio segment according to the start time and the end time of each audio segment, wherein the audio extension segment includes the audio segment and the time length of the audio extension segment is greater than the time length of the audio segment; Optimizing the video positioning model according to the visual extension segment and the audio extension segment to obtain a target video positioning model, wherein the target video positioning model is used to perform category label positioning on the video data to be processed; After obtaining the training video data, it also includes: Determine a first candidate set based on all the visual segments, and determine a second candidate set based on all the audio segments; Determining a visual extension segment corresponding to each visual segment according to the start time and the end time of each visual segment includes: Determine a visual extension segment corresponding to each visual segment from the first candidate set according to the start time and the end time of each visual segment; Determining an audio extension segment corresponding to each audio segment according to the start time and the end time of each audio segment includes: Determine an audio extension segment corresponding to each audio segment from the second candidate set according to the start time and the end time of each audio segment; Determining a first candidate set according to all the visual segments, and determining a second candidate set according to all the audio segments, comprises: For each sub-segment, determining whether the sub-segment belongs to an event segment or a background segment, and whether the sub-segment is the visual segment or the audio segment; Integrate or delete all the event segments and / or the background segments to obtain a j-th candidate set; Wherein, when the sub-segment is the visual segment, j is 1; when the sub-segment is the audio segment, j is 2; For each sub-segment, after determining whether the sub-segment belongs to an event segment or a background segment, the method further includes: Inputting each of the sub-segments into an initial classification model to obtain a first predicted category label for each of the sub-segments output by the initial classification model; Optimizing the model parameters of the initial classification model according to the first predicted category label and the video guided category label to obtain a target classification model; All the event segments and / or the background segments are integrated or deleted to obtain the jth candidate set, including: Inputting all the event segments and / or the background segments into the target classification model to obtain a second predicted category label for each of the event segments and / or the background segments; All the event segments and / or the background segments are integrated or deleted according to the second predicted category label to obtain the j-th candidate set.
2. The model training method according to claim 1, characterized in that: For each sub-segment, determining whether the sub-segment belongs to an event segment or a background segment includes: Acquire a sub-feature corresponding to each of the sub-segments, where the sub-feature is a visual feature or an audio feature; According to the video-guided category label and each of the sub-features, using a category-independent attention branch, an attention value of each of the sub-features is calculated to obtain an attention sequence; the attention sequence represents the degree to which each of the sub-segments is independent of the video-guided category label; Comparing the attention value of each of the sub-features with a preset threshold; Determining that the sub-segment whose attention value of the sub-feature is less than the preset threshold belongs to the background segment; It is determined that the sub-segment whose attention value of the sub-feature is not less than the preset threshold belongs to the event segment.
3. The model training method according to claim 1, characterized in that: All the event segments and / or the background segments are integrated or deleted to obtain the jth candidate set, including: Set time length threshold; Determine whether there are a number of consecutive event segments whose time lengths are shorter than the time length threshold among all the event segments; If yes, then a plurality of consecutive event segments whose time lengths are all less than the time length threshold are integrated; The integrated event segments, other event segments whose time lengths are not less than the time length threshold, and the set of the background segments are taken as the j-th candidate set.
4. The model training method according to claim 1, characterized in that: Inputting each of the sub-segments into an initial classification model to obtain a first predicted category label for each of the sub-segments output by the initial classification model, comprising: Acquire a sub-feature corresponding to each of the sub-segments, where the sub-feature is a visual feature or an audio feature; According to the video-guided category label and each of the sub-features, using a category-independent attention branch, an attention value of each of the sub-features is calculated to obtain an attention sequence; the attention sequence represents the degree to which each of the sub-segments is independent of the video-guided category label; Based on the video-guided category label and each of the sub-segments, a category activation segment corresponding to the sub-feature is calculated through a category-related branch, wherein the category activation segment represents the correlation between the sub-segment and the video-guided category label; determining a category suppression segment according to the attention sequence and the category activation segment; The category label probability of each of the sub-segments is determined through a classification layer according to the category activation segment and the category inhibition segment, and the corresponding first predicted category label is determined according to the category label probability of each of the sub-segments.
5. The model training method according to claim 4, characterized in that: Determining a category suppression segment according to the attention sequence and the category activation segment includes: The attention sequence and the category activation segment are multiplied to obtain the category inhibition segment.
6. The model training method according to claim 4, characterized in that: After determining the category inhibition segment according to the attention sequence and the category activation segment, the method further includes: Sorting the activation values in the category activation fragment, selecting k activation values with larger activation values, and obtaining the target category activation fragment; Sorting the inhibition values in the category inhibition fragment, selecting k inhibition values with larger inhibition values, and obtaining the target category inhibition fragment; Determining the category label probability of each of the sub-segments through a classification layer according to the category activation segment and the category inhibition segment, including: The category label probability of each of the sub-segments is determined through a classification layer according to the target category activation segment and the target category inhibition segment.
7. The model training method according to claim 4, characterized in that: Optimizing the model parameters of the initial classification model according to the first predicted category label and the video guided category label to obtain a target classification model, including: constructing a first loss function according to the first predicted category label of each of the sub-segments and the video guided category label; The parameters of the initial classification model are optimized according to the first loss function to obtain the target classification model.
8. The model training method according to claim 7, characterized in that: The expression of the first loss function is: in, is the first loss function, C is the number of event segments, c is an integer not greater than C+1, the video-guided category labels corresponding to the category activation segments, a first predicted category label corresponding to the category activation segment, The video guidance category label corresponding to the category suppression segment, A first predicted category label corresponding to the category suppressed segment.
9. The model training method according to claim 4, characterized in that: Optimizing the video positioning model according to the visual extension segment and the audio extension segment to obtain a target video positioning model includes: In the process of optimizing the video positioning model according to the visual extension segment and the audio extension segment, determining whether a preset iteration end condition is met; If so, the video positioning model that meets the preset iteration end condition is determined as the target video positioning model; If not, the step of re-entering the step of calculating the category activation segment corresponding to the sub-feature through category-related branches based on the video-guided category label and each of the sub-segments.
10. The model training method according to claim 1, characterized in that: Determining a visual extension segment corresponding to each visual segment according to the start time and the end time of each visual segment, or determining an audio extension segment corresponding to each audio segment according to the start time and the end time of each audio segment, including: Extend the start time of each sub-segment forward to obtain the start extension time; Extending the end time of each sub-segment backward to obtain an end extension time; Determine the sub-expansion segment according to the start expansion time and the end expansion time; Among them, when the sub-segment is the visual segment, the sub-extended segment is the visual extended segment; when the sub-segment is the audio segment, the sub-extended segment is the audio extended segment.
11. The model training method according to any one of claims 1 to 10, characterized in that: Optimizing the video positioning model according to the visual extension segment and the audio extension segment to obtain a target video positioning model includes: Acquire the first features of all the visual expansion segments to obtain a first feature sequence; Acquire the second features of all the audio extension segments to obtain a second feature sequence; Fusing the first feature sequence and the second feature sequence to obtain a fused visual feature sequence and a fused audio feature sequence; Inputting the fused visual feature sequence and the fused audio feature sequence into the video localization model to obtain a second predicted category label; Calculate a second loss function based on the second predicted category label and the video guided category label; The parameters of the video positioning model are optimized according to the second loss function, and the video positioning model that meets the preset optimization conditions is determined as the target video positioning model.
12. The model training method according to claim 11, characterized in that: The first feature sequence and the second feature sequence are fused to obtain a fused visual feature sequence and a fused audio feature sequence, including: Performing a self-attention mechanism calculation and a cross-modal attention mechanism calculation on the first feature sequence according to the first feature sequence and the second feature sequence to obtain the fused visual feature sequence; A self-attention mechanism calculation and a cross-modal attention mechanism calculation are performed on the second feature sequence according to the first feature sequence and the second feature sequence to obtain the fused audio feature sequence.
13. The model training method according to claim 12, characterized in that: The first feature sequence and the second feature sequence are fused to obtain a fused visual feature sequence and a fused audio feature sequence, including: The first feature sequence and the second feature sequence are fused according to a preset formula to obtain a fused visual feature sequence and a fused audio feature sequence; The preset formula is: in, is the i-th feature in the first feature sequence, is the i-th feature in the second feature sequence, f v is the first characteristic sequence, f a is the second feature sequence, T is the number of video clips, i is an integer not greater than T, g sa is the self-attention function, g ca is the cross-modal attention function, is the fused visual feature sequence, is the fused audio feature sequence, d is the scaling factor, softmax is the softmax function, is the first weight, is the second weight, f′ a f a The transposed matrix of .
14. A video positioning method, characterized in that: include: Acquire video data to be processed, where the video data to be processed at least includes a video segment to be processed and an audio segment to be processed; Inputting the video data to be processed into a target video positioning model to obtain a category label of the video data to be processed; The target video positioning model is obtained according to the model training method according to any one of claims 1-13.
15. A model training system, characterized in that: include: An acquisition unit, configured to acquire training video data, wherein the training video data includes a plurality of video segments, each of which includes a visual segment and a plurality of audio segments; A visual expansion unit, configured to determine a visual expansion segment corresponding to each visual segment according to a start time and an end time of each visual segment, wherein the visual expansion segment includes the visual segment and a time length of the visual expansion segment is greater than a time length of the visual segment; An audio extension unit, used to determine an audio extension segment corresponding to each audio segment according to the start time and the end time of each audio segment, wherein the audio extension segment includes the audio segment and the time length of the audio extension segment is greater than the time length of the audio segment; A model optimization unit, configured to optimize a video positioning model according to the visual extension segment and the audio extension segment to obtain a target video positioning model, wherein the target video positioning model is used to perform category label positioning on the video data to be processed; The model training system is further used to, after acquiring the training video data, determine a first candidate set according to all the visual segments, and determine a second candidate set according to all the audio segments; The visual expansion unit is specifically configured to determine a visual expansion segment corresponding to each visual segment from the first candidate set according to a start time and an end time of each visual segment; The audio extension unit is specifically configured to determine an audio extension segment corresponding to each audio segment from the second candidate set according to a start time and an end time of each audio segment; Determining a first candidate set according to all the visual segments, and determining a second candidate set according to all the audio segments, comprises: For each sub-segment, determining whether the sub-segment belongs to an event segment or a background segment, and whether the sub-segment is the visual segment or the audio segment; Integrate or delete all the event segments and / or the background segments to obtain a j-th candidate set; Wherein, when the sub-segment is the visual segment, j is 1; when the sub-segment is the audio segment, j is 2; For each sub-segment, after determining whether the sub-segment belongs to an event segment or a background segment, the method further includes: Inputting each of the sub-segments into an initial classification model to obtain a first predicted category label for each of the sub-segments output by the initial classification model; Optimizing the model parameters of the initial classification model according to the first predicted category label and the video guided category label to obtain a target classification model; All the event segments and / or the background segments are integrated or deleted to obtain the jth candidate set, including: Inputting all the event segments and / or the background segments into the target classification model to obtain a second predicted category label for each of the event segments and / or the background segments; All the event segments and / or the background segments are integrated or deleted according to the second predicted category label to obtain the j-th candidate set.
16. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, used to implement the steps of the model training method described in any one of claims 1 to 13 or the steps of the video positioning method described in claim 14 when storing a computer program.
17. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instruction is executed by a processor, the steps of the model training method described in any one of claims 1 to 13 or the steps of the video positioning method described in claim 14 are implemented.
18. A non-volatile storage medium, characterized in that: The non-volatile storage medium stores a computer program, and when the computer program is executed by the processor, the steps of the model training method described in any one of claims 1 to 13 or the steps of the video positioning method described in claim 14 are implemented.
