Human action recognition method and system based on multi-scale features

Through the multi-scale feature method based on Swin Transformer, combined with self-attention calculation and feature fusion, the problem of computational burden and insufficient feature modeling of existing action recognition algorithms is solved, and human action recognition with high accuracy and low resource consumption is achieved.

CN114743265BActive Publication Date: 2024-10-25STATE GRID SHANDONG ELECTRIC POWER CO +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210373621.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-11
Publication Date
2024-10-25
Estimated Expiration
2042-04-11

AI Technical Summary

Technical Problem

Existing Transformer-based action recognition algorithms suffer from excessive computational burden in video sequence processing and fail to effectively independently model the characteristics of time and space dimensions, resulting in problems with recognition accuracy and computational resource consumption.

Method used

The multi-scale feature method based on Swin Transformer is used to obtain the spatial features of the video sequence through a convolutional network. It combines self-attention calculation and feature fusion to extract short-term, medium-term and long-term features, and achieves action classification through weighted fusion to reduce the computational burden.

Benefits of technology

It achieves high-precision human action recognition, while reducing the computational resource consumption of the algorithm, improving action recognition performance, and is suitable for recognition tasks in different application scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114743265B_ABST
    Figure CN114743265B_ABST
Patent Text Reader

Abstract

The present invention proposes a method and system for human action recognition based on multi-scale features, including: using a convolutional network to obtain spatial features of a video sequence; taking a local window in the time dimension for the spatial features, and calculating in the local window to obtain the maximum response based on the primary local features; processing the maximum response based on the primary local features to obtain secondary features; taking a local window in the time dimension for the secondary features, and calculating in the local window to obtain the maximum response based on the secondary local features; obtaining the final action classification by weighted fusion of the maximum response based on the primary local features and the maximum response based on the secondary local features, and the obtained features correspond to the short-term, medium-term, and long-term features of the video sequence. The present invention performs short-term and long-term modeling on the time series to improve the performance of the action recognition algorithm.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of image processing, and in particular relates to a method and system for human action recognition based on multi-scale features. Background Art

[0002] The statements in this section merely provide background information related to the present invention and do not necessarily constitute prior art.

[0003] As one of the main applications of computer vision in real life, action recognition tasks have a wide range of applications in real life. Lightweight action recognition algorithms can be deployed on edge devices. Applying action recognition algorithms to real-world scenarios such as factories and streets for video supervision and behavior prediction has become a new research hotspot, but it also brings great challenges. Action recognition aims to identify the action category performed by the observer through a small number of video frames in a short period of time. Research on action recognition algorithms in conventional environments has made great progress, but due to the diversity of deployment environments and the scarcity of training data, the algorithm needs to be able to guarantee high recognition accuracy in different application scenarios.

[0004] For conventional action recognition tasks, traditional methods mainly include two mainstream directions: based on RGB images and based on human joint point sequences. Compared with the method based on RGB image sequences, the method of modeling the human skeleton based on graph convolutional networks (GCN) is highly robust to interference factors such as changes in complex backgrounds. Moreover, compared with the processing of video streams, processing joint point data consumes less computing resources and the training cycle of the model is relatively short. Although traditional action recognition algorithms based on deep learning have made great progress, the particularity of action recognition tasks has put forward higher requirements on the accuracy of the algorithm.

[0005] Action recognition is different from general image classification tasks. It needs to extract spatiotemporal information between frames in a sequence and locate the parts of a person with higher response in space. At the same time, there are interference factors such as complex backgrounds and occlusions in the video. There are differences between human action categories, and there are also differences between different individuals in the same category. The magnitude and duration of action execution vary depending on the object of execution, which makes this task different from other classification tasks.

[0006] In recent years, Transformer-based methods have achieved unprecedented results in image processing, video understanding and other fields. Transformer-based action recognition methods have been widely studied and have produced many efficient variants. The Vision Transformer (VIT) model based on two-dimensional image understanding uses a multi-head attention module to achieve high-precision image classification. The Video Vision Transformer (VIVIT) model proposed on this basis applies this idea to the field of video understanding. Compared with the amount of data introduced by image input, video input introduces four different feature fusion extraction methods to achieve high-performance video classification. For action recognition tasks with few samples, Cross Transformer constructs frame groups at the frame level and achieves video classification tasks by matching similar relationships between different video samples.

[0007] Transformer-based algorithms achieve high performance, but the introduction of the temporal dimension of video sequences increases the computational burden. The Swin Transformer algorithm proposed in recent years reduces the computational resources required for image classification tasks. However, for video classification tasks, the Video Swin Transformer generates a three-dimensional local window to implement self-attention calculations, which greatly increases the computational resources required compared to two-dimensional window convolution.

[0008] For video understanding tasks, Transformer-based algorithms have demonstrated unprecedented recognition accuracy, but due to the characteristics of the Transformer unit itself, converting 2D image recognition tasks to 3D video understanding tasks will introduce a huge computational burden. In recent years, Transformer has been introduced from natural language processing tasks to image processing tasks, and there has been relatively little research on video understanding tasks. Most existing methods perform self-attention operations on feature dimensions after feature aggregation, and do not model independent features of video sequences in time and space dimensions. Summary of the invention

[0009] In order to overcome the shortcomings of the above-mentioned prior art, the present invention provides a human action recognition method based on multi-scale features, which is based on Swin Transformer and adopts feature-level self-attention calculation and feature fusion, retaining the high precision of the Transformer algorithm while reducing the computational burden required by the algorithm.

[0010] To achieve the above objectives, one or more embodiments of the present invention provide the following technical solutions:

[0011] In a first aspect, a method for human action recognition based on multi-scale features is disclosed, comprising:

[0012] Use convolutional networks to obtain spatial features of video sequences;

[0013] A local window is taken in the time dimension for the spatial features, and calculation is performed within the local window to obtain the maximum response based on the primary local features;

[0014] Processing the maximum response based on the primary local features to obtain secondary features;

[0015] For the secondary features, a local window is taken in the time dimension, and calculation is performed within the local window to obtain the maximum response based on the secondary local features;

[0016] The final action classification is obtained by weighted fusion of the maximum response based on primary local features and the maximum response based on secondary local features. The obtained features correspond to the short-term, medium-term and long-term features of the video sequence.

[0017] Human action recognition is performed based on the above features.

[0018] As a further technical solution, a convolutional network is used to obtain the spatial features of the video sequence, specifically:

[0019] For a video sequence containing T frames, features are extracted for each frame through a 2D convolutional neural network to obtain a feature representation of T×HW dimensions.

[0020] As a further technical solution, a shift operation is performed on the maximum response based on the primary local features, and a self-attention calculation is performed to expand the receptive field of the model.

[0021] As a further technical solution, the first-layer Swin Transformer unit is used to process the features after the shift operation, and the generated secondary features are locally fused on the secondary features. The fusion ratio is N, and the generated size is T / N×HW dimensional features.

[0022] As a further technical solution, a shift operation is performed on the secondary features, and self-attention calculation is performed to expand the receptive field of the model.

[0023] As a further technical solution, the second layer Swin Transformer unit is used to process the features after the shift operation, and the generated secondary features are locally fused. The fusion ratio is N, and the generated size is T / N. 2 ×HW dimension features.

[0024] As a further technical solution, the classification results corresponding to the features at different levels are fused in a weighted manner. The specific mathematical expression of the implementation form is:

[0025] C=argmax(softmax(R1)+α·softmax(R2)+β·softmax(R3)).

[0026] In the second aspect, a human action recognition system based on multi-scale features is disclosed, including:

[0027] The spatial feature acquisition module is configured to: acquire the spatial features of the video sequence using a convolutional network;

[0028] The maximum response acquisition module of the primary local feature is configured to: take a local window in the time dimension for the spatial feature, and perform calculation within the local window to obtain the maximum response based on the primary local feature;

[0029] The maximum response acquisition module of the secondary local feature is configured to: process the maximum response based on the primary local feature to obtain the secondary feature;

[0030] For the secondary features, a local window is taken in the time dimension, and calculation is performed within the local window to obtain the maximum response based on the secondary local features;

[0031] The action classification module is configured to obtain the final action classification by weighted fusion of the maximum response based on the primary local feature and the maximum response based on the secondary local feature, and the obtained features correspond to the short-term, medium-term and long-term features of the video sequence.

[0032] One or more of the above technical solutions have the following beneficial effects:

[0033] The present invention proposes a multi-scale fusion algorithm based on Swin Transformer, which realizes spatial feature extraction through a two-dimensional convolutional network, and realizes the fusion of short-term and long-term temporal features at the feature level through a multi-layer structure, so as to achieve higher performance of human action recognition, while reducing the computational load required by the algorithm.

[0034] The present invention performs short-term and long-term modeling on time series to improve the performance of action recognition algorithms.

[0035] The present invention is based on the Swin Transformer algorithm, retains the superiority of the Transformer unit, and the model operates on two-dimensional convolution, reducing the consumption of computing resources.

[0036] Advantages of additional aspects of the present invention will be given in part in the following description, and in part will become obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] The accompanying drawings in the specification, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.

[0038] Figure 1 This is a flow chart of a method according to an embodiment of the present invention;

[0039] Figure 2 This is a schematic diagram of the method of an embodiment of the present invention;

[0040] Figure 3 Schematic diagram of the position change operation process in the prior art. DETAILED DESCRIPTION

[0041] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present invention belongs.

[0042] It should be noted that the terms used herein are for describing specific embodiments only and are not intended to be limiting of exemplary embodiments according to the present invention.

[0043] In the absence of conflict, the embodiments of the present invention and the features of the embodiments may be combined with each other.

[0044] Nowadays, action recognition algorithms have been deployed in different application scenarios, such as power plants, factories, streets and other scenes with relatively complex background environments. For spatiotemporal feature extraction, the algorithm needs to identify the location of humans in different environments and identify some features that contribute more to action classification. Due to the diversity of human actions, action recognition algorithms with better performance need to recognize more fine-grained actions. For different actions, the execution time of the execution object is relatively different, which requires the action recognition algorithm to consider both short-term features (short-term) and long-term features (long-term) in the time dimension. Due to the requirements of current monitoring-level equipment, action recognition algorithms need to ensure relatively high recognition accuracy. For the currently popular action recognition methods, the Transformer-based method shows more superior performance on different data sets.

[0045] Embodiment 1

[0046] See attached Figure 1 , 2 As shown, this embodiment discloses a method for human action recognition based on multi-scale features, including:

[0047] For a video sequence containing T frames, the implementation of this model first extracts features from each frame through a 2D convolutional neural network to obtain a feature representation of T × HW dimensions;

[0048] Take a local window ΔT in the time dimension, perform self-attention calculation within the window, and obtain the maximum response R1 based on the primary local features.

[0049] The primary features are shifted and self-attention is calculated to expand the receptive field of the model.

[0050] The above HW represents the size of the feature map extracted by the neural network. It is reshaped to form a feature vector of 1*HW dimension, and then T frames are stacked to form a feature map of T*HW dimension. The shift operation is an operation of the SwinTransformer algorithm. For the H*W feature map, it means cutting it into different sizes in the H or W dimension, and then performing a position transformation operation to expand the receptive field, such as Figure 3 In this embodiment, Figure 3 The difference is that the shift operation is only performed in the T dimension, that is, different frames are cut and moved to other locations.

[0051] In this example, each frame of the image is subjected to feature extraction using 2D convolution, and Self-attention calculation is performed after taking ΔT in the time dimension through SwinTransformer. The network can focus on the more noteworthy parts in the time and space dimensions, that is, form a more discriminative feature vector. Finally, the classification scores of each category are obtained through the fully connected layer and the Softmax layer to achieve action classification.

[0052] For the secondary features generated by the first-layer Swin Transformer unit, local feature fusion is performed with a fusion ratio of N, and the generated size is T / N×HW dimensional features.

[0053] For secondary features, a local window ΔT is taken in the time dimension, and self-attention calculation is performed within the window to obtain the maximum response R2 based on the secondary local features.

[0054] The secondary features are shifted and self-attention is calculated to expand the receptive field of the model.

[0055] For the secondary features generated by the second-layer Swin Transformer unit, continue to perform local feature fusion, the fusion ratio is N, and the generated size is T / N 2 ×HW dimension features.

[0056] For the secondary features, a local window ΔT is taken in the time dimension, and self-attention calculation is performed within the window to obtain the maximum response R3 based on the secondary local features.

[0057] For the responses R1-R3 generated by the three-layer Swin Transformer unit, the final action classification result is obtained by weighted fusion.

[0058] Regardless of the batch size, the input video sequence contains T frames of images. Each frame of the image passes through the 2D CNN and is reshaped to form a feature vector of size 1*HW, and then is arranged to form a feature map of dimension T*HW. ΔT is the number of frames contained in the local window when the Swin Transformer is operated.

[0059] Self-attention calculation process

[0060]

[0061] The self-attention algorithm used by the Swin transformer is consistent with the conventional self-attention algorithm. The three matrices Q, K, and V represent Query, Key, and Value, respectively, and come from the same input, which is generally obtained through three different fully connected layers. B is the bias. The algorithm first calculates the dot product between Q and K. In order to prevent the result from being too large, it is divided by a scale, and the dimension d is the dimension of the query and key vectors. The result is normalized to a probability distribution using the Softmax operation, and then multiplied by the matrix V to obtain the representation of the weighted sum.

[0062] The complete Swin transformer consists of three modules. The input of the first module is the features formed after the video sequence passes through 2DCNN, which is called the primary feature. The features after passing through the first module are called secondary features. After patch merging, the secondary features serve as the input of the second module, and so on.

[0063] Each module of the Swin transformer mainly consists of two units. The first is a Window based Self attention unit, and the second is a Shift Window based Self attention unit. In the first unit, we obtain a local feature response R1 through the Self-attention operation. This feature becomes S1 as part of the final classification basis after passing through Softmax. Then the feature R1 will pass through the Shift Window based Selfattention unit, expand the receptive field through the shift operation, and perform self-attention calculation to form a secondary feature. At this point, the operation in a Swin Transformer module is completed. After that, the secondary feature is patch merged and used as the input of the first unit of the next module.

[0064] The role of patch merge

[0065] The fusion ratio is N, that is, the features corresponding to every N frames are merged, and after merging, ΔT is taken to operate in the next Swin Transformer Block. Then ΔT contains more frame information, which expands the local receptive field. At this time, the local maximum response R2 at another level is obtained through self-attention calculation, and S2 obtained through Softmax becomes part of the final classification result.

[0066] Swin transformer is used for image classification tasks and can obtain features at different levels. We use it in the classification task of time series to obtain features of different time dimensions and realize short-term and long-term (sort term and long term) time series fusion.

[0067] The obtained three-level features correspond to the short-term, medium-term and long-term features of the video sequence, and the temporal receptive field is expanded through the shift operation. The classification results corresponding to the features at different levels are fused in a weighted manner. The specific mathematical representation of the implementation form is:

[0068] C=argmax(softmax(R1)+α·softmax(R2)+β·softmax(R3))

[0069] Among them, C is the final action category label. αβ respectively represent two weight coefficients, which are finally determined through ablation experiments, and R1-R3 are the three-level local feature responses mentioned above.

[0070] As a global implementation, the model achieves spatial feature extraction through frame-level 2D convolution. It also uses Swin Transformer to perform self-attention calculations in the time dimension to achieve short-term and long-term temporal feature extraction, and achieves multi-scale feature fusion through weighted merging.

[0071] Embodiment 2

[0072] The purpose of this embodiment is to provide a computing device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the steps of the above method are implemented when the processor executes the program.

[0073] Embodiment 3

[0074] The purpose of this embodiment is to provide a computer-readable storage medium.

[0075] A computer-readable storage medium stores a computer program, which executes the steps of the above method when executed by a processor.

[0076] Embodiment 4

[0077] The purpose of this embodiment is to provide a human action recognition system based on multi-scale features, including:

[0078] The spatial feature acquisition module is configured to: acquire the spatial features of the video sequence using a convolutional network;

[0079] The maximum response acquisition module of the primary local feature is configured to: take a local window in the time dimension for the spatial feature, and perform calculation within the local window to obtain the maximum response based on the primary local feature;

[0080] The maximum response acquisition module of the secondary local feature is configured to: process the maximum response based on the primary local feature to obtain the secondary feature;

[0081] For the secondary features, a local window is taken in the time dimension, and calculation is performed within the local window to obtain the maximum response based on the secondary local features;

[0082] The action classification module is configured to obtain the final action classification by weighted fusion of the maximum response based on the primary local feature and the maximum response based on the secondary local feature, and the obtained features correspond to the short-term, medium-term and long-term features of the video sequence.

[0083] The steps involved in the apparatuses of the above embodiments 2, 3 and 4 correspond to the method embodiment 1, and the specific implementation methods can refer to the relevant description part of embodiment 1. The term "computer-readable storage medium" should be understood as a single medium or multiple media including one or more instruction sets; it should also be understood to include any medium that can store, encode or carry an instruction set for execution by a processor and enable the processor to execute any method in the present invention.

[0084] Those skilled in the art should understand that the modules or steps of the present invention described above can be implemented by a general-purpose computer device, or alternatively, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. The present invention is not limited to any specific combination of hardware and software.

[0085] Although the above describes the specific implementation mode of the present invention in conjunction with the accompanying drawings, it is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art on the basis of the technical solution of the present invention without creative work are still within the scope of protection of the present invention.

Claims

1. A human action recognition method based on multi-scale features, characterized by including: Use convolutional networks to obtain spatial features of video sequences; A local window is taken in the time dimension for the spatial feature, and the maximum response R1 based on the primary local feature is obtained by calculation within the local window; Processing the maximum response based on the primary local feature to obtain the first secondary feature; For the first secondary feature, a local window is taken in the time dimension, and a maximum response R2 based on the first secondary local feature is obtained by calculation within the local window; Processing the maximum response based on the first local feature to obtain a second secondary feature; For the second secondary feature, a local window is taken in the time dimension, and a maximum response R3 based on the second secondary local feature is obtained by calculation within the local window; The maximum response based on the primary local feature, the maximum response based on the first secondary local feature, and the maximum response based on the second secondary local feature are weighted fused to obtain the final action classification. The specific mathematical formula is: C=argmax(softmax(R1)+α·softmax(R2)+β·softmax(R3)) Among them, C is the final action category label; α and β represent two weight coefficients, which are finally determined through ablation experiments; The above three features correspond to the short-term, medium-term, and long-term characteristics of the video sequence; The convolutional network is used to obtain the spatial features of the video sequence, specifically: For a video sequence containing T frames, a 2D convolutional neural network is used to extract features from each frame to obtain a feature representation of T×HW dimensions; A local window is taken in the time dimension for the spatial features, and calculations are performed within the local window to obtain the maximum response based on the primary local features; specifically: After taking ΔT in the time dimension, the extracted features are input into the first unit of the first Swin Transformer module for Self attention calculation, so that the network can focus on the more noteworthy parts in the time and space dimensions, that is, to form a more discriminative R1; The specific process from R1 to R3 is: Input R1 to the second unit of the first Swin Transformer module, perform a shift operation on the maximum response based on the primary local feature, and perform a self-attention calculation to expand the model receptive field, generate the first secondary feature, perform local feature fusion on the first secondary feature, and generate a feature with a size of T / N×HW dimensions; For the first secondary feature after fusion, take a local window in the time dimension and input it into the first unit of the second SwinTransformer module to perform self-attention calculation to obtain R2; The second unit of the second Swin Transformer module is used to perform shift operation and self-attention calculation on R2 to generate the second secondary feature, and local feature fusion is performed on the second secondary feature. The fusion ratio is N, and the generated size is T / N. 2 ×HW dimension features; For the fused second-level features, take a local window in the time dimension and input it into the first unit of the third SwinTransformer module to perform self-attention calculation to obtain R3; The Swin transformer module is specifically: Each module of the Swin transformer mainly consists of two units, the first is a Window based Selfattention unit, and the second is a Shift Window based Self attention unit. In the first unit, a local feature response R is obtained through the Self-attention operation, which is the maximum response based on the input feature. This feature is used as part of the final classification basis after passing through Softmax. At the same time, R will pass through the Shift Window based Selfattention unit, expand the receptive field through the shift operation, and perform self-attention calculation to form a secondary feature. After that, The secondary features are patch merged and a local window is taken in the time dimension as the input of the next SwinTransformer module.

2. A human action recognition system based on multi-scale features, which can be used to implement the human action recognition method based on multi-scale features as claimed in claim 1, characterized in that: include: The spatial feature acquisition module is configured to: acquire the spatial features of the video sequence using a convolutional network; The maximum response acquisition module of the primary local feature is configured to: take a local window in the time dimension for the spatial feature, and perform calculation within the local window to obtain the maximum response based on the primary local feature; The maximum response acquisition module of the first secondary local feature is configured to: process the maximum response based on the primary local feature to obtain the first secondary feature; A local window is taken for the first secondary feature in the time dimension, and a maximum response based on the first secondary local feature is obtained by calculation within the local window; The maximum response acquisition module of the second secondary local feature is configured to: process the maximum response based on the first secondary local feature to obtain the second secondary feature; For the second-level feature, a local window is taken in the time dimension, and calculation is performed within the local window to obtain the maximum response based on the second-level local feature; The action classification module is configured to obtain the final action classification by weighted fusion of the maximum response based on the primary local feature, the maximum response based on the first secondary local feature, and the maximum response based on the second secondary local feature. The above three features correspond to the short-term, medium-term, and long-term features of the video sequence.

3. A computing device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method according to claim 1 when executing the program.

4. A computer-readable storage medium having a computer program stored thereon, wherein when the program is executed by a processor, the steps of the method according to claim 1 are performed.