A video action recognition method and device based on multimodal large model CLIP

Through the video action recognition method based on multi-modal large model CLIP, video frames are segmented and combined with the visual encoder and temporal differential attention module, which solves the problem of high cost of closed set classification and fine-tuning in the existing technology, and achieves better Video action recognition performance and generalization ability.

CN117994861BActive Publication Date: 2024-10-01ZHEJIANG LAB
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410326461.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-21
Publication Date
2024-10-01
Estimated Expiration
2044-03-21

Smart Images

  • Figure CN117994861B_ABST
    Figure CN117994861B_ABST
Patent Text Reader

Abstract

The present invention discloses a video action recognition method and device based on a multimodal large model CLIP, the method comprising: based on a given action category and video sequence, firstly using a word vector model and a segmented image block to extract corresponding language and video information; secondly, adjusting the image encoder and text encoder of CLIP based on a prompt adjustment structure and a trainable lightweight bottleneck module adapter to extract language and video frame features; further, using a temporal difference attention module to fully mine the features between the video frame temporal sequences; finally, comparing the video features and the category coding features, calculating the similarity score between the two in a coarse and fine granularity, and selecting the action category with the highest score as the prediction result. The present invention can effectively improve the performance of judging the video action category and the versatility of the network model through the design of a fine-tuning structure, and meet the video action recognition needs of complex scenes in real life.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of video action recognition, and in particular to a video action recognition method and device based on a multimodal large model CLIP. Background Art

[0002] Video action recognition is an important research topic in the field of computer vision. This task aims to automatically detect and identify human actions or behaviors in videos and is widely used in various fields. With the development of deep neural networks, action recognition has made significant progress, including traditional two-stream models, 3D convolutional neural networks, and Transformer-based methods. The closed set classification schemes in existing methods face challenges in practical applications, and have difficulty in identifying unseen categories or perform poorly in few-sample learning. Vision-language models can effectively enhance the generalization ability of models, and due to the multimodal nature of vision-language models, they have attracted widespread attention from academia and industry. How to transfer large-scale vision-language pre-trained models such as CLIP to video understanding tasks has become a focus of attention.

[0003] Since this task involves video action recognition based on CLIP, but the CLIP model has a large number of parameters, it is inefficient to train the model directly from scratch. Therefore, the existing methods use the method of fine-tuning the pre-trained model. There are the following problems that need to be solved in fine-tuning the CLIP model: (1) Fully fine-tuning the CLIP model (i.e., updating all model parameters during training) inevitably incurs significant memory and computational costs and may cause catastrophic forgetting; (2) When performing end-to-end fine-tuning on the downstream video action recognition task, the valuable visual features learned from image pre-training may be lost, resulting in poor performance when the downstream video lacks sufficient information. Summary of the invention

[0004] The purpose of the present invention is to address the deficiencies of the prior art and provide a video action recognition method and device based on a multimodal large model CLIP.

[0005] To achieve the above object, the present invention provides a video action recognition method based on a multimodal large model CLIP, the method comprising the following steps:

[0006] S1: Given a video containing T frames, split each frame into non-overlapping square image blocks of equal size, map each image block into a sequence of image block embeddings through a linear projection layer, and add a learnable category tag at the beginning of the embedding sequence of each frame as the input of the Transformer module;

[0007] S2: Given a category label, generate a text description for the category label using a text category template, and process the text description using byte pair encoding to generate a word sequence;

[0008] S3: The image block embedding obtained in step S1 and the text description obtained in step S2 are respectively passed into the visual encoder and the text encoder to obtain visual encoding features and category encoding features;

[0009] S4: pass the visual encoding features obtained in step S3 into the temporal difference attention module to obtain the final video representation;

[0010] S5: Perform coarse-grained contrastive learning and fine-grained contrastive learning on the final video representation obtained in step S4 and the category encoding features obtained in step S3; select the action category with the highest final similarity score as the prediction result of the video action recognition.

[0011] Furthermore, in step S1, the video frame with a length of H and a width of W is divided into HW / P frames with a side length of P and equal size. 2 non-overlapping square patches that add a learnable category marker at the beginning of the embedding sequence of each frame.

[0012] Furthermore, in step S2, for the category label, a text category template is used to generate a text description of "a photo of a{c}".

[0013] Furthermore, the step S3 includes the following sub-steps:

[0014] (3.1) Add a set of trainable prompt words in front of the input sequence in each Transformer module and interact with all input tokens. and E l-1 denote the visual cue input and image patch features of the l-th layer Transformer module, respectively. Cue adjustment adds learnable cues to each Transformer module Φ l In , the lth Transformer module processes the input visual cues as follows:

[0015] [x l,cls ,_,E l ]=Φ 1 ([x l-1,cls , P l-1 , E l-1 ]), l = 1, ..., L;

[0016] Among them, the corresponding position The output features of are discarded and recorded as “_”, M represents the number of text prompts; text prompts are added to each layer of the text encoder; the text prompts and word feature embeddings of the lth layer are W l-1; For the lth layer, the input text prompt is represented as:

[0017]

[0018] (3.2) For the input feature x of the lth layer l , a trainable lightweight bottleneck module adapter performs the following computations:

[0019]

[0020]

[0021] Among them, W down , W up are the weight matrices for downsampling and upsampling mappings, respectively. Represents the intermediate output value, x l represents the output feature of the lth layer, x l represents the input features of the lth layer, s represents the scale factor; the output x from the previous layer l-1 Projection to matrix P k and P v , and then the calculated matrix P k and P v Added to the original key and value matrices, a multi-head self-attention operation is performed; the calculation of this process is described as follows:

[0022] P k , P v =ReLU(x l-1 W down )W up ;

[0023]

[0024]

[0025] MSA(x l-1 )=Concat(head 1 , head 2 , ..., head h )W o ;

[0026] in, They represent the weight matrices of query, key, and value transformation of the i-th attention head, Q, K, and V represent the query, key, and value matrices in the self-attention mechanism, respectively; h represents the attention head i The total number of o Represents the weight matrix of linear transformation, Concat represents feature concatenation;

[0027] (3.3) The visual backbone network is used as the visual encoder, and the visual image block is input to obtain the visual feature encoding e v ; Use the pre-trained language backbone as the text encoder to encode the word sequence to generate the category encoding feature e s .

[0028] Furthermore, the specific process of step S4 is as follows:

[0029] Given a video feature sequence e f =f 0 , f 1 , f 2 , ..., f n-1 , where each f i Represents the embedding of the i-th frame, calculates the difference between the embeddings of adjacent frames, and captures short-term timing information; uses the Sigmoid function to obtain the feature embedding of enhanced difference The expression is as follows:

[0030]

[0031] Among them, P represents the position code, and represents the features of two adjacent frames, σ is the activation function, and Φ represents the transformer layer; the enhanced differential feature embedding is inserted between each pair of adjacent frames to obtain the temporal feature encoding F te :

[0032]

[0033] Among them, T is the type encoding feature.

[0034] Furthermore, in step S5, the coarse-grained contrastive learning is specifically as follows:

[0035] The video sentence comparison is used to represent the coarse-grained similarity, and the symmetric cross-entropy loss is used to maximize the similarity between positive matching video label pairs and minimize the similarity between other non-matching pairs; the calculation of the cross-entropy loss is as follows:

[0036]

[0037]

[0038]

[0039] Among them, L V2C , L C2V represents the bidirectional contrast loss between video and sentence, L VC represents the average value of the bidirectional contrast loss between video and sentence, e sirepresents the features of each sentence level in training batch B, e vi represents each video-level feature within the training batch B, where B is the batch size, sim(·, ·) is the cosine similarity function; τ is a learnable temperature hyperparameter used for scaling in the Softmax function.

[0040] Furthermore, in step S5, the fine-grained contrastive learning is specifically as follows:

[0041] Using frame-word comparison as fine-grained similarity, we use matrix multiplication to compute the fine-grained similarity matrix S between frame and word representations. FW , where S FW =e f ·(e w ) T Contains the similarity scores of n frames and m words, e f represents the feature representation with n frames, e w Represents the feature representation of m words; for the similarity matrix S FW Perform two attention operations; the fine-grained video-level and sentence-level similarity vectors are obtained through the first attention operation, and the expression is as follows:

[0042]

[0043]

[0044] Among them, “*” represents all elements of the corresponding dimension, S vid and S sen Represent the similarity scores at the video level and sentence level respectively; the fine-grained instance-level similarity score is obtained through the second attention, and the expression is as follows:

[0045]

[0046]

[0047] Among them, S′ vid and S′ sen They represent the video-level fine-grained similarity score and the sentence-level fine-grained similarity score respectively. The fine-grained similarity score is obtained by calculating the average of the similarity scores of the video instance and the sentence instance, which is expressed as:

[0048]

[0049] To achieve the above objectives, the present invention also provides a video action recognition device based on a multimodal large model CLIP, comprising one or more processors for implementing the above-mentioned video action recognition method based on a multimodal large model CLIP.

[0050] To achieve the above-mentioned purpose, the present invention also provides an electronic device, including a memory and a processor, wherein the memory is coupled to the processor; wherein the memory is used to store program data, and the processor is used to execute the program data to implement the above-mentioned video action recognition method based on the multimodal large model CLIP.

[0051] To achieve the above objectives, the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-mentioned video action recognition method based on the multimodal large model CLIP.

[0052] The beneficial effects of the present invention are as follows: for the task of video action recognition, on the one hand, the closed set classification scheme in the existing method is difficult to recognize unseen categories or performs poorly in few-sample learning, and a fine-tuning CLIP model is proposed to obtain strong generalization. However, due to the high memory and computational costs of the fully fine-tuned CLIP model and the possible catastrophic forgetting, the present invention proposes to use two improved few-parameter fine-tuning methods, prompt adjustment and trainable lightweight bottleneck module adapter to guide the CLIP model to adapt to downstream tasks; on the other hand, when performing end-to-end fine-tuning on the downstream video action recognition task, it is possible to lose valuable visual features learned from image pre-training, resulting in poor performance when the downstream video lacks sufficient information. The present invention proposes to use a temporal difference attention module to process inter-frame temporal interaction information. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] Figure 1 is a flow chart of the method of the present invention;

[0054] Figure 2 It is a schematic diagram of the method framework of the present invention;

[0055] Figure 3 It is a structural schematic diagram of the device of the present invention;

[0056] Figure 4 It is a schematic diagram of an electronic device of the present invention. DETAILED DESCRIPTION

[0057] The present invention will be further described below in conjunction with the accompanying drawings and specific examples.

[0058] The present invention provides a video action recognition method and device based on a multimodal large model CLIP, which can recognize the action category in the video based on the provided type prompt and video. Figure 1As shown in the figure, the method first extracts the corresponding language and video information based on the given action category and video sequence. Furthermore, the image encoder and text encoder of CLIP are adjusted based on the prompt adjustment structure and the trainable lightweight bottleneck module adapter to extract language and video frame features. Furthermore, the temporal features between video frames are fully mined based on the temporal difference attention module. Finally, the video representation and category encoding features are compared, and the similarity scores between the two are calculated in a coarse and fine granularity, and the action category with the highest score is selected as the prediction result.

[0059] The present invention will be described in detail below with reference to the accompanying drawings. Figure 2 The present invention provides a visual action recognition method based on a multimodal large model CLIP. The specific steps of this method are:

[0060] S1: Given a video with a length of H and a width of W containing T frames, split each frame into non-overlapping equal-sized HW / P frames with a side length of P. 2 square image blocks, and each image block is mapped into a sequence of image blocks embedded in [x t,1 , x t,2 , x t,3 , ..., x t,N ] and add a learnable category label x at the beginning of the embedding sequence of each frame t,cls , which is used as the input h of the Transformer module 0,t , which can be described as the following formula:

[0061] h 0,t =[x t,cls , x t,1 , x t,2 , x t,3 , ..., x t,N ]+P s ;

[0062] Among them, P s represents the learnable position embedding, and t represents each time point, i.e., the time position of the frame.

[0063] S2: The corresponding branch for processing text. Given a category label c, the text category template is used to generate a text description of "a photo of a{c}" for the category label c. Then, the text description is processed using byte pair encoding to obtain a word sequence. Specifically, the text description is first segmented and then projected into the word feature space to obtain the word encoding. The word sequence is structured with a fixed length of 77, including two boundary markers [SOS] and [EOS].

[0064] S3: Since fully fine-tuning the pre-trained CLIP model will bring the risk of high computational cost, a small amount of parameter fine-tuning is used to efficiently and effectively guide the CLIP model to adapt to downstream tasks; in order to achieve efficient fine-tuning, two model adaptation methods are introduced, and the visual encoder and text encoder of CLIP (ViTB / 16) are used as the visual backbone encoder and text backbone encoder of the present invention. On this basis, prompt adjustment and improvement of the trainable lightweight bottleneck module adapter are added to make the performance better. The prompt adjustment is used to provide the model with the ability to learn data distribution, and a trainable lightweight bottleneck module adapter is inserted into the multi-head self-attention layer and the multi-layer perceptron layer. The image block embedding obtained in step S1 and the text description obtained in step S2 are respectively passed into the visual encoder and the text encoder to obtain visual encoding features and category encoding features.

[0065] It includes the following sub-steps:

[0066] (3.1) Prompt adjustment: In the visual branch (Transformer module), a set of trainable prompt words is first added to the front of the input sequence and interacts with all input tokens. The lth Transformer module processes the input visual prompt [x l,cls ,_,E l ] means as follows:

[0067] [x l,cls ,_,E l ]=Φ l ([x l-1,cls , P l-1 , E l-1 ]), l = 1, ..., L;

[0068] in, and E l-1 denote the visual cue input and image patch features of the l-th layer Transformer module, respectively. Cue adjustment adds learnable cues to each Transformer module Φ l The output features at the corresponding position are discarded (denoted as “_”) and will not be input into the next module. M represents the number of text prompts, and [·,·] represents stacking in the sequence length dimension;

[0069] In the text branch, textual cues are added to each layer of the text Transformer encoder; the textual cues and word feature embeddings of layer l are W l-1 ; For the lth layer, the input text prompt [_, W l ] can be expressed as:

[0070]

[0071] (3.2) Trainable lightweight bottleneck module adapter: For the input feature x′ of the lth layer l , a trainable lightweight bottleneck module adapter performs the following computations:

[0072]

[0073]

[0074] Among them, W down , W up are the weight matrices for downsampling mapping and upsampling mapping respectively; Represents the intermediate output value, x l represents the output feature of the lth layer, x′ l represents the input features of the lth layer, s represents the scale factor, and in each encoder layer, the output x from the previous layer is converted l-1 Projection to matrix P k and the matrix P v , use the bottleneck structure of down→ReLU→up; then calculate the matrix P k and the matrix P v Added to the original key and value matrices, further multi-head self-attention operation is performed; the calculation description of this process is as follows:

[0075] P k , P v =ReLU(x l-1 W down )W up ;

[0076]

[0077]

[0078] MSA(x l-1 )=Concat(head 1 , head 2 , ..., head h )W o ;

[0079] in, They represent the query, key, and value transformation weight matrices of the i-th attention head respectively; Attn(Q, K, V) represents the self-attention mechanism, Q, K, V represent the query, key, and value matrices in the self-attention mechanism respectively, and h represents the attention head i The total number of o Represents the weight matrix of linear transformation, Concat represents feature concatenation;

[0080] (3.3) The CLIP (ViTB / 16) visual backbone network is used as the visual encoder to improve the visual feature encoding. v , using the pre-trained language backbone of CLIP (ViTB / 16) as the text encoder to improve the encoding of word sequences to generate category encoding features e s .

[0081] Embed the image block obtained in step S1 into h 0,t , as the improved visual encoder image block input, after multiple layers of Transformer layers, the output h l,t , after layer normalization and linear projection, the process is described as follows:

[0082] z l,t =h l-1,t +MSA(LN(h l-1,t ));

[0083] h l,t =z l,t +MLP(LN(z l,t ));

[0084]

[0085] Among them, z l,t represents the output of the multi-head attention module MSA, h l,t represents the output of the linear projection layer MLP, f t represents the feature representation at the frame level, MSA represents the improved Transformer layer, LN represents layer normalization, MLP represents the multi-layer perceptron, Proj represents the linear projection layer, and the visual image block output is aligned with the text output size to obtain the encoding information of the n-frame image in this way, and the visual encoding feature e is obtained. f ; Encode the word sequence W 0 As the input of the text encoder, obtain the category encoding feature e s and word-level text features e containing m words w .

[0086] S4: Since the visual Transformer (ViT) extracts feature representations from each frame without considering the temporal interaction between frames, a temporal difference attention module is introduced to expand the input and convert the visual encoding feature e obtained in step S3 into f , passed into the temporal difference attention module, guiding the temporal Transformer to combine temporal reasoning capabilities to obtain a video-level image representation that integrates temporal features. vSpecifically, given a video feature sequence e f =f 0 , f 1 , f 2 , ..., f n-1 , where each f i Represents the embedding of the i-th frame, calculates the difference between the embeddings of adjacent frames to capture short-term temporal information; uses the Sigmoid function to obtain the feature embedding of enhanced difference The implementation of the temporal difference attention module has the following process:

[0087] First, obtain the difference information between the timing frames.

[0088]

[0089] Among them, F de is the image feature with differential information, P represents the position code, and represents the features of two adjacent frames, σ is the sigmoid activation function, and Φ represents the transformer layer; then, the above enhanced differential feature embedding is inserted between each pair of adjacent frames to obtain the temporal feature encoding F te :

[0090]

[0091] Among them, P represents the position code, T is the type code feature used to characterize whether the feature belongs to the enhanced difference feature or the original frame feature; then the frame embedding inserted with the enhanced difference embedding is input into a temporal Transformer layer to capture the dynamic temporal representation related to video coding, and finally, temporal average pooling is applied to obtain the final video representation e v .

[0092] S5: Perform coarse-grained and fine-grained comparative learning on the final video representation obtained in step S4 and the category encoding features obtained in step S3, and select the action category with the highest score as the Top1 prediction result based on the final similarity score. The specific coarse-grained and fine-grained comparative learning process is as follows:

[0093] (5.1) Coarse-grained contrastive learning: Video-sentence contrast is used to represent coarse-grained similarity, and a symmetric cross-entropy loss is used to maximize the similarity between positive (matching) video label pairs and minimize the similarity between other mismatching pairs; the calculation of the cross-entropy loss is as follows:

[0094]

[0095]

[0096]

[0097] Among them, L V2C , L C2V represents the bidirectional contrast loss between video and sentence, L VC represents the average value of the bidirectional contrast loss between video and sentence, e si represents the features of each sentence level in training batch B, e vi represents the features of each video level in the training batch B, B is the batch size, sim(·, ·) is the cosine similarity function; τ is a learnable temperature hyperparameter used for scaling in the Softmax function;

[0098] (5.2) Fine-grained contrastive learning: We use frame-word contrast as fine-grained similarity and use matrix multiplication to compute the fine-grained similarity matrix S between frame and word representations. FW , where S FW =e f ·(e w ) T Contains the similarity scores of n frames and m words, e f represents the feature representation with n frames, e w Represents the feature representation of m words; for the similarity matrix S FW Two attention operations are performed; the first attention operation aims to obtain fine-grained video-level and sentence-level similarity vectors, expressed as follows:

[0099]

[0100]

[0101] Among them, “*” represents all elements of the corresponding dimension, S vid and S sen Represent the similarity scores at the video level and sentence level respectively; the second attention aims to obtain the fine-grained instance-level similarity score, which is expressed as follows:

[0102]

[0103]

[0104] Among them, S′ vid and S′ sen They represent the video-level fine-grained similarity score and the sentence-level fine-grained similarity score respectively. The fine-grained similarity score is obtained by calculating the average of the similarity scores of the video instance and the sentence instance, which is expressed as:

[0105]

[0106] (5.3) Select the action category with the highest final similarity score in the coarse-grained and fine-grained contrast learning as the Top1 prediction result; that is, select the action category with the highest final similarity score as the prediction result of the video action recognition.

[0107] Corresponding to the aforementioned embodiment of the video action recognition method based on the multimodal large model CLIP, the present invention also provides an embodiment of the video action recognition device based on the multimodal large model CLIP.

[0108] See also Figure 3 The video action recognition device based on the multimodal large model CLIP provided in an embodiment of the present invention includes one or more processors for implementing the video action recognition method based on the multimodal large model CLIP in the above embodiment.

[0109] The embodiment of the video action recognition device based on the multimodal large model CLIP of the present invention can be applied to any device with data processing capabilities, and the device with data processing capabilities can be a device or apparatus such as a computer. The device embodiment can be implemented through software, or through hardware or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, it is formed by the processor of any device with data processing capabilities in which it is located reading the corresponding computer program instructions in the non-volatile memory into the internal memory for execution. From the hardware level, if Figure 3 As shown in FIG. 1 , a hardware structure diagram of any device with data processing capability is provided for the video action recognition device based on the multimodal large model CLIP of the present invention, except Figure 3 In addition to the processor, memory, network interface, and non-volatile memory shown, any device with data processing capabilities in which the apparatus in the embodiments is located may also include other hardware, generally based on the actual functions of the device with data processing capabilities, which will not be described in detail.

[0110] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.

[0111] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of the present invention. Ordinary technicians in this field can understand and implement it without paying creative work.

[0112] Corresponding to the above-mentioned embodiment of the video action recognition method based on the multimodal large model CLIP, the embodiment of the present application also provides an electronic device, including: one or more processors; a memory for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the above-mentioned video action recognition method based on the multimodal large model CLIP. Figure 4 As shown, it is a hardware structure diagram of any device with data processing capability where the video action recognition method based on multimodal large model CLIP provided by the embodiment of the present application is located, except Figure 4 In addition to the processor, memory, DMA controller, disk, and non-volatile memory shown, any device with data processing capabilities in which the apparatus in the embodiment is located may also include other hardware, which will not be described in detail, generally based on the actual functions of the device with data processing capabilities.

[0113] Corresponding to the embodiment of the aforementioned video action recognition method based on the multimodal large model CLIP, an embodiment of the present invention also provides a computer-readable storage medium on which a program is stored. When the program is executed by a processor, the video action recognition method based on the multimodal large model CLIP in the above embodiment is implemented.

[0114] The computer-readable storage medium may be an internal storage unit of any device with data processing capability described in any of the aforementioned embodiments, such as a hard disk or a memory. The computer-readable storage medium may also be any device with data processing capability, such as a plug-in hard disk, a smart media card (SMC), an SD card, a flash card, etc. equipped on the device. Furthermore, the computer-readable storage medium may also include both an internal storage unit of any device with data processing capability and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by any device with data processing capability, and may also be used to temporarily store data that has been output or is to be output.

[0115] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A video action recognition method based on multimodal large model CLIP, characterized in that: The method comprises the following steps: S1: Given a video containing T frames, split each frame into non-overlapping square image blocks of equal size, map each image block into a sequence of image block embeddings through a linear projection layer, and add a learnable category tag at the beginning of the embedding sequence of each frame as the input of the Transformer module; S2: Given a category label, generate a text description for the category label using a text category template, and process the text description using byte pair encoding to generate a word sequence; S3: The image block embedding obtained in step S1 and the text description obtained in step S2 are respectively passed into the visual encoder and the text encoder to obtain visual encoding features and category encoding features; (3.1) Add a set of trainable prompt words in front of the input sequence in each Transformer module and interact with all input tokens. and E l-1 denote the visual cue input and image patch features of the first-layer Transformer module, respectively. Cue adjustment adds learnable cues to each Transformer module Φ l In , the lth Transformer module processes the input visual cues as follows: [x l,cls,- ,AND l ]=Φ l ([x l-1,cls ,P l-1 ,AND l-1 ]),l=1,...,L; Among them, the corresponding position The output features of are discarded and recorded as "_", M represents the number of text prompts; text prompts are added to each layer of the text encoder; the text prompts and word feature embeddings of the first layer are For layer 1, the input text prompt is represented as: (3.2) For the input feature x of the first layer l , a trainable lightweight bottleneck module adapter performs the following computations: Among them, W down , W up are the weight matrices for downsampling and upsampling mappings, respectively. Represents the intermediate output value, x l represents the output feature of the first layer, x′ l represents the input features of the first layer, s represents the scale factor; the output x from the previous layer l -1 projection to matrix P k and P v , and then the calculated matrix P k and p v Added to the original key and value matrices, a multi-head self-attention operation is performed; the calculation of this process is described as follows: P k ,p v =ReLU(x l-1 IN down )IN up ; MSA(x l-1 )=Concat(head1,head2,...,head h )W o ; in, They represent the weight matrices of query, key, and value transformation of the i-th attention head, Q, K, and V represent the query, key, and value matrices in the self-attention mechanism, respectively; h represents the attention head i The total number of o Represents the weight matrix of linear transformation, Concat represents feature concatenation; (3.3) The visual backbone network is used as the visual encoder, and the visual image block is input to obtain the visual feature encoding e v ; Use the pre-trained language backbone as the text encoder to encode the word sequence to generate the category encoding feature e s ; S4: pass the visual encoding features obtained in step S3 into the temporal difference attention module to obtain the final video representation; The specific process is as follows: Given a video feature sequence e f =f0,f1,f2,...,f n-1 , where each f i Represents the embedding of the i-th frame, calculates the difference between the embeddings of adjacent frames, and captures short-term timing information; uses the Sigmoid function to obtain the feature embedding of enhanced difference The expression is as follows: Among them, P represents the position code, and represents the features of two adjacent frames, σ is the activation function, and Φ represents the transformer layer; the enhanced differential feature embedding is inserted between each pair of adjacent frames to obtain the temporal feature encoding F te : Among them, T te Encode features for types; S5: Perform coarse-grained contrastive learning and fine-grained contrastive learning on the final video representation obtained in step S4 and the category encoding features obtained in step S3; select the action category with the highest final similarity score as the prediction result of the video action recognition.

2. According to claim 1, a video action recognition method based on multimodal large model CLIP is characterized in that: In step S1, a video frame with a length of H and a width of W is divided into HW / P pairs with a side length of P. 2 non-overlapping square patches that add a learnable category marker at the beginning of the embedding sequence of each frame.

3. According to claim 1, a video action recognition method based on multimodal large model CLIP is characterized in that: In step S2, for the category label, a text category template is used to generate a text description of "a photo of a{c}".

4. According to claim 1, a video action recognition method based on multimodal large model CLIP is characterized in that: In step S5, the coarse-grained contrastive learning is specifically as follows: The video sentence comparison is used to represent the coarse-grained similarity, and the symmetric cross-entropy loss is used to maximize the similarity between positive matching video label pairs and minimize the similarity between other non-matching pairs; the calculation of the cross-entropy loss is as follows: Among them, L V2C , L C2V represents the bidirectional contrast loss between video and sentence, L VC represents the average value of the bidirectional contrast loss between video and sentence, e si represents the features of each sentence level in training batch B, e vi represents each video-level feature within the training batch B, where B is the batch size, sim(·, ·) is the cosine similarity function; τ is a learnable temperature hyperparameter used for scaling in the Softmax function.

5. According to claim 4, a video action recognition method based on multimodal large model CLIP is characterized in that: In step S5, the fine-grained contrastive learning is specifically as follows: Using frame-word comparison as fine-grained similarity, we use matrix multiplication to compute the fine-grained similarity matrix S between frame and word representations. FW , where S FW =e f ·(e w ) T Contains the similarity scores of n frames and m words, e f represents the feature representation with n frames, e w Represents the feature representation of m words; for the similarity matrix S FW Perform two attention operations; the fine-grained video-level and sentence-level similarity vectors are obtained through the first attention operation, and the expression is as follows: Among them, "*" represents all elements of the corresponding dimension, S vid and S sen Represent the similarity scores at the video level and sentence level respectively; the fine-grained instance-level similarity score is obtained through the second attention, and the expression is as follows: Among them, S′ vid and S sen They represent the video-level fine-grained similarity score and the sentence-level fine-grained similarity score respectively. The fine-grained similarity score is obtained by calculating the average of the similarity scores of the video instance and the sentence instance, which is expressed as:

6. A video action recognition device based on a multimodal large model CLIP, characterized in that: The method comprises one or more processors for implementing the video action recognition method based on multimodal large model CLIP according to any one of claims 1 to 5.

7. An electronic device comprising a memory and a processor, characterized in that: The memory is coupled to the processor; wherein the memory is used to store program data, and the processor is used to execute the program data to implement the video action recognition method based on the multimodal large model CLIP as described in any one of claims 1-5 above.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the video action recognition method based on the multimodal large model CLIP as described in any one of claims 1 to 5 is implemented.

Citation Information

Cited By

  • Industrial operation normativity identification method fusing visual sense, force sense and trajectory data

    CN122820690A

  • A method for recognizing standardized industrial operations by integrating visual, force, and trajectory data.

    CN122820690B