Video semantic understanding model based on fine-grained hierarchical event features and generation method

Through the fine-grained hierarchical event feature model, combined with the visual encoder and BERT model, the fine-grained event features of the video frame are extracted and filtered, solving the problem of coarse-grained feature extraction and difficulty in long video understanding, and achieving efficient video semantic understanding.

CN118537861AActive Publication Date: 2024-08-23BEIJING INST OF TECH

Patent Information

Application Number
CN202410804488.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-21
Publication Date
2024-08-23
Estimated Expiration
2044-06-21

AI Technical Summary

Technical Problem

Existing video semantic understanding models use coarse-grained methods in feature extraction, resulting in low information utilization, and it is difficult to understand the detailed information in the video when processing long videos. Increasing the number of sampling frames will lead to excessive computational load.

Method used

Using a video semantic understanding model based on fine-grained hierarchical event features, through the visual encoder, pre-trained BERT model, event feature encoding layer and large language model, combined with the adaptive sliding window and multi-head cross-attention mechanism, video frames are extracted and filtered fine-grained event features, and reduce computational burden through similar frame fusion and image feature compression.

Benefits of technology

It improves the information density of video feature representation, reduces the number of feature tokens input to large language models, reduces the computational burden, and enhances the ability to understand long videos.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118537861A
    Figure CN118537861A
Patent Text Reader

Abstract

The method comprises a visual encoder, an image feature compressor, a pre-trained BERT model, an event feature coding layer and a large language model. The visual encoder encodes a video frame into a frame feature; the event feature coding layer extracts and screens event features; the event feature extractor extracts coupled fine-grained event features from a video through a self-adaptive sliding window, and the event feature perceptron screens related event features according to questions input by a user. According to the method, association between video frames is fully considered by using the hierarchically placed event feature extractor, and video information is coded into fine-grained hierarchical event features, so that the problem of coarse-grained feature extraction in an existing model is solved; the event feature perceptron is used for selecting features most relevant to user query from event features output by each layer of event feature extractor, the number of feature tokens of videos is greatly reduced, and the problem that long videos are difficult to understand is solved with the assistance of the similar frame fusion module and the image feature compressor.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of video understanding and deep learning technology, and in particular to a video semantic understanding model and a generation method based on fine-grained hierarchical event features. Background Art

[0002] The 21st century is a multimodal era. With the rapid development of social media, the Internet of Things and other digital technologies, the presentation of modern information has become increasingly diverse, covering multiple data modalities such as images, texts, and videos. Video, as an important part of multimodal data, transmits information in the form of dynamic and continuous image streams. It not only has significant temporal characteristics, but also contains rich context and emotional interaction characteristics. Video semantic understanding aims to enable the model to accurately identify and understand key elements such as objects, scenes and behaviors in the video, and to infer the deep meaning expressed by the video, so as to achieve a comprehensive interpretation of complex multimodal information. In today's world where digital media technology is constantly innovating, video has become an important medium for people to share information, express opinions and record their lives. Therefore, video semantic understanding is particularly critical in the current context. Mature video semantic understanding technology can not only optimize users' media experience, but also play a key role in education, security and entertainment. A complete video semantic understanding model can significantly improve users' production efficiency, save manpower and time costs, provide strong support for building an intelligent society, and show far-reaching research and application value.

[0003] Traditional video semantic understanding technologies usually focus on optimizing specific video analysis tasks, but lack the ability to comprehensively understand and flexibly respond to a wide range of information in videos. Although they have demonstrated excellent capabilities in specific tasks such as video question answering and video content retrieval, they are often unable to cope with complex scenes in the real world.

[0004] In recent years, large language models have achieved remarkable results in many fields such as text generation, summarization, translation, and question-answering. They not only show strong versatility, but also support interaction with users and can understand and follow users' specific instructions. Researchers have combined the language processing capabilities of large language models with the visual recognition capabilities of visual base models to design some video semantic understanding models based on large language models. These models mainly use end-to-end training methods, or use pre-trained components to convert video content into a form that can be effectively understood by large language models. These models can complete various video semantic understanding tasks in the form of dialogue, but there are still some problems when processing video information:

[0005] The first problem is coarse-grained feature extraction. Most models use coarse-grained video processing technology, and only align the video information extracted by the visual base model to the semantic space of the large language model through simple modules, which has a relatively low utilization rate of video information. For example, Video-ChatGPT proposed by Mazz et al. pools the video in spatial and temporal dimensions respectively, and then maps the extracted features to the feature space of the large language model through a simple linear layer; Valley proposed by Luo et al. obtains temporal features through a temporal modeling module composed of a single-layer Transformer and an average pooling layer, and aligns different modalities through a simple projection layer. These models fail to deeply consider the relationship between video frames, making it difficult for the large language model to understand the detailed information in the video.

[0006] The second problem is the difficulty in understanding long videos. Existing models usually uniformly sample a small number of frames from the video to represent the video content. For example, Video-LLaMA proposed by Zhang et al. only samples 8 frames of images from the video. This method is relatively effective when processing short videos of a few seconds, but when processing longer videos of minutes, it often loses key information, affecting the accuracy and completeness of the results. In order to reduce information loss, increasing the number of sampled frames seems to be an intuitive solution, but this will result in an excessive number of visual tokens input to the large language model, increasing the computational load of the model and the requirements for computing resources. Summary of the invention

[0007] In order to solve the problems of coarse-grained feature extraction and long video understanding difficulty in the existing video semantic understanding model based on a large language model, the present invention provides a video semantic understanding model based on fine-grained hierarchical event features and a generation method.

[0008] To achieve the above object, according to a first aspect of the present invention, a video semantic understanding model based on fine-grained hierarchical event features is proposed, comprising a visual encoder, a pre-trained BERT model, an event feature encoding layer and a large language model, wherein:

[0009] The pre-trained BERT model is used to encode textual questions. The encoded questions are called user queries.

[0010] A visual encoder, which encodes video frames into frame features;

[0011] The event feature encoding layer is used to extract and filter event features; it includes an event feature extractor and an event feature sensor; the event feature extractor extracts coupled fine-grained event features from the video through an adaptive sliding window, and the event feature sensor filters relevant event features based on the questions input by the user to improve the information density of the video feature representation.

[0012] Furthermore, it also includes a similar frame fusion module for fusing similar frames, reducing the total number of frame features and reducing the computational burden.

[0013] Furthermore, in the similar frame fusion module, the features of adjacent frames are merged by judging whether the cosine similarity between the features of adjacent frames exceeds a set similarity threshold.

[0014] Furthermore, it also includes an image feature compressor, which compresses the number of video frame features based on a multi-head cross-attention mechanism and adds temporal coding.

[0015] Furthermore, the image feature compressor includes a first multi-head cross-attention unit and a first feedforward unit connected in sequence, the first multi-head cross-attention unit is composed of a multi-head cross-attention layer connected in sequence, a residual connection and layer normalization; the first feedforward unit is composed of a feedforward network connected in sequence, a residual connection and layer normalization.

[0016] Furthermore, the event feature extractor includes a second multi-head self-attention unit, a second multi-head cross-attention unit and a second feedforward unit connected in sequence. The second multi-head self-attention unit is composed of a multi-head self-attention layer connected in sequence, a residual connection and a layer normalization; the second multi-head cross-attention unit is composed of a multi-head cross-attention layer connected in sequence, a residual connection and a layer normalization; the second feedforward unit is composed of a feedforward network connected in sequence, a residual connection and a layer normalization. The event feature extractor uses an adaptive sliding window to segment the video, and divides the video into coupled event features by fusing the features in the window unit; preferably, when the event feature extractor is multi-level, the input of the first-level event feature extractor is the video frame feature output by the image feature compressor, and starting from the second-level event feature extractor, its input is the output of the event feature extractor of the previous layer.

[0017] Furthermore, the event feature sensor includes a third multi-head self-attention unit, a third multi-head cross-attention unit, a differentiable Top-K module and a third feedforward unit connected in sequence, which filters the event features output by the event feature extractor according to the question input by the user; the third multi-head self-attention unit is composed of a multi-head self-attention layer connected in sequence, a residual connection and layer normalization; the third multi-head cross-attention unit is composed of a multi-head cross-attention layer connected in sequence, a residual connection and layer normalization; the third feedforward unit is composed of a feedforward network connected in sequence, a residual connection and layer normalization.

