Video processing method and device based on multi-modal large model, equipment and medium

Extracting and splicing video features through multiple video encoders and fusion structures solves the problem of concise text output from multi-modal large models and achieves more accurate description of video details.

CN118779491APending Publication Date: 2024-10-15HISENSE GRP HLDG CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410881385.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-02
Publication Date
2024-10-15

AI Technical Summary

Technical Problem

The text output by existing multi-modal large models during video understanding is too simple and difficult to describe the detailed information of the video.

Method used

Multiple video encoders are used to extract video features, and the initial video feature matrix is ​​spliced ​​and mapped into a target video feature matrix through a fusion structure to enhance video detail description capabilities.

Benefits of technology

It improves the quality of text output by multi-modal large models during video understanding, enhances the ability to describe video details, and can describe video content more accurately.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118779491A_ABST
    Figure CN118779491A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data processing, in particular to a video processing method and device based on a multi-modal large model, equipment and a medium, in the embodiment of the invention, the multi-modal large model comprises a fusion structure, a language large model and at least two video encoders, according to the method, at least two video encoders are adopted to extract initial video features of a target video, and a fusion structure is adopted to fuse the initial video features of the plurality of video encoders to obtain target video features, so that refined extraction of the video features is realized, and the multi-modal large model video detail description capability is enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a video processing method, device, equipment and medium based on a multimodal large model. Background Art

[0002] The video understanding multimodal large model is a visual language multimodal large model composed of a video encoder and a large language model. It can be used to process video understanding tasks such as video description, video question and answer, video classification, video retrieval, and video temporal positioning. After the video is input into the video understanding multimodal large model, the video input is first mapped into a set of feature vectors through the video encoder, and then the text prompt words and video feature vectors are input into the large language model together. Finally, the corresponding text is generated according to different tasks. For example, video description generates detailed description text, and video question and answer generates answers to text questions.

[0003] Although large multimodal models for video understanding have made some progress in the industry, there are still many problems in actual use. The most typical problem is that the text output by large multimodal models is very brief and difficult to describe more detailed information. Summary of the invention

[0004] The present application provides a video processing method, device, equipment and medium based on a multimodal large model, which is used to solve the problem in the prior art that the text output by the multimodal large model during video understanding is very brief and difficult to describe more detailed information.

[0005] In a first aspect, an embodiment of the present application provides a video processing method based on a multimodal large model, wherein the multimodal large model includes a fusion structure, a language large model, and at least two video encoders, and the method includes:

[0006] Inputting the target video into the at least two video encoders respectively, and obtaining each initial video feature matrix output by the at least two video encoders;

[0007] Input each of the initial video feature matrices into the fusion structure, so that the fusion structure splices each of the initial video feature matrices to obtain a candidate video feature matrix, and maps the candidate video feature matrix to a target video feature matrix having the same number of rows and columns as the weight matrix according to a preset weight matrix;

[0008] The target video feature matrix and the instruction prompt words are input into the language model to obtain the target text output by the language model.

[0009] In a second aspect, an embodiment of the present application further provides a video processing device based on a multimodal large model, the device comprising:

[0010] An encoding module, used for inputting the target video into the at least two video encoders respectively, and obtaining each initial video feature matrix output by the at least two video encoders;

[0011] A fusion module, used for inputting each of the initial video feature matrices into the fusion structure, so that the fusion structure splices each of the initial video feature matrices to obtain a candidate video feature matrix, and maps the candidate video feature matrix to a target video feature matrix having the same number of rows and columns as the weight matrix according to a preset weight matrix;

[0012] The understanding module is used to input the target video feature matrix and the instruction prompt words into the language model to obtain the target text output by the language model.

[0013] In a third aspect, an embodiment of the present application further provides an electronic device, comprising a processor, wherein the processor is used to implement the steps of the above-mentioned video processing method based on a multimodal large model when executing a computer program stored in a memory.

[0014] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the video processing method based on a multimodal large model as described above.

[0015] In an embodiment of the present application, the multimodal large model includes a fusion structure, a language large model and at least two video encoders, wherein the target video is respectively input into at least two video encoders to obtain each initial video feature matrix output by at least two video encoders; each initial video feature matrix is ​​input into the fusion structure so that the fusion structure splices each initial video feature matrix to obtain a candidate video feature matrix, and according to a preset weight matrix, the candidate video feature matrix is ​​mapped to a target video feature matrix having the same number of rows and columns as the weight matrix; the target video feature matrix and the instruction prompt word are input into the language large model to obtain the target text output by the language large model. In an embodiment of the present application, multiple video encoders are used to extract the initial video features of the target video, and the initial video features of the multiple video encoders are fused to obtain the target video features, so as to realize the refined extraction of the video features and enhance the video detail description capability of the multimodal large model. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0017] Figure 1 A schematic diagram of a large multimodal model for video understanding provided by related technologies;