[0018] According to another aspect of the present invention, a method for generating a video semantic understanding model is proposed, which is characterized by comprising:

[0019] S1. Pre-training the video semantic understanding model based on fine-grained hierarchical event features;

[0020] S2. Fine-tune the video semantic understanding model based on fine-grained hierarchical event features.

[0021] Furthermore, both pre-training and fine-tuning include:

[0022] S11, uniformly sampling the video to obtain video frames; preferably, after uniform sampling, if the number of video frames is large, re-sampling the video frames according to a preset sampling threshold;

[0023] S12, encoding the video frame by a visual encoder to obtain a feature representation of the video frame; preferably, fusing similar video frame features by a similar frame fusion module;

[0024] S13, compressing the video frame features by an image feature compressor, and adding a temporal code to each video frame feature;

[0025] S14, extracting the first layer of event features from the video features output by S13 through an event feature extractor;

[0026] S15. The event feature sensor selects the event features most relevant to the user query from the first-layer event features, and injects the user query information into these event features; the user query is obtained by encoding the textual questions about the video content through the pre-trained BERT model;

[0027] S16, the event features output by the event feature encoding layer are concatenated with the embedded representation of the question about the video content through a linear layer and then input into the large language model, the model generates an answer to the question, and the overall parameters of the model are adjusted accordingly;

[0028] Preferably, the back propagation algorithm is used to adjust the parameters. In S1, the parameters of the image feature compressor, the event feature encoding layer and the linear layer are adjusted; in S2, the parameters of the image feature compressor, the BERT model, the event feature encoding layer and the linear layer are adjusted, and the parameters of the large language model are adjusted by the low-rank adaptive fine-tuning technique;

[0029] Preferably, the event feature coding layer is n layers, and S16 further includes:

[0030] (1) The output of the event feature extractor in the previous event feature encoding layer is used as the input of the current event feature encoding layer to obtain the event features output by the current layer;

[0031] (2) The event features output by the multi-layer event feature encoding layer are concatenated and input into the large language model after being concatenated with the embedded representation of the question about the video content through a linear layer. The model generates answers to the questions and adjusts the overall parameters of the model accordingly.

[0032] Furthermore, in S11, when the input is an image, the image is regarded as a video frame.

[0033] The video semantic understanding model and generation method based on fine-grained hierarchical event features provided by the present invention have the following beneficial effects compared with the existing video semantic understanding model and generation method:

[0034] (1) To address the problem of coarse-grained feature extraction in existing models, this paper proposes an event feature extractor that fully considers the association between video frames and encodes video information into fine-grained event features. At the same time, the hierarchical event feature extractor enables the event features output by different layers to capture event information across different time spans.

[0035] (2) In order to solve the problem of long video understanding difficulty in existing models, the present invention proposes an event feature sensor to filter the event features most relevant to the user query, which greatly reduces the number of feature tokens input into the large language model. At the same time, the present invention also proposes a similar frame fusion module and an image feature compressor to reduce the number and dimension of video frame features, further reducing the computational burden. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0037] Figure 1 A schematic diagram of the structure of a video semantic understanding model based on fine-grained hierarchical event features according to an embodiment of the present invention;

[0038] Figure 2 A schematic diagram of a flow chart of an image feature compressor according to an embodiment of the present invention;

[0039] Figure 3 A schematic diagram of a flow chart of an event feature extractor according to an embodiment of the present invention;

[0040] Figure 4 The figure is a flow chart of an event feature sensor according to an embodiment of the present invention.

[0041] Figure 5 A schematic diagram of instruction fine-tuning data according to an embodiment of the present invention;

[0042] Figure 6 The present invention is a flowchart of a method for generating a video semantic understanding model based on fine-grained hierarchical event features according to an embodiment of the present invention. DETAILED DESCRIPTION

[0043] 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.

[0044] The present invention provides a video semantic understanding model based on fine-grained hierarchical event features, the overall structure of which is as follows: Figure 1 As shown, it includes a visual encoder, a pre-trained BERT model, an event feature encoding layer, and a large language model.

[0045] The pre-trained BERT model is used to encode textual questions about the content of the video. The encoded questions are called user queries and are represented as .

[0046] The visual encoder is used to encode the video frame into frame features. In one embodiment, the Vision Transformer part of the EVA-CLIP model proposed by Fang et al. can be used. Assume that a video frame is , the frame feature obtained after encoding is expressed as In addition, the Vision Transformer model trained by other researchers can also be used as a visual encoder.

[0047] In one embodiment, in view of the fact that there may be some redundancy between the features of the encoded video frames, the present invention provides a similar frame fusion module for fusing similar frames, thereby reducing the total number of frame features and reducing the computational burden. For example, in one embodiment, the similar frame fusion module adopts a greedy strategy, by judging whether the cosine similarity between the features of adjacent frames exceeds a set similarity threshold. To merge the features of adjacent frames. Merging means taking the average of the features of two frames. and The cosine similarity between is defined as:

[0048]

[0049] After processing the video frames through the similar frame fusion module, the number of features of each video frame is usually still large. For example, according to the model parameter setting of the visual encoder used above, the number of video frame features is 257, which puts a lot of pressure on subsequent calculations. In order to solve this problem, the present invention also provides an image feature compressor based on a multi-head cross-attention mechanism, which is used to reduce the number of features of each video frame, thereby further reducing the computational burden. The image feature compressor includes a first multi-head cross-attention unit and a first feedforward unit connected in sequence. The first multi-head cross-attention unit is composed of a multi-head cross-attention unit connected in sequence, a residual connection and a layer normalization; the first feedforward unit is composed of a feedforward network connected in sequence, a residual connection and a layer normalization. Preferably, the feedforward network is two layers. Assume that the input video frame feature is , the image feature compressor compresses it and adds temporal coding to get the output Specifically, the processing flow of the image feature compressor is as follows: Figure 2 As shown, the following steps are included:

[0050] (1) Using a set of learnable query vectors Compressing input video frame features through the first multi-head criss-cross attention unit , and get the output At the input of the first multi-head criss-cross attention unit, Used to compute queries in the attention mechanism, Used to calculate keys and values. and denote the number and dimension of learnable queries, respectively, satisfying and , and Respectively The number of features and dimensions of the first multi-head cross attention unit is The construction of the multi-head cross attention layer is a prior art and will not be described in detail. Its parameters include a matrix for linearly transforming the input and a linear transformation matrix for combining the outputs of each attention head.

[0051] (2) Processing using the first feedforward unit , then add timing coding , and get the output .

[0052] The processing flow of the image feature compressor is expressed as:

[0053]

[0054]

[0055] Among them, MultiHead Cross Attention represents multi-head cross attention layer, LN represents layer normalization, and Feed Forward represents feedforward network.

[0056] Based on the view that video content is composed of a series of long-term or short-term events, the present invention provides an event feature coding layer to extract and filter event features of a certain time span. The event feature coding layer includes two parts: an event feature extractor and an event feature sensor. The event feature extractor extracts coupled fine-grained event features from the video through an adaptive sliding window, while the event feature sensor filters relevant event features according to the input question to improve the information density of the video feature representation. In one embodiment, the video semantic understanding model uses a multi-layer event feature coding layer to extract event features of different time spans. By using a hierarchical event feature coding layer, fine-grained coding and filtering of video information are completed, and event features with a small number and high information density are obtained, which realizes detailed understanding of long and short videos while having low computing requirements. The following is an example of a three-layer event feature coding layer.

[0057] The event feature extractor extracts higher-level event features based on the multi-head self-attention mechanism and the multi-head cross-attention mechanism. The input of the first-layer event feature extractor is the video frame features output by the image feature compressor. Starting from the second-layer event feature extractor, its input is the output of the previous layer event feature extractor. The three-layer event feature extractor uses a hierarchical adaptive sliding window to divide the video into window units spanning different time lengths, and subdivides the video into coupled event features by fusing the features within the window units. Compared with the coarse-grained method that directly fuses all frame features, the event feature extractor fuses similar video frames in a fine-grained manner, which can capture richer detail information. The event feature extractor includes a second multi-head self-attention unit, a second multi-head cross-attention unit, and a second feedforward unit connected in sequence. The second multi-head self-attention unit is composed of a multi-head self-attention layer connected in sequence, a residual connection and a layer normalization; the second multi-head cross attention unit is composed of a multi-head cross attention unit connected in sequence, a residual connection and a layer normalization; the second feedforward unit is composed of a feedforward network connected in sequence, a residual connection and a layer normalization, and the feedforward network is preferably composed of 2 layers. The processing flow of the event feature extractor is as follows Figure 3 As shown, the following steps are included:

[0058] (1) The input features are divided by sliding windows. The window size and sliding step size of each event feature encoding layer are set as:

[0059]

[0060]

[0061]

[0062] in, and Respectively represent The window size and sliding step size of the layer, Indicates The total number of input features of each layer. The size of each layer window is dynamically determined by the number of input features of this layer. Generally, the size of each layer window decreases. In the layer event feature extractor, the video frame features or event features after sliding window segmentation are expressed as , . Indicates The number of windows in the layer, and Respectively represent The number and dimensions of each input feature of the layer. Represents the set of real numbers and is a commonly used mathematical representation.

[0063] (2) For each window unit , flattening its dimensions to After that, through the second multi-head self-attention unit, the output is obtained The input of the second multi-head self-attention unit consists only of , used to calculate the query, key and value in the attention mechanism, the number of attention heads is The construction of the multi-head self-attention layer is a prior art and will not be described in detail. Its parameters include a matrix for linearly transforming the input and a linear transformation matrix for combining the outputs of each attention head.

[0064] (3) Using a set of learnable query vectors From each window unit through the second multi-head criss-cross attention unit Extract event features and get output In the input of the second multi-head cross attention unit, Used to compute queries in the attention mechanism, For calculating keys and values, the number of attention heads is .

[0065] (4) Processing using the second feedforward unit , and get the output , which will be expressed as . No. The output of the layer event feature extractor is expressed as .in, Indicates The number of event features at the first level, which is also The number of sliding windows.

[0066] The processing flow of the event feature extractor for each window unit is expressed as:

[0067]

[0068]

[0069]

[0070] Among them, MultiHead Self Attention represents multi-head self-attention layer, MultiHead CrossAttention represents multi-head cross attention layer, Fla represents dimension flattening, LN represents layer normalization, and Feed Forward represents feedforward network.

[0071] The event feature sensor includes a third multi-head self-attention unit, a third multi-head cross-attention unit, a differentiable Top-K module, and a third feedforward unit connected in sequence. The event feature sensor filters the event features output by the event feature extractor according to the question input by the user, ensuring that the extracted event features are highly relevant to the question, thereby significantly reducing the number of feature tokens in the video and making the model suitable for long video understanding scenarios. At the same time, the event feature sensor also injects user query information into the event features. Information, guide it to pay attention to context information. The third multi-head self-attention unit is composed of a multi-head self-attention layer connected in sequence, a residual connection and a layer normalization; the third multi-head cross attention unit is composed of a multi-head cross attention unit connected in sequence, a residual connection and a layer normalization; the third feedforward unit is composed of a feedforward network connected in sequence, a residual connection and a layer normalization, preferably, the feedforward network is 2 layers. The processing flow of the event feature sensor is as follows Figure 4 As shown, the following steps are included:

[0072] (1) For Output of the layer event feature extractor , flattening its dimensions to After that, the third multi-head self-attention unit is input to get the output The input of the third multi-head self-attention unit consists only of the flattened , used to calculate the query, key and value in the attention mechanism, the number of attention heads is .

[0073] (2) And the user query input third multi-head cross attention layer, get the output and attention score In the input of the third multi-head cross attention layer, Used to calculate the query in the attention mechanism. The user query is used to calculate the key and value. The number of attention heads is .

[0074] (3) Yes Perform residual connections and layer normalization in the third multi-head cross attention unit, and use the differentiable Top-K algorithm according to Filter the most relevant ones to the user's query Event features, and output .

[0075] (4) Processing using the third feedforward unit , and get the output .

[0076] The processing flow of the event feature sensor is expressed as:

[0077]

[0078]

[0079]

[0080]

[0081] Among them, Top-K represents the differentiable Top-K algorithm, MultiHead Self Attention represents the multi-head self-attention layer, MultiHead Cross Attention represents the multi-head cross attention layer, Fla represents dimension flattening, LN represents layer normalization, and Feed Forward represents the feedforward network.

[0082] The large language model uses the Vicuna-7B model, whose input includes the event features output by the multi-layer event feature encoding layer and the questions input by the user. Specifically, the filtered event features output by the multi-layer event feature encoding layer are concatenated, projected to the input space of the large language model through a linear layer, and then concatenated with the embedded representation of the question about the video content as the input of the large language model. The output of the large language model is the answer to the question.

[0083] According to another aspect of the present invention, a method for generating the above-mentioned video semantic understanding model is also provided. Figure 3 As shown, including:

[0084] S1. Pre-train the video semantic understanding model;

[0085] S2. Fine-tune the video semantic understanding model.

[0086] The video semantic understanding model based on fine-grained hierarchical event features is trained in two stages: pre-training and instruction fine-tuning. The main goal of the pre-training stage is to improve the model's ability to automatically extract event features from videos and map them to the feature space of a large language model. During the pre-training process, the input of the model is an image or video, and the target output is the title of the image or video. The instruction fine-tuning stage aims to align the visual space and the language space, and improve the model's ability to follow human instructions to complete various video content-based tasks. During the instruction fine-tuning process, the input of the model is videos and instructions in the form of questions, and the target output is the corresponding answer to the question. During training, pre-training is performed first, followed by instruction fine-tuning. Examples of instruction fine-tuning data are shown in Figure 2. Figure 5 In the figure, questions such as "What is the blonde woman doing?" are the input instructions, and answers such as "Fly a kite" are the target outputs of the model.

[0087] The pre-training dataset includes image-text pairs and video-text pairs, where the text is the title of the image or video; the instruction fine-tuning dataset includes video instruction data, where the instruction is a question about the content of the video. The following steps S11-S16 are performed on the respective datasets of the two stages to complete the training.

[0088] S11, uniformly sample the video, and obtain After uniform sampling, the number of video frames is large. For example, if the sampling rate is 1 frame per second, the number of video frames is large. In order to reduce the computational burden, the preset sampling threshold is used. The video frames are further resampled. After resampling, the video is represented as a collection of frames. ,in Indicates the number of video frames after sampling. It should be noted that in the pre-training stage, some inputs are images. At this time, the image is directly regarded as a video frame without any sampling operation. The image is represented as .

[0089] S12, encoding each video frame through a visual encoder , get the video frame features Preferably, if there are still many video frames, similar video frame features are fused through a similar frame fusion module, and the fused video features are expressed as .in, Indicates the number of frame features after fusion.

[0090] S13, compressing each video frame feature through an image feature compressor , and add temporal coding to each video frame feature to get the output The compressed video feature is expressed as .

[0091] S14, through the event feature extractor from Extract the first-level event features from .in, Indicates the number of first-level event features.

[0092] S15, from the first layer event features through the event feature sensor Screening and Most relevant event features , and inject user query information into these event features, so that event features pay more attention to information related to user queries. Represents the number of filtered event features. The pre-trained BERT model is used to encode questions about the video content in text form. The encoded questions are called user queries and are represented as , and shared among all layers. User query , Indicates the number of tokens queried by the user, Represents the feature dimension of the BERT model.

[0093] S16: Output the event features of the event feature encoding layer After passing through a linear layer and concatenating with the embedding representation of the question about the video content, it is input into the large language model. The model generates an answer to the question and adjusts the overall parameters of the model accordingly.

[0094] In one embodiment, the event feature coding layer may be multiple layers, and S16 further includes:

[0095] (1) The output of the event feature extractor in the previous event feature encoding layer is used as the input of the current event feature encoding layer to obtain the event features output by the current layer;

[0096] (2) The event features output by the multi-layer event feature encoding layer are concatenated through a linear layer and concatenated with the embedding representation of the question about the video content before being input into the large language model. The model generates answers to the questions and adjusts the overall model parameters accordingly.

[0097] For example, when the event feature coding layer is three layers, S16 also includes:

[0098] (1) The output of the event feature extractor in the first event feature encoding layer As the input of the second event feature encoding layer, the event features of the second layer output are obtained ; The output of the event feature extractor in the second event feature encoding layer As the input of the third event feature encoding layer, the event features of the third layer output are obtained .

[0099] (2) Concatenate the event features output by the first, second, and third event feature encoding layers , and , and then fed into a large language model after being concatenated with the embedding representation of the question about the video content through a linear layer. The model generates an answer to the question and adjusts the overall model parameters accordingly.

[0100] In step S11, the resampling strategy can be expressed as:

[0101]

[0102] The sampled video is represented as , . and They represent the height and width of the video frame respectively, and 3 represents the number of channels (the values ​​here are only examples and are not limiting).

[0103] In step S12, the video frame features , Represents the number of image blocks in Vision Transformer, represents the feature dimension, Represents the size of the image block. Features of each video frame after similar frames are fused .

[0104] In step S16, the large language model generates an answer to the question, calculates the loss value between the answer and the standard answer, and then uses the back propagation algorithm to adjust the parameters. Preferably, the back propagation algorithm is used to adjust the parameters. In S1, the parameters of the image feature compressor, the event feature encoding layer, and the linear layer are adjusted; in S2, the parameters of the image feature compressor, the BERT model, the event feature encoding layer, and the linear layer are adjusted, and the parameters of the large language model are adjusted by the low-rank adaptive fine-tuning technique.

[0105] The method for using the video semantic understanding model based on fine-grained hierarchical event features provided by the present invention is: inputting questions about the video content in the form of video and text, and obtaining answers to the questions through the video semantic understanding model.

[0106] Experimental verification:

[0107] After the entire model is trained through the above steps, the model is evaluated using three open zero-sample video semantic understanding benchmarks MSVD-QA, MSRVTT-QA and ActivityNet-QA, and compared with nine baseline models. The evaluation indicators include accuracy and score. The experimental results are shown in the following table. The bold in the table indicates the model with the highest indicator, and the underline indicates the model with the second highest indicator. It can be found that the video semantic understanding model based on fine-grained hierarchical event features provided by the present invention surpasses the existing optimal models on the three benchmarks, with accuracy improved by 2.2%, 6.7% and 2.4% respectively, and scores improved by 0.2, 0.3 and 0.1 respectively.

[0108]

Claims

1. A video semantic understanding model based on fine-grained hierarchical event features, It is characterized in that It includes visual encoder, pre-trained BERT model, event feature encoding layer, and large language model. The pre-trained BERT model is used to encode textual questions. The encoded questions are called user queries. A visual encoder, which encodes video frames into frame features; The event feature encoding layer is used to extract event features; it includes an event feature extractor and an event feature sensor; the event feature extractor extracts coupled fine-grained event features from the video through an adaptive sliding window, and the event feature sensor screens relevant event features according to the questions input by the user to improve the information density of the video feature representation.

2. The video semantic understanding model according to claim 1, It is characterized in that It also includes a similar frame fusion module for fusing similar frames, reducing the total number of frame features and reducing the computational burden.

3. The video semantic understanding model according to claim 2, It is characterized in that In the similar frame fusion module, the features of adjacent frames are merged by judging whether the cosine similarity between the features of adjacent frames exceeds the set similarity threshold.

4. The video semantic understanding model according to claim 1, It is characterized in that It also includes an image feature compressor, which compresses the number of video frame features based on a multi-head cross-attention mechanism and adds temporal coding.

5. The video semantic understanding model according to claim 4, It is characterized in that The image feature compressor includes a first multi-head cross-attention unit and a first feedforward unit connected in sequence, wherein the first multi-head cross-attention unit is composed of a multi-head cross-attention layer connected in sequence, a residual connection and a layer normalization; and the first feedforward unit is composed of a feedforward network connected in sequence, a residual connection and a layer normalization.

6. The video semantic understanding model according to claim 1, It is characterized in that The event feature extractor includes a second multi-head self-attention unit, a second multi-head cross-attention unit and a second feedforward unit connected in sequence. The second multi-head self-attention unit is composed of a multi-head self-attention layer connected in sequence, a residual connection and a layer normalization; the second multi-head cross-attention unit is composed of a multi-head cross-attention layer connected in sequence, a residual connection and a layer normalization; the second feedforward unit is composed of a feedforward network connected in sequence, a residual connection and a layer normalization, and the event feature extractor uses an adaptive sliding window to segment the video, and divides the video into coupled event features by fusing the features in the window unit; preferably, when the event feature extractor is multi-level, the input of the first-level event feature extractor is the video frame feature output by the image feature compressor, and starting from the second-level event feature extractor, its input is the output of the event feature extractor of the previous layer.

7. The video semantic understanding model according to claim 1, It is characterized in that The event feature sensor includes a third multi-head self-attention unit, a third multi-head cross-attention unit, a differentiable Top-K module and a third feedforward unit connected in sequence, and filters the event features output by the event feature extractor according to the question input by the user; The third multi-head self-attention unit is composed of sequentially connected multi-head self-attention layers, residual connections and layer normalization; the third multi-head cross-attention unit is composed of sequentially connected multi-head cross-attention layers, residual connections and layer normalization; the third feedforward unit is composed of sequentially connected feedforward networks, residual connections and layer normalization.

8. A method for generating a video semantic understanding model based on fine-grained hierarchical event features. It is characterized in that include: S1. Pre-training the video semantic understanding model based on fine-grained hierarchical event features; S2. Fine-tune the video semantic understanding model based on fine-grained hierarchical event features.

9. The generation method according to claim 8, It is characterized in that Both pre-training and fine-tuning include: S11, uniformly sampling the video to obtain video frames; preferably, after uniform sampling, if the number of video frames is large, re-sampling the video frames according to a preset sampling threshold; S12, encoding the video frame by a visual encoder to obtain a feature representation of the video frame; preferably, fusing similar video frame features by a similar frame fusion module; S13, compressing the video frame features by an image feature compressor, and adding a temporal code to each video frame feature; S14, extracting the first layer of event features from the video features output by S13 through an event feature extractor; S15. The event feature sensor selects the event features most relevant to the user query from the first-layer event features, and injects the user query information into these event features; the user query is obtained by encoding the textual questions about the video content through the pre-trained BERT model; S16, the event features output by the event feature encoding layer are concatenated with the embedded representation of the question about the video content through a linear layer and then input into the large language model, the model generates an answer to the question, and the overall parameters of the model are adjusted accordingly; Preferably, the back propagation algorithm is used to adjust the parameters. In S1, the parameters of the image feature compressor, the event feature encoding layer and the linear layer are adjusted; in S2, the parameters of the image feature compressor, the BERT model, the event feature encoding layer and the linear layer are adjusted, and the parameters of the large language model are adjusted by the low-rank adaptive fine-tuning technique; Preferably, the event feature coding layer is n layers, and S16 further includes: (1) The output of the event feature extractor in the previous event feature encoding layer is used as the input of the current event feature encoding layer to obtain the event features output by the current layer; (2) The event features output by the multi-layer event feature encoding layer are concatenated and input into the large language model after being concatenated with the embedded representation of the question about the video content through a linear layer. The model generates answers to the questions and adjusts the overall parameters of the model accordingly.

10. The generation method according to claim 9, It is characterized in that In S11, when the input is an image, the image is regarded as a video frame.

Citation Information

Patent Citations

  • Video description method based on advanced semantic information feature coding

    CN116091978A

  • Short video event detection method and system based on depth dynamic semantic association

    CN116503784A

  • Multimodal heterogeneous feature fusion-based compact video event description method

    WO2023050295A1

  • Alignment of 3D graphics extending beyond frame in augmented reality system with remote presentation

    WO2023205393A1

Cited By

  • Video-oriented event knowledge extraction method, system and equipment and medium

    CN119206573A

  • Long video understanding method and device, equipment and storage medium

    CN119380240A

  • A method, apparatus, device, and storage medium for long video understanding

    CN119380240B

  • Long video understanding method based on iterative hierarchical key frame selection

    CN119785258A

  • A long video understanding method based on iterative hierarchical key frame selection

    CN119785258B