[0018] Figure 2 A schematic diagram of a video processing process based on a multimodal large model provided in an embodiment of the present application;

[0019] Figure 3 A schematic diagram of an application of a multi-modal large model of a multi-video encoder provided in an embodiment of the present application;

[0020] Figure 4 A schematic diagram of a flow chart of determining a target video feature matrix by a fusion structure provided in an embodiment of the present application;

[0021] Figure 5 A schematic diagram of the application of the group attention fusion structure provided in the embodiment of the present application;

[0022] Figure 6 A schematic diagram of a process for updating a sub-video feature matrix provided in an embodiment of the present application;

[0023] Figure 7 A schematic diagram of a process for determining a target video feature matrix using another fusion structure provided in an embodiment of the present application;

[0024] Figure 8 A schematic diagram of a video processing flow based on a multimodal large model provided in an embodiment of the present application;

[0025] Fig. 9 A schematic diagram of the structure of a video processing device based on a multimodal large model provided in an embodiment of the present application;

[0026] Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0027] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.

[0028] Figure 1 Schematic diagram of a multi-modal large model for video understanding provided by related technologies, such as this Figure 1As shown in the figure, the video input is first mapped into a set of feature vectors through a video encoder, and then the word embedding vector of the text prompt input and the video feature vector are input into the large language model together. Finally, the corresponding text is input according to different tasks. For example, for video description, a detailed description text is input, and for video question answering, the answer to the text question is output.

[0029] Although the industry has made some progress in multimodal large models for video understanding, there are still many problems in actual use. The most typical problem is that the output text of multimodal large models is very brief and difficult to describe more detailed information.

[0030] Take the video in the above figure as an example: the text prompt input is "Please describe the video content in detail", and the multimodal large model output is "The video is a busy road with many vehicles driving"; but the actual output of the multimodal large model is "This is a video taken by a surveillance camera, showing a city street scene. (1) Traffic conditions: In the video, there are 6 cars and 1 pedestrian motorcycle traveling in the left lane, and 1 car traveling in the right lane...; (2) Roads and facilities: The road has four lanes in both directions, separated by double yellow lines in the middle...; (3) Traffic signs: There is a traffic light in the video, which is green...; (4) Environment and weather: The weather conditions in the video, the leaves are green, which may be a summer scene...".

[0031] An important reason why large multimodal models have the above problems when performing video understanding is that the video encoder has insufficient performance and it is difficult to encode various detailed features in the video, which in turn makes it difficult for large language models to understand the detailed content.

[0032] Based on this, in order to improve the quality of the text output by the multimodal large model during video understanding and improve the ability of video understanding, the embodiments of the present application provide a video processing method, device, equipment and medium based on the multimodal large model.

[0033] In an embodiment of the present application, a multimodal large model includes a fusion structure, a language large model and at least two video encoders, wherein the target video is respectively input into the at least two video encoders to obtain each initial video feature matrix output by the at least two video encoders; each initial video feature matrix is ​​input into the fusion structure so that the fusion structure splices each initial video feature matrix to obtain a candidate video feature matrix, and according to a preset weight matrix, the candidate video feature matrix is ​​mapped to a target video feature matrix having the same number of rows and columns as the weight matrix; the target video feature matrix and the instruction prompt word are input into the language large model to obtain the target text output by the language large model.

[0034] Figure 2A schematic diagram of a video processing process based on a multimodal large model is provided for an embodiment of the present application, wherein the multimodal large model includes a fusion structure, a language large model and at least two video encoders, and the process includes:

[0035] S201: Input the target video into the at least two video encoders respectively, and obtain each initial video feature matrix output by the at least two video encoders.

[0036] A video processing method provided in an embodiment of the present application is applied to an electronic device, which may be a PC or a server.

[0037] The multimodal large model for video understanding consists of a video encoder and a large language model, and can be used to process video understanding tasks such as video description, video question and answer, video classification, video retrieval, and video timing positioning. In the existing multimodal large model for video understanding, a single video encoder is mainly used to encode the input video, which makes it difficult to accurately encode video information, restricting the video detail description capability of the video understanding large model. Based on this, the embodiment of the present application proposes a solution of extracting features using multiple video encoders, and proposes a multi-video encoder fusion technology to achieve refined extraction of video features and enhance the video detail description capability of the multimodal large model.

[0038] In an embodiment of the present application, the multimodal large model is composed of at least two video encoders, a fusion structure and a language large model. The electronic device inputs the target video into at least two video encoders of the multimodal large model respectively, and the at least two video encoders respectively extract features of the target video, determine and output the initial video feature matrix corresponding to the target video. The electronic device obtains each initial video feature matrix output by each video encoder.

[0039] Specifically, the function of the video encoder is to convert the input video sequence V = {I1, I2, ..., I l}, mapped to the initial video feature matrix f∈R n×d , where I k ,k=1,2,…,l represents the kth frame in the video, k is a positive integer, l represents the length of the video, n represents the number of row vectors in the initial video feature matrix, the row vector can also be called a video word unit, and d represents the dimension of each row vector, that is, the dimension of each video word unit. Let the video encoder function be VE, then a single video encoder can be expressed by the formula:

[0040] f1=VE1(I1,I2,…,I l )

[0041] f2=VE2(I1,I2,…,I l )

[0042] …

[0043] f N =VE N (I1,I2,…,I l )

[0044] Among them, VE k ,k=1,2,…,N represents N video encoders, f1,f2,…,f N It represents the initial video feature matrix extracted by the corresponding video encoder.

[0045] S202: Input each of the initial video feature matrices into the fusion structure, so that the fusion structure splices each of the initial video feature matrices to obtain a candidate video feature matrix, and maps the candidate video feature matrix to a target video feature matrix having the same number of rows and columns as the weight matrix according to a preset weight matrix.

[0046] In an embodiment of the present application, the multimodal large model also includes a fusion structure, which fuses the initial video feature matrix output by each video encoder to obtain a target video feature matrix.

[0047] Specifically, each initial video feature matrix output by each video encoder is input into the fusion structure, so that the fusion structure splices each initial video feature matrix to obtain a candidate video feature matrix, and according to a preset weight matrix, maps the candidate video feature matrix to a target video feature matrix having the same number of rows and columns as the weight matrix.

[0048] The fusion structure aims to combine the initial video feature matrices F1, F2, ..., f N Fusion is performed to obtain the advantageous features of each encoder, thereby improving the feature expression capability of the entire video encoder. Assuming the fusion structure is Fuse, the formula is

[0049] F=fuse(f1,f2,…,f N )

[0050] Among them, F∈R L×d , where L represents the number of final video words (row vectors), and d represents the dimension of each video word.

[0051] Among them, in the embodiment of the present application, the number of rows and columns of the target video feature matrix depends on the number of rows and columns of the weight matrix. The number of rows and columns of the weight matrix may be consistent with the number of rows and columns of the initial video feature matrix, or may be inconsistent, and there is no limitation here.

[0052] In addition, in an embodiment of the present application, when the fusion structure splices each initial video feature matrix, the splicing is performed based on the row vectors of the initial video feature matrix. For example, each initial video feature matrix contains 3 row vectors, and there are 3 initial video feature matrices in total. Then, the number of rows of the spliced ​​candidate video feature matrix is ​​9, and the number of columns remains unchanged.

[0053] S203: Input the target video feature matrix and the instruction prompt words into the language macro model to obtain the target text output by the language macro model.

[0054] In an embodiment of the present application, after determining the target video feature matrix of the target video through the fusion structure, the target video feature matrix and the instruction prompt word are input into the language model, and the language model processes the target video feature matrix according to the instruction prompt word, determines and outputs the target text, and the electronic device obtains the target text output by the language model.

[0055] Figure 3 This is a schematic diagram of an application of a multi-modal large model of a multi-video encoder provided in an embodiment of the present application, such as the Figure 3 As shown, the video input is first mapped into multiple initial video features through multiple video encoders, and then each initial video feature matrix is ​​fused into a target video feature matrix based on the fusion structure. The instruction prompt words input by the joint text prompt and the target video feature matrix are then input into the large language model together. Finally, the corresponding text is input according to different tasks. For example, for video description, a detailed description text is input, and for video question and answer, the answer to the text question is output.

[0056] In addition, in an embodiment of the present application, the electronic device can also determine the text vector corresponding to the instruction prompt word, input the text vector and the target video feature matrix into the large language model together, and obtain the target text output by the large language model.

[0057] In an embodiment of the present application, multiple video encoders are used to extract initial video features of a target video, and the initial video features of the multiple video encoders are fused to obtain target video features, thereby achieving refined extraction of video features and enhancing the ability to describe details of multimodal large model videos.

[0058] In order to improve the quality of the text output by the multimodal large model during video understanding and improve the ability of video understanding, based on the above embodiment, in the embodiment of the present application, the candidate video feature matrix is ​​mapped to a target video feature matrix having the same number of rows and columns as the weight matrix according to a preset weight matrix, including:

[0059] Determine a first product matrix of the transposed weight matrix and the candidate video feature matrix, and determine a ratio of the first product matrix to a preset value as an attention score matrix;

[0060] Normalizing the attention score matrix to determine a probability distribution matrix;

[0061] A second product matrix of the probability distribution matrix and the candidate video feature matrix is ​​determined, and the second product matrix is ​​determined as the target video feature matrix.

[0062] In an embodiment of the present application, the fusion structure in the multimodal large model can be a cross-attention structure, in which a weight matrix is ​​pre-stored. The fusion structure performs cross-attention processing on the candidate video feature matrix according to the weight matrix, and maps the candidate video feature matrix to a target video feature matrix with the same number of rows and columns as the weight matrix.

[0063] Specifically, in an embodiment of the present application, the fusion structure determines a first product matrix of the transpose of the weight matrix and the candidate video feature matrix, and determines the ratio of the first product matrix to a preset value as the attention score matrix; the attention score matrix is ​​normalized to determine a probability distribution matrix; a second product matrix of the probability distribution matrix and the candidate video feature matrix is ​​determined, and the second product matrix is ​​determined as the target video feature matrix.

[0064] The preset value is the dimension number of each row vector in the candidate video feature matrix, that is, the number of columns of the candidate video feature matrix.

[0065] Among them, the fusion structure can determine the target video feature matrix through the following formula:

[0066] F t =concat(f1,f2,…,f N )

[0067] K=V=F t

[0068]

[0069] Where Q∈R L×d is a weight matrix, which is a learnable parameter, concat represents a concatenation operation, and softmax is a normalized softmax operation. Through this structure, any number of video words F t The output changes to a fixed number L of video tokens, each of which has a dimension of d.

[0070] Figure 4 A schematic diagram of a process of determining a target video feature matrix by a fusion structure provided in an embodiment of the present application, the process includes:

[0071] S401: Determine a first product matrix of the transposed weight matrix and the candidate video feature matrix, and determine a ratio of the first product matrix to a preset value as an attention score matrix.

[0072] S402: Normalize the attention score matrix to determine the probability distribution matrix.

[0073] S403: Determine a second product matrix of the probability distribution matrix and the candidate video feature matrix, and determine the second product matrix as the target video feature matrix.

[0074] In order to improve the quality of the text output by the multimodal large model during video understanding and improve the ability of video understanding, based on the above embodiments, in the embodiment of the present application, before mapping the candidate video feature matrix to a target video feature matrix having the same number of rows and columns as the weight matrix according to a preset weight matrix, the method further includes:

[0075] Splitting each initial video feature matrix into a preset number of sub-video feature matrices;

[0076] For each sub-video feature matrix, determine each product of each row vector of the sub-video feature matrix and a pre-configured weight column vector; determine each product vector of each row vector and the corresponding product, and use the sum vector of each product vector to update the sub-video feature matrix;

[0077] According to each updated sub-video feature matrix, an updated candidate video feature matrix is ​​determined.

[0078] In an embodiment of the present application, since the initial video feature matrix output by each video encoder contains a large number of video words, that is, each initial video feature matrix contains many row vectors, if each initial video feature matrix is ​​directly fused, the computational complexity of the fusion structure will be very large, resulting in low video processing efficiency.

[0079] Based on this, in an embodiment of the present application, before splicing the initial video feature matrices, the fusion structure first reduces the number of video tokens contained in each initial video feature matrix, and then splices the candidate video feature matrix based on the updated initial video feature matrix.

[0080] Specifically, the fusion structure splits each initial video feature matrix into a preset number of sub-video feature matrices; for each sub-video feature matrix, determines each product of each row vector of the sub-video feature matrix and a pre-configured weight column vector; determines each product vector of each row vector and the corresponding product, and uses the sum vector of each product vector to update the sub-video feature matrix; and determines an updated candidate video feature matrix based on each updated sub-video feature matrix.

[0081] That is, in the embodiment of the present application, for each row vector, the fusion structure determines the product of the row vector and the pre-configured weight column vector, uses the product as the weight of the row vector, and performs weighted summation on the row vector and the corresponding product (weight) in each group, and uses the calculated sum vector to update the sub-video feature matrix corresponding to the group, so that the updated sub-video feature matrix of each group is a row vector, reducing the amount of data. In the embodiment of the present application, the number of rows of the updated candidate video feature matrix is ​​the number of groups.

[0082] In addition, in an embodiment of the present application, when the electronic device groups the initial video feature vector matrix, it groups according to row vectors, that is, a preset number of groups is pre-saved in the fusion structure, and the fusion structure performs rounding operation on the total number of rows of the initial video feature vector matrix according to the preset grouping, and determines the final rounding result as the number of row vectors contained in each group.

[0083] In order to improve the quality of the text output by the multimodal large model during video understanding and improve the ability of video understanding, based on the above embodiments, in the embodiment of the present application, after determining each product of each row vector of the sub-video feature matrix and each pre-configured weight column vector, the method further includes:

[0084] A normalization operation is performed on each of the products.

[0085] In an embodiment of the present application, in order to further improve the quality of the text output by the multimodal large model during video understanding and improve the ability of video understanding, the fusion structure will normalize each product after determining each row vector of the sub-video feature matrix and each product of the pre-configured weight column vector.

[0086] Among them, the fusion structure can reduce the number of video tokens contained in each initial video feature matrix by the following formula:

[0087] f i1 ,f i2 ,…,f ic = split(f i )

[0088] s ij =softmax(f ij w i )

[0089] f' ij =∑s ij f ij

[0090] f' i=concat(f′ i1 , f′ i2 ,…,f′ ic )

[0091] Among them, split(f i ), i = 1, 2, ..., k represents the rounding operation of the initial video feature matrix, dividing the original n row vectors into c groups on average, and the number of row vectors (video words) contained in each group is int (c / n), f ij is the video word, w i is the weight column vector, f′ ij is the updated sub-video feature matrix, f′ i Represents the updated candidate video feature matrix.

[0092] Figure 5 This is a schematic diagram of the application of the group attention fusion structure provided in the embodiment of the present application, such as the Figure 5 As shown, the process includes:

[0093] (1) First, the initial video feature matrix obtained by each video encoder is grouped to obtain a sub-video feature matrix f with a fixed number of rows c i ;

[0094] (2) Then, adaptive weight calculation is performed for each group, that is, the row vector (f i1 、f i2 ,……,f ic ) and the weight column vector (w) i1 , S i2 ,……,S ic ), and softmax normalization fusion processing.

[0095] (3) Then, the normalized product is multiplied and summed with the row vectors in each sub-video feature matrix to obtain a fused sum vector, which represents the features of the group, and further determines the candidate video feature matrix of the video encoder;

[0096] (4) Finally, the candidate video feature matrices of multiple video encoders are fused using a cross-attention method to obtain the final target video feature matrix.

[0097] Figure 6 A schematic diagram of a process for updating a sub-video feature matrix provided in an embodiment of the present application, the process comprising:

[0098] S601: Determine each product of each row vector of the sub-video feature matrix and each pre-configured weight column vector.

[0099] S602: Perform normalization operation on each product.

[0100] S603: Determine each product vector of each row vector and the corresponding product, and use the sum vector of each product vector to update the sub-video feature matrix.

[0101] Figure 7 A schematic diagram of a process for determining a target video feature matrix by another fusion structure provided in an embodiment of the present application, the process comprising:

[0102] S701: Split each initial video feature matrix into a preset number of sub-video feature matrices.

[0103] S702: For each sub-video feature matrix, update the sub-video feature matrix according to each row vector of the sub-video feature matrix and a pre-configured weight column vector.

[0104] S703: Determine an updated candidate video feature matrix according to each updated sub-video feature matrix.

[0105] S704: Determine a first product matrix of the transposed weight matrix and the updated candidate video feature matrix, and determine a ratio of the first product matrix to a preset value as an attention score matrix.

[0106] S705: Normalize the attention score matrix to determine the probability distribution matrix.

[0107] S706: Determine a second product matrix of the probability distribution matrix and the updated candidate video feature matrix, and determine the second product matrix as the target video feature matrix.

[0108] In order to improve the quality of the text output by the multimodal large model during video understanding and improve the ability of video understanding, based on the above embodiments, in the embodiment of the present application, the training process of the multimodal large model includes:

[0109] Freeze the parameters in the first parameter group of the at least two encoders and the parameters in the second parameter group of the language large model, and set the parameters in the third parameter group in the fusion structure to initial values;

[0110] Obtaining a first sample video and a corresponding first sample text carried in a data set;

[0111] Using the multimodal large model to perform video processing on the first sample video, and obtaining a first predicted sample text output by the multimodal large model;

[0112] According to the first predicted sample text and the first sample text, the parameters in the third parameter group in the fusion result of the multimodal large model are adjusted.

[0113] In an embodiment of the present application, since the multimodal large model includes multiple video encoders, a fusion structure and a language large model, wherein the multiple video encoders are pre-configured, when training the multimodal large model, the parameters of the fusion structure and the language large model can be adjusted separately.

[0114] Specifically, the electronic device freezes the parameters in the first parameter group of at least two encoders and the parameters in the second parameter group of the language large model, and sets the parameters in the third parameter group in the fusion structure to initial values, so that when the electronic device trains the multimodal large model, it only adjusts the parameters in the third parameter group in the fusion structure.

[0115] The electronic device obtains a first sample video and a corresponding first sample text carried in a data set; uses a multimodal large model to perform video processing on the first sample video to obtain a first predicted sample text output by the multimodal large model; and adjusts parameters in a third parameter group in a fusion result of the multimodal large model according to the first predicted sample text and the first sample text.

[0116] Among them, in the embodiment of the present application, the parameters in the third parameter group in the fusion structure include but are not limited to the weight matrix and weight column vector in the above embodiment.

[0117] In order to improve the quality of the text output by the multimodal large model during video understanding and improve the ability of video understanding, based on the above embodiments, in the embodiment of the present application, the method further includes:

[0118] Unfreezing parameters in a second parameter group of the large language model;

[0119] Obtaining a second sample video and a corresponding second sample text carried in the data set;

[0120] Performing video processing on the second sample video using the multimodal large model to obtain a second predicted sample text output by the multimodal large model;

[0121] According to the second predicted sample text and the second sample text, the parameters in the third parameter group in the fusion result of the multimodal large model and the parameters in the second parameter group of the language large model are adjusted.

[0122] In the embodiment of the present application, after the electronic device adjusts the parameters of the third parameter group in the fusion structure, the electronic device may also adjust the parameters of the second parameter group of the large language model.

[0123] Specifically, the electronic device unfreezes the parameters in the second parameter group of the large language model, so that this training can adjust both the parameters of the third parameter group of the fusion structure and the parameters of the second parameter group of the large language model.

[0124] The electronic device obtains a second sample video and a corresponding second sample text carried in a data set; uses a multimodal large model to process the second sample video to obtain a second predicted sample text output by the multimodal large model; and adjusts parameters in a third parameter group in a fusion result of the multimodal large model and parameters in a second parameter group of the language large model according to the second predicted sample text and the second sample text.

[0125] The multimodal large model provided in the embodiment of the present application can use one model to complete multiple computer vision tasks, such as pedestrian detection, vehicle detection, video event recognition, video description, video question and answer, etc. The following uses the traffic scene as an example to illustrate the use of the multimodal large model for video understanding.

[0126] The specific processing steps are as follows:

[0127] Step 1: Given a trained multimodal large model, input a command prompt word and the video to be processed.

[0128] The command prompts include: "Detect all pedestrians in the video", "Describe the content of the video", "Is there a car accident in the video? Please answer yes or no", etc.

[0129] Step 2: The multimodal large model encodes and processes the instruction prompt words and videos, and outputs the text answer.

[0130] In order to improve the quality of text output by the multimodal large model during video understanding and improve the ability of video understanding, on the basis of the above embodiments, in an embodiment of the present application, the at least two video encoders are at least two of Video BERT, ActBERT, Video MAE, Vi VIT and Slow Fast.

[0131] In the embodiment of the present application, the initial video feature matrix can be extracted by various video encoders, such as Video BERT, Act BERT, Video MAE, Vi VIT and Slow Fast, etc. It is worth noting that when these video encoders are used, the last layer of feature mapping layer corresponding to a specific category is removed, only the feature map of the second to last layer is retained, and the initial video feature matrix is ​​obtained by mapping it to a d-dimensional vector through a fully connected layer or a convolutional layer.

[0132] Figure 8A schematic diagram of a video processing flow based on a multimodal large model provided in an embodiment of the present application, the flow includes:

[0133] S801: Input the target video into at least two video encoders respectively, and obtain each initial video feature matrix output by the at least two video encoders.

[0134] S802: Input each initial video feature matrix into the fusion structure, so that the fusion structure concatenates each initial video feature matrix to obtain a candidate video feature matrix.

[0135] S803: The fusion structure splits each initial video feature matrix into a preset number of sub-video feature matrices, and updates each sub-video feature matrix according to each row vector of each sub-video feature matrix and a pre-configured weight column vector.

[0136] S804: The fusion structure determines an updated candidate video feature matrix based on each updated sub-video feature matrix.

[0137] S805: The fusion structure maps the candidate video feature matrix to a target video feature matrix having the same number of rows and columns as the weight matrix according to a preset weight matrix.

[0138] S806: Input the target video feature matrix and the instruction prompt words into the language model to obtain the target text output by the language model.

[0139] Based on the above embodiments, Fig. 9 A schematic diagram of the structure of a video processing device based on a multimodal large model provided in an embodiment of the present application, the device comprising:

[0140] The encoding module 901 is used to input the target video into the at least two video encoders respectively, and obtain each initial video feature matrix output by the at least two video encoders;

[0141] A fusion module 902 is used to input each of the initial video feature matrices into the fusion structure, so that the fusion structure splices each of the initial video feature matrices to obtain a candidate video feature matrix, and maps the candidate video feature matrix to a target video feature matrix having the same number of rows and columns as the weight matrix according to a preset weight matrix;

[0142] The understanding module 903 is used to input the target video feature matrix and the instruction prompt words into the language model to obtain the target text output by the language model.

[0143] In a possible implementation, the fusion module 902 is specifically used to determine a first product matrix of the transpose of the weight matrix and the candidate video feature matrix, and determine the ratio of the first product matrix to a preset value as an attention score matrix; normalize the attention score matrix to determine a probability distribution matrix; determine a second product matrix of the probability distribution matrix and the candidate video feature matrix, and determine the second product matrix as the target video feature matrix.

[0144] In a possible implementation, the fusion module 902 is further used to split each initial video feature matrix into a preset number of sub-video feature matrices; for each sub-video feature matrix, determine each product of each row vector of the sub-video feature matrix with a pre-configured weight column vector; determine each product vector of each row vector and the corresponding product, and use the sum vector of each product vector to update the sub-video feature matrix; and determine an updated candidate video feature matrix based on each updated sub-video feature matrix.

[0145] In a possible implementation, the fusion module 902 is further configured to perform a normalization operation on each of the products.

[0146] In a possible implementation, the device further includes:

[0147] The training module 904 is used to freeze the parameters in the first parameter group of the at least two encoders and the parameters in the second parameter group of the language large model, and set the parameters in the third parameter group in the fusion structure to initial values; obtain the first sample video and the corresponding first sample text carried in the data set; use the multimodal large model to perform video processing on the first sample video, and obtain the first predicted sample text output by the multimodal large model; according to the first predicted sample text and the first sample text, adjust the parameters in the third parameter group in the fusion result of the multimodal large model.

[0148] In a possible implementation, the training module 904 is also used to unfreeze the parameters in the second parameter group of the language large model; obtain the second sample video and the corresponding second sample text carried in the data set; use the multimodal large model to perform video processing on the second sample video to obtain the second predicted sample text output by the multimodal large model; and adjust the parameters in the third parameter group in the fusion result of the multimodal large model and the parameters in the second parameter group of the language large model according to the second predicted sample text and the second sample text.

[0149] In a possible implementation manner, the at least two video encoders are at least two of Video BERT, Act BERT, Video MAE, Vi VIT, and Slow Fast.

[0150] Based on the above embodiments, the present application also provides an electronic device, Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown in FIG. Fig.10 As shown, it includes: a processor 1001, a communication interface 1002, a memory 1003 and a communication bus 1004, wherein the processor 1001, the communication interface 1002, and the memory 1003 communicate with each other through the communication bus 1004;

[0151] The memory 1003 stores a computer program. When the program is executed by the processor 1001, the processor 1001 executes the steps of the video processing method based on the multimodal large model as provided in the above embodiments.

[0152] Since the principle of solving the problem by the above electronic device is similar to the video processing method based on the multimodal large model, the implementation of the above electronic device can refer to the embodiment of the method, and the repeated parts will not be repeated.

[0153] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The communication interface 1002 is used for communication between the above electronic device and other devices. The memory may include a random access memory (RAM) and may also include a non-volatile memory (NVM), such as at least one disk storage. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0154] The above-mentioned processor can be a general-purpose processor, including a central processing unit, a network processor (Network Processor, NP), etc.; it can also be a digital signal processing processor (Digital Signal Processing, DSP), an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, etc.

[0155] On the basis of the above embodiments, an embodiment of the present invention further provides a computer-readable storage medium, which stores a computer program executable by a processor. When the program runs on the processor, the processor implements the steps of the video processing method based on the multimodal large model provided in the above embodiments.

[0156] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0157] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0158] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0159] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0160] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A video processing method based on a multimodal large model, characterized in that: The multimodal large model includes a fusion structure, a language large model and at least two video encoders, and the method includes: Inputting the target video into the at least two video encoders respectively, and obtaining each initial video feature matrix output by the at least two video encoders; Input each of the initial video feature matrices into the fusion structure, so that the fusion structure splices each of the initial video feature matrices to obtain a candidate video feature matrix, and maps the candidate video feature matrix to a target video feature matrix having the same number of rows and columns as the weight matrix according to a preset weight matrix; The target video feature matrix and the instruction prompt words are input into the language model to obtain the target text output by the language model.

2. The method according to claim 1, characterized in that The step of mapping the candidate video feature matrix to a target video feature matrix having the same number of rows and columns as the weight matrix according to a preset weight matrix comprises: Determine a first product matrix of the transposed weight matrix and the candidate video feature matrix, and determine a ratio of the first product matrix to a preset value as an attention score matrix; Normalizing the attention score matrix to determine a probability distribution matrix; A second product matrix of the probability distribution matrix and the candidate video feature matrix is ​​determined, and the second product matrix is ​​determined as the target video feature matrix.

3. The method according to claim 1, characterized in that Before mapping the candidate video feature matrix to a target video feature matrix having the same number of rows and columns as the weight matrix according to the preset weight matrix, the method further includes: Splitting each initial video feature matrix into a preset number of sub-video feature matrices; For each sub-video feature matrix, determine each product of each row vector of the sub-video feature matrix and a pre-configured weight column vector; determine each product vector of each row vector and the corresponding product, and use the sum vector of each product vector to update the sub-video feature matrix; According to each updated sub-video feature matrix, an updated candidate video feature matrix is ​​determined.

4. The method according to claim 3, characterized in that After determining each product of each row vector of the sub-video feature matrix and each pre-configured weight column vector, the method further includes: A normalization operation is performed on each of the products.

5. The method according to claim 1, characterized in that The training process of the multimodal large model includes: Freeze the parameters in the first parameter group of the at least two encoders and the parameters in the second parameter group of the language large model, and set the parameters in the third parameter group in the fusion structure to initial values; Obtaining a first sample video and a corresponding first sample text carried in a data set; Using the multimodal large model to perform video processing on the first sample video, and obtaining a first predicted sample text output by the multimodal large model; According to the first predicted sample text and the first sample text, the parameters in the third parameter group in the fusion result of the multimodal large model are adjusted.

6. The method according to claim 5, characterized in that The method further comprises: Unfreezing parameters in a second parameter group of the large language model; Obtaining a second sample video and a corresponding second sample text carried in the data set; Performing video processing on the second sample video using the multimodal large model to obtain a second predicted sample text output by the multimodal large model; According to the second predicted sample text and the second sample text, the parameters in the third parameter group in the fusion result of the multimodal large model and the parameters in the second parameter group of the language large model are adjusted.

7. The method according to any one of claims 1 to 6, characterized in that: The at least two video encoders are at least two of Video BERT, Act BERT, Video MAE, Vi VIT and Slow Fast.

8. A video processing device based on a multimodal large model, characterized in that: The multimodal large model includes a fusion structure, a language large model and at least two video encoders, and the device includes: An encoding module, used for inputting the target video into the at least two video encoders respectively, and obtaining each initial video feature matrix output by the at least two video encoders; A fusion module, used for inputting each of the initial video feature matrices into the fusion structure, so that the fusion structure splices each of the initial video feature matrices to obtain a candidate video feature matrix, and maps the candidate video feature matrix to a target video feature matrix having the same number of rows and columns as the weight matrix according to a preset weight matrix; The understanding module is used to input the target video feature matrix and the instruction prompt words into the language model to obtain the target text output by the language model.

9. An electronic device, characterized in that: The electronic device comprises at least a processor and a memory, and the processor is used to implement the steps of the video processing method based on a multimodal large model as claimed in any one of claims 1 to 7 when executing a computer program stored in the memory.

10. A computer-readable storage medium, characterized in that: It stores a computer program, which, when executed by a processor, implements the steps of the video processing method based on a multimodal large model as described in any one of claims 1-7.

Citation Information

Cited By

  • Model deployment method, end-side device, and storage medium

    WO2025232128A1