Space-time action detection method based on multi-task learning lightweight Transform and related device

Through multi-task learning lightweight Transformer method, combined with 2D convolutional neural network and lightweight Transformer, spatio-temporal features are extracted and the loss function is optimized, which solves the problem of difficulty in balancing efficiency and accuracy in the existing technology and achieves efficient and accurate spatio-temporal actions. detection.

CN118799784APending Publication Date: 2024-10-18XIDIAN UNIV +2

Patent Information

Application Number
CN202410923362.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-10
Publication Date
2024-10-18

AI Technical Summary

Technical Problem

Existing spatiotemporal action detection technology is difficult to balance between efficiency and accuracy, and cannot effectively capture long-term features in videos, resulting in large amounts of calculations, complex models, and difficulty in real-time processing.

Method used

The lightweight Transformer method based on multi-task learning is adopted to extract spatiotemporal features through 2D convolutional neural network and lightweight Transformer, combine the constructor and lightweight fusion module for feature fusion, and use multi-task learning ideas to define the loss function, optimize classification and Positioning tasks.

Benefits of technology

It is possible to improve the efficiency and accuracy of spatiotemporal action detection while reducing the number of model parameters and calculation amount, and can better adapt to complex scenes and balance the efficiency and accuracy of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118799784A_ABST
    Figure CN118799784A_ABST
Patent Text Reader

Abstract

The invention discloses a multi-task learning lightweight Transform-based space-time motion detection method and a related device, and the method comprises the steps: obtaining a to-be-processed video frame group and a label thereof based on existing video data, and carrying out the preprocessing of the to-be-processed video frame group; constructing a training model comprising a spatial-temporal feature extraction network pair, a constructor and a lightweight fusion module; training to-be-processed video data by using the training model, and extracting spatial-temporal characteristics of a to-be-processed video to obtain a final prediction and bounding box; a loss function is defined by adopting a multi-task learning thought on spatial-temporal features, and classification and positioning tasks are realized. The spatial-temporal information is extracted through a lightweight structure, the defect that a traditional neural network or a 3D Transform is used in a traditional method is overcome, a lightweight 2D Transform method is adopted, the number of model parameters is reduced, feature reconstruction and multi-task learning thoughts are adopted, and balance of efficiency and precision is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field, and specifically relates to a spatiotemporal action detection method and related devices based on multi-task learning lightweight Transformer. Background Art

[0002] With the increasing demand for video shooting, faster video transmission and larger video storage space in recent years, a large amount of video data has been accumulated in various scenarios, and a tool is needed to effectively manage, analyze and process videos. Video understanding aims to automatically identify and parse the content in the video through intelligent analysis technology. Video understanding algorithms meet the needs of this era. Therefore, they have received widespread attention and achieved rapid development in recent years. Driven by the needs of many applications such as video surveillance and autonomous driving, spatial-temporal action detection (STAD) has become an important research field in video understanding. The diversity of action categories and positioning accuracy are the two major difficulties faced by the spatial-temporal action detection task. The former requires the algorithm to be able to distinguish and identify the diverse action types in the video, while the latter emphasizes the ability of the algorithm to accurately lock the location of the action in a complex background. Therefore, extracting more accurate and rich spatial-temporal representation information and achieving overall optimization of the task have become the key to solving this task. Existing technologies process the extracted features by setting up a classification head and a detection head. However, when designing the loss function, the effect of the overall task is directly considered without independently considering the effects of classification and detection. Therefore, how to set the loss function to combine the two subtasks more effectively is a difficult point.

[0003] In addition, video data has the characteristics of large data volume, diverse actions, and many detection targets. One of the key challenges in this field is how to model the spatiotemporal information in the video. Therefore, choosing an effective algorithm for video understanding has become an important issue. At present, researchers have proposed many methods based on convolutional neural networks, which have shown excellent performance. However, this solution directly based on convolutional neural networks has a very limited ability to model the temporal characteristics of the video and cannot effectively capture long temporal characteristics.

[0004] Spatiotemporal action detection aims to classify the actions that appear in the video and locate them in space and time. Existing technologies process the extracted features by setting up a classification head and a detection head, but directly consider the effect of the overall task when designing the loss function, without considering the effects of classification and detection independently. In addition, video data has the characteristics of large data volume, diverse actions, and many detection targets. One of the key challenges in this field is how to model the spatiotemporal information in the video. According to the characteristics of the Transformer model, many researchers have introduced the 3D Transformer model in the task, which can establish the long-order dependency of the video, which is of great significance for real-world applications. In the process of video data processing, the large amount of data and the amount of computation are still a problem in reality. The introduction of the 3D Transformer model will make the network larger, the amount of computation will surge, and it will be more difficult to achieve real-time processing. In addition to the complexity and computational requirements of the model itself, the amount of data also has a significant impact on efficiency. A large amount of spatiotemporal data needs to be read, parsed, and processed, which not only increases the computational burden, but also may cause bottlenecks in memory and storage space. There are many methods that try to reduce visual markers through sampling and masking to achieve fast calculation, but it is still challenging for STAD to strike a balance between accuracy and efficiency. Therefore, lightweight video understanding technology comes into our view. In lightweight video understanding, how to ensure a good accuracy result while lightweighting the model and reducing the amount of calculation is our current goal.

[0005] Currently, the closest implementation is YOWOv2. This model uses the backbone and feature pyramid (FPN) of YOLOv7 as the 2D branch to extract multi-level spatial features from the current frame. It also uses an efficient 3D convolutional neural network (CNN) as the 3D branch to extract spatiotemporal features from video clips for spatiotemporal association. The loss of this model is the proportional addition of confidence loss, classification loss, and bounding box regression loss.

[0006] With the remarkable development of deep neural networks, especially convolutional neural networks and transformers, STAD has made many significant progress. Many models adopt a two-stream architecture to decouple the spatiotemporal feature extraction process into the learning of frame-by-frame RGB and optical flow data, while incorporating appearance and motion cues. To address the problem that the above methods ignore temporal contextual relationships, other methods extend frame-by-frame detection to clip-level detection. These methods input a continuous group of frames and directly infer a series of bounding boxes of the action. In addition to the above methods that capture motion features in videos through optical flow, since the occurrence of actions is a continuous concept, the latest action detectors also use 3D CNN and 3D Transformer to extract spatiotemporal information from video clips to accurately detect actions. 3D models have powerful spatial information display and interactivity, which can provide a more intuitive and rich visual experience. However, larger backbone networks and more complex architectures require a lot of computing requirements and have the problem of poor detection speed, which makes them unable to run in real time. In addition to the complexity and computing requirements of the model itself, the amount of data also has a significant impact on efficiency. A large amount of spatiotemporal data needs to be read, parsed, and processed, which not only increases the computing burden, but also may cause bottlenecks in memory and storage space. There are many methods that try to reduce visual tags to achieve fast calculations by adopting lightweight models or sampling and masking spatiotemporal tokens. Although these methods solve the problem that existing models are too expensive in calculation, they make it difficult to balance the efficiency and accuracy of the models to a certain extent. In addition, when solving the STAD task, existing models simply add the losses of classification and positioning, without considering the connection between the various targets and the optimal balance between the two subtasks. Summary of the invention

[0007] The technical problem to be solved by the present invention is to provide a spatiotemporal motion detection method and related devices based on a multi-task learning lightweight Transformer to address the deficiencies in the above-mentioned prior art, so as to solve the technical problem that it is difficult to balance the efficiency and accuracy of the existing models, extract spatiotemporal information using a lightweight structure, and then obtain the final classification and positioning results based on the multi-task learning idea.

[0008] The present invention adopts the following technical solutions:

[0009] The spatiotemporal action detection method based on multi-task learning lightweight Transformer includes the following steps:

[0010] S1. Based on the existing video data, obtain the video frame group to be processed and its labels, and pre-process the video frame to be processed;

[0011] S2, building a training model including a spatiotemporal feature extraction network pair, a constructor, and a lightweight fusion module;

[0012] S3, using the training model obtained in step S2 to train the video data to be processed obtained in step S1, extracting the spatiotemporal features of the video to be processed, and obtaining the final prediction and bounding box;

[0013] S4. Define the loss function using the multi-task learning idea based on the spatiotemporal features obtained in step S3 to achieve classification and positioning tasks.

[0014] Preferably, step S1 specifically includes:

[0015] S101, obtain video frame group X and frame x i The labels of , i.e., the target box and the motion category;

[0016] S102, performing data enhancement on the video frame group X to obtain a frame group X′;

[0017] S103, applying the inter-frame difference method to the last T-1 frames in the frame group X′ to obtain the motion trend of the video, and adding them proportionally to the first frame processed by the background subtraction method to obtain data X″.

[0018] Preferably, assuming that a total of T frames are required, the video frame group X is:

[0019] X={x i ,x i-d ,…,x i-(T-2)*d ,x i-(T-1)*d}

[0020] Where d is the sampling frequency.

[0021] Preferably, in step S2, the spatiotemporal feature extraction network pair includes:

[0022] Spatial feature extraction module, including the two-dimensional convolutional neural network Darknet;

[0023] The spatiotemporal feature extraction module is a two-dimensional adaptive sampling ladder Transformer, including convolutional stem, MobileNetV2, squeeze excitation block and lightweight ladder self-attention block;

[0024] Constructors, including deconvolution and linear interpolation with different step sizes;

[0025] The lightweight fusion module adopts the channel fusion + attention mechanism solution, including ordinary convolution, depth-wise separable convolution, attention mechanism, batch normalization layer and non-linear activation layer LeakyReLU.

[0026] Preferably, step S3 is specifically:

[0027] S301, X s Input into Darknet to extract features

[0028] S302, input X″ into LTAS to extract features

[0029] S303, feature F s and F t Input into Constructor to obtain 4D feature group F′ s and F′ t ;

[0030] S304, group 4D features F′ s and F′ t Input into LFM to extract features

[0031] S305, the detection head is a common 1×1 convolution, which inputs the extracted feature F to obtain the final prediction N A is the number of anchor boxes, N C is the number of action categories, 1 is the confidence of the bounding box, and 4 is the coordinate offset of the bounding box (t x ,t y ,t w ,t h );

[0032] S306 , decoupling the coordinates of the bounding box.

[0033] Preferably, step S4 is specifically:

[0034] S401, define the loss function of each part, which includes three parts: confidence loss, category loss, and bounding box regression loss;

[0035] S402. Define a total loss function based on the multi-task learning idea. The total loss function includes target box detection loss and action category classification loss.

[0036] Preferably, the confidence loss L conf , category loss L cls and bounding box width and height regression loss L wh as follows:

[0037]

[0038] Where N is the number of prediction boxes, S is the size of the grid, and λ obj and λ noobj is the penalty factor, If the bounding box j in grid i contains the target, it is 1, otherwise it is 0. j is the center point coordinate, If the bounding box j in grid i contains the target, it is 0, and if it does not contain the target, it is 1. focal is a loss function designed for the problem of class imbalance, a j is the target category, L 1,smooth is the L1 norm loss function after smoothing, is the width of the bounding box, is the height of the bounding box.

[0039] In a second aspect, an embodiment of the present invention provides a spatiotemporal action detection system based on a multi-task learning lightweight Transformer, including:

[0040] The preprocessing module obtains the video frame group to be processed and its labels based on the existing video data, and preprocesses the video frame to be processed;

[0041] Building module, building a training model including spatiotemporal feature extraction network pair, constructor and lightweight fusion module;

[0042] The training module uses the training model to train the video data to be processed, extracts the spatiotemporal features of the video to be processed, and obtains the final prediction and bounding box;

[0043] The detection module uses multi-task learning ideas to define the loss function based on spatiotemporal features to achieve classification and positioning tasks.

[0044] In a third aspect, a computer device comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the above-mentioned spatiotemporal action detection method based on multi-task learning lightweight Transformer are implemented.

[0045] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, including a computer program, which, when executed by a processor, implements the steps of the above-mentioned spatiotemporal action detection method based on multi-task learning lightweight Transformer.

[0046] Compared with the prior art, the present invention has at least the following beneficial effects:

[0047] The spatiotemporal action detection method based on multi-task learning lightweight Transformer can extract spatial and temporal information through 2DCNN and lightweight Transformer with token sampling, and then use the constructor to construct 4-dimensional features and use a lightweight multi-layer feature fusion module to fuse features of different layers for classification and positioning. Finally, the classification and positioning results are used with a loss based on multi-task learning to improve the overall performance of the task.

[0048] Furthermore, the video frame group to be processed and its label are obtained through the existing video data, and the video frame group to be processed is preprocessed. Since there are many video frames and the background information is relatively redundant, the main temporal feature information is obtained through inter-frame difference and background subtraction.

[0049] Furthermore, 2D CNN and lightweight Transformer with token sampling are used to extract spatial and temporal information. The input constructor constructs 4-dimensional features and then inputs them into the lightweight multi-layer feature fusion layer for feature fusion. The lightweight structure reduces the number of parameters, and token sampling reduces the amount of input data, thereby increasing the model efficiency and generalization ability.

[0050] Furthermore, deconvolution and linear interpolation with different step sizes are used to capture information lost by the deep network, effectively extract the texture and shape information of the image, enhance the robustness of the model, and enable the model to better adapt to complex and changeable actual scenes.

[0051] Furthermore, a lightweight fusion module is used to fuse features. The depthwise separable convolution can significantly reduce the computational complexity and parameters of the model. Channel attention allows the model to assign different weights to different channels, thereby emphasizing or suppressing certain features, allowing the model to better focus on the important features of the input data.

[0052] Furthermore, through training, the system learns how to extract key spatiotemporal features from video data and converts them into prediction results and bounding boxes for action detection, thereby achieving supervised learning and iterative optimization of the model.

[0053] Furthermore, a loss function based on the idea of ​​multi-task learning is adopted. This loss function not only integrates the losses of the two tasks of classification and positioning, but also considers the balance and optimization between them. It can more comprehensively capture the diversity of data and the complexity of tasks, thereby achieving more efficient and accurate model training.

[0054] It can be understood that the beneficial effects of the second to fourth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here.

[0055] In summary, the present invention extracts spatiotemporal information through a lightweight structure, overcomes the shortcomings of traditional methods using traditional neural networks or 3D Transformers, and adopts a lightweight 2D Transformer method to reduce the number of model parameters. In addition, the idea of ​​feature reconstruction and multi-task learning is adopted to achieve a balance between efficiency and accuracy.

[0056] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] Figure 1 It is the global structure diagram;

[0058] Figure 2 This is the overall structure diagram of LTAS;

[0059] Figure 3 Detailed structural diagram of LLSA, where (a) is W-MHSA and (b) is PSW-MHSA;

[0060] Figure 4 A schematic diagram of a computer device provided by an embodiment of the present invention;

[0061] Figure 5 The block diagram of a chip provided according to an embodiment of the present invention. DETAILED DESCRIPTION

[0062] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0063] In the description of the present invention, it should be understood that the terms “include” and “comprises” indicate the presence of described features, wholes, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or collections thereof.

[0064] It should also be understood that the terms used in the present specification are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the present specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0065] It should be further understood that the term "and / or" used in the present specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes these combinations. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in the present invention generally indicates that the associated objects are in an "or" relationship.

[0066] It should be understood that, although the terms first, second, third, etc. may be used to describe preset ranges, etc. in the embodiments of the present invention, these preset ranges should not be limited to these terms. These terms are only used to distinguish preset ranges from each other. For example, without departing from the scope of the embodiments of the present invention, the first preset range may also be referred to as the second preset range, and similarly, the second preset range may also be referred to as the first preset range.

[0067] The word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.

[0068] Various structural schematic diagrams of the embodiments disclosed in the present invention are shown in the accompanying drawings. These figures are not drawn to scale, and some details are magnified and some details may be omitted for the purpose of clear expression. The shapes of various regions and layers shown in the figures and the relative sizes and positional relationships therebetween are only exemplary, and may deviate in practice due to manufacturing tolerances or technical limitations, and those skilled in the art may additionally design regions / layers with different shapes, sizes, and relative positions according to actual needs.

[0069] The present invention provides a spatiotemporal action detection method based on multi-task learning lightweight Transformer. Through a dual-branch network, a lightweight 2D model is adopted, and the respective advantages of CNN and Transformer models are combined to effectively balance performance and computational efficiency. From the perspective of reducing spatiotemporal tokens, an adaptive sampling strategy is proposed to achieve accurate capture of key information. In order to further increase the richness of information and provide better spatiotemporal resolution, a constructor is designed to construct the extracted features into multi-scale features; finally, a loss function inspired by the multi-task learning idea is introduced, which regards the spatiotemporal action detection task as an organic combination of two subtasks, action classification and target detection, to achieve comprehensive optimization of the overall task.

[0070] See also Figure 1 The present invention provides a spatiotemporal action detection method based on multi-task learning lightweight Transformer, comprising the following steps:

[0071] S1. Based on the existing video data, obtain the video frame group to be processed and its labels, and pre-process the video frames;

[0072] S101, obtain a video frame group X, assuming that a total of T frames are required, then

[0073] X={x i ,x i-d ,…,x i-(T-2)*d ,x i-(T-1)*d}

[0074] Where d is the sampling frequency.

[0075] Let X s =x i , at this time X s Indicates a key frame. At the same time, get frame x i The labels of , i.e., the target box and the motion category;

[0076] S102, after obtaining the frame group X, perform data enhancement such as scaling, dithering, and distortion on it to obtain the frame group X′. Since the data and labels of the detection task need to correspond one to one, once the image data is enhanced, the target frame will change, and the label also needs to be modified accordingly;

[0077] S103, after obtaining the data enhanced frame group X', apply the inter-frame difference method to the last T-1 frames in X' to obtain the motion trend of the video, and add it to the first frame processed by the background subtraction method according to a certain ratio to obtain data X".

[0078] S2, set up the spatiotemporal feature extraction network pair, constructor and lightweight fusion module to complete the training model construction;

[0079] See also Figure 1 After obtaining the video frame group, the current frame is input into the spatial feature extraction module composed of Darknet to extract the spatial information of the video frame; the frame group is processed by frame difference, background subtraction and other methods and then input into the spatiotemporal feature extraction module with the 2D lightweight Transformer model LTAS as the main trunk. The features extracted by the two branches are reconstructed into 4-dimensional features using Constructor and input into the lightweight fusion module for fusion. Finally, the loss function designed based on the multi-task learning concept of the present invention is used for training.

[0080] The spatiotemporal feature extraction network pair includes a spatial feature extraction module and a spatiotemporal feature extraction module.

[0081] Among them, the spatial feature extraction module is composed of a two-dimensional convolutional neural network Darknet;

[0082] The spatiotemporal feature extraction module is a two-dimensional adaptive sampling ladder transformer (LTAS), which consists of a convolutional stem, MobileNetV2, a squeeze-and-excitation (SE) block, and a lightweight ladder self-attention (LLSA) block.

[0083] The constructor consists of deconvolution and linear interpolation with different step sizes.

[0084] The Lightweight Fusion Module (LFM) adopts the "channel fusion + attention mechanism" solution, including ordinary convolution, depthwise separable (DW) convolution, attention mechanism, batch normalization layer (BN) and non-linear activation layer LeakyReLU.

[0085] See also Figure 2 , LLSA consists of a lightweight progressive shift attention mechanism (LPSA) and a pixel adaptive fusion module (PAFM); the features processed by operations such as frame difference are input into LTAS. Unlike traditional ViT, LTAS uses convolutional stem pairs for feature extraction, which can simulate local interactions with implicit inductive biases. The extracted features first pass through two lightweight convolution blocks (MobileNetV2 blocks and squeeze and excitation (SE) blocks), and then are input into the lightweight step self-attention module (LLSA). In LLSA, W-MHSA and PSW-MHSA are combined with shift operations to achieve the reduction of computational complexity while expanding the receptive field. "Shift 1" and "Shift 2" represent shift operations in different directions. "d 1 ” and “d 2 " indicates the number of channels, d 1 =3d 2 .

[0086] See also Figure 3 , LPSA divides the input feature map into several equal proportions along the channel dimension and sends these features to multiple branches. The input features of the first branch are processed using W-MHSA without shifting operations. Then, the output features of the current branch are passed to the subsequent branches and processed using PSW-MHSA. At the same time, while each branch performs self-attention, the tokens are scored and important tags are sampled based on the attention map.

[0087] LPSA includes window multi-head self-attention (W-MHSA), progressive shift window self-attention (PSW-MSHA), adaptive sampling (AS), layer normalization (LN), and lightweight feedforward network (LFFN). PAFM includes two fully connected layers, and the output features of all branches are connected and sent to two fully connected layers to produce weights for each pixel. LPSA divides the input feature map into several equal proportions along the channel dimension and sends these features to multiple branches. The input features of the first branch are processed using W-MHSA without shifting operations. Then, the output features of the current branch are passed to the subsequent branches and processed using PSW-MHSA. At the same time, while each branch performs self-attention, the tokens are scored and important tags are sampled according to the attention map.

[0088] S3, using the training model constructed in step S2 to train the video data preprocessed in step S1, extracting the spatiotemporal features of the video, and obtaining the final prediction and bounding box through the detection head;

[0089] S301, X s Input into Darknet to extract features

[0090] S302, input X'' into LTAS to extract features

[0091] The specific formula is as follows:

[0092]

[0093] F t =PAFM(O t )

[0094] Where t=0,1,2,…,I t is the input of the current branch, O t-1 is the output of the previous branch.

[0095] S303, feature F s and F t Input into Constructor to obtain 4D feature group F s ′ and F t ′;

[0096] S304, group 4D features into F s ′ and F t ′Input into LFM to extract features

[0097] First, we get the channel fusion module

[0098] F′=LeakyReLU(BN(conv(concat(F′ s ,F′ t )

[0099] Then, F′ is input into the attention module to obtain the feature F:

[0100] Q=K=V=flatten(F′)

[0101] H = softmax(H - max(H))

[0102] Where H = QK T is an attention matrix.

[0103] F=F′+∝F″

[0104] Among them, F″=HV is the output of the attention module, and ∝ is a constant used to control the proportion of F′ and F″.

[0105] S305, the detection head is a common 1×1 convolution, which inputs the extracted feature F to obtain the final prediction Among them, N A is the number of anchor boxes, N C is the number of action categories, 1 is the confidence of the bounding box, and 4 is the coordinate offset of the bounding box (t x ,t y ,t w ,t h );

[0106] S306. The coordinates of the bounding box can be decoupled using the following formula.

[0107] The coordinates of the bounding box are as follows:

[0108] c x =g x +σ(t x )

[0109] c y =g y +σ(t y )

[0110] b w =p w exp(t w )

[0111] b h =p h exp(t h )

[0112] Among them, c x and c yis the coordinate of the center point of the bounding box, g x and g y is the coordinate of the upper left corner of the grid, p w and p h is the width and height of the anchor box, b w and b h is the width and height of the bounding box.

[0113] S4. Use multi-task learning to define the loss function based on the extracted features to perform classification and positioning tasks.

[0114] S401, define the loss function of each part, which includes three parts: confidence loss, category loss, and bounding box regression loss;

[0115] Confidence loss:

[0116]

[0117] Where N is the number of prediction boxes, S is the size of the grid, and λ obj and λ noobj is the penalty factor.

[0118] Class loss:

[0119]

[0120] Among them, L focal (*) is defined as follows, where p t is the probability value predicted by the model, α t and γ are parameters, through α t The imbalance in the number of positive and negative samples can be suppressed, and the imbalance in the number of simple / difficult to distinguish samples can be controlled through γ:

[0121] L focal (p t )=-α t (1-p t ) γ log(p t )

[0122] Center point coordinate regression loss:

[0123]

[0124] Bounding box width and height regression loss:

[0125]

[0126] Among them, L 1,smooth (*) are defined as follows:

[0127]

[0128] S402. Define the total loss function based on the multi-task learning idea. Since the spatiotemporal action detection task can be divided into two subtasks: positioning and classification, the total loss is divided into two parts:

[0129] The first part is the target box detection loss:

[0130] L box =L conf +L xy +L wh

[0131] The second part is the action category classification loss L cls , at this time, the total loss can be defined as:

[0132] L=L τ (L box ,L cls )

[0133] Among them, the function L τ (*) are defined as follows:

[0134]

[0135] Where l = [l 1 ,…,l n ], n is the number of inputs.

[0136] In another embodiment of the present invention, a spatiotemporal motion detection system based on multi-task learning lightweight Transformer is provided, which can be used to implement the above-mentioned spatiotemporal motion detection method based on multi-task learning lightweight Transformer. Specifically, the spatiotemporal motion detection system based on multi-task learning lightweight Transformer includes a preprocessing module, a construction module, a training module and a detection module.

[0137] The preprocessing module obtains the to-be-processed video frame group and its labels based on the existing video data, and preprocesses the to-be-processed video frames;

[0138] Building module, building a training model including spatiotemporal feature extraction network pair, constructor and lightweight fusion module;

[0139] The training module uses the training model to train the video data to be processed, extracts the spatiotemporal features of the video to be processed, and obtains the final prediction and bounding box;

[0140] The detection module uses multi-task learning ideas to define the loss function based on spatiotemporal features to achieve classification and positioning tasks.

[0141] In another embodiment of the present invention, a terminal device is provided, which includes a processor and a memory, wherein the memory is used to store a computer program, the computer program includes program instructions, and the processor is used to execute the program instructions stored in the computer storage medium. The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. It is the computing core and control core of the terminal, which is suitable for implementing one or more instructions, and is specifically suitable for loading and executing one or more instructions to implement the corresponding method flow or corresponding function; the processor described in the embodiment of the present invention can be used for the operation of the spatiotemporal action detection method based on multi-task learning lightweight Transformer, including:

[0142] Based on the existing video data, obtain the group of video frames to be processed and their labels, and preprocess the video frames to be processed; build a training model including a spatiotemporal feature extraction network pair, a constructor and a lightweight fusion module; use the training model to train the video data to be processed, extract the spatiotemporal features of the video to be processed, and obtain the final prediction and bounding box; use the multi-task learning idea to define the loss function on the obtained spatiotemporal features to achieve classification and positioning tasks.

[0143] In another embodiment of the present invention, the present invention further provides a storage medium, specifically a computer-readable storage medium (Memory), which is a memory device in a terminal device for storing programs and data. It can be understood that the computer-readable storage medium here can include both the built-in storage medium in the terminal device and the extended storage medium supported by the terminal device. The computer-readable storage medium provides a storage space, which stores the operating system of the terminal. In addition, one or more instructions suitable for being loaded and executed by the processor are also stored in the storage space, and these instructions can be one or more computer programs (including program codes). It should be noted that the computer-readable storage medium here can be a high-speed RAM memory, or a non-volatile memory (Non-Volatile Memory), such as at least one disk memory.

[0144] The processor may load and execute one or more instructions stored in the computer-readable storage medium to implement the corresponding steps of the spatiotemporal action detection method based on multi-task learning lightweight Transformer in the above embodiment; one or more instructions in the computer-readable storage medium are loaded by the processor and executed as follows:

[0145] Based on the existing video data, obtain the group of video frames to be processed and their labels, and preprocess the video frames to be processed; build a training model including a spatiotemporal feature extraction network pair, a constructor and a lightweight fusion module; use the training model to train the video data to be processed, extract the spatiotemporal features of the video to be processed, and obtain the final prediction and bounding box; use the multi-task learning idea to define the loss function on the obtained spatiotemporal features to achieve classification and positioning tasks.

[0146] See also Figure 4 , the terminal device is a computer device, and the computer device 60 of this embodiment includes: a processor 61, a memory 62, and a computer program 63 stored in the memory 62 and executable on the processor 61. When the computer program 63 is executed by the processor 61, the method for calculating the composition of fluid in the reservoir transformation wellbore in the embodiment is realized. To avoid repetition, it is not described one by one here. Alternatively, when the computer program 63 is executed by the processor 61, the functions of each model / unit in the calculation system for the composition of fluid in the reservoir transformation wellbore in the embodiment are realized. To avoid repetition, it is not described one by one here.

[0147] The computer device 60 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The computer device 60 may include, but is not limited to, a processor 61 and a memory 62. Those skilled in the art will appreciate that Figure 4 This is only an example of the computer device 60 and does not constitute a limitation of the computer device 60. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the computer device may also include input and output devices, network access devices, buses, etc.

[0148] The processor 61 may be a central processing unit (CPU), or other general-purpose processors, central processing units, graphics processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, data processing logic based on quantum computing, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.

[0149] The memory 62 may be an internal storage unit of the computer device 60, such as a hard disk or memory of the computer device 60. The memory 62 may also be an external storage device of the computer device 60, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc., equipped on the computer device 60.

[0150] Furthermore, the memory 62 may include both an internal storage unit of the computer device 60 and an external storage device. The memory 62 is used to store computer programs and other programs and data required by the computer device. The memory 62 may also be used to temporarily store data that has been output or is to be output.

[0151] Any reference to memory, database or other media used in the embodiments provided in the present application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM may be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.

[0152] The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. The non-relational database may include a distributed database based on blockchain, etc., but is not limited thereto. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but is not limited thereto.

[0153] See also Figure 5 , the terminal device is a chip, and the chip 600 of this embodiment includes a processor 622, which may be one or more, and a memory 632 for storing a computer program executable by the processor 622. The computer program stored in the memory 632 may include one or more modules, each corresponding to a set of instructions. In addition, the processor 622 may be configured to execute the computer program to execute the above-mentioned generalizable monocular absolute depth map estimation method.

[0154] In addition, the chip 600 may further include a power supply component 626 and a communication component 650, wherein the power supply component 626 may be configured to perform power management of the chip 600, and the communication component 650 may be configured to implement communication, for example, wired or wireless communication, of the chip 600. In addition, the chip 600 may further include an input / output interface 658. The chip 600 may operate based on an operating system stored in the memory 632.

[0155] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. The components of the embodiments of the present invention described and shown in the drawings here can usually be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0156] A specific example is given for the UCF101-24 dataset and the JHMDB dataset to demonstrate the implementation effect of the method of the present invention. The detailed information of the dataset is as follows:

[0157] Table 1 is the detailed annotation table of the dataset

[0158] Dataset Training set Test Set Action Category Number of videos UCF101-24 9.5k 3.7k 24 13.3k JHMDB 928 1.2k 21 3.7k

[0159] See Table 1, JHMDB consists of 928 clips of videos from 21 action classes. UCF101-24 is a subset of UCF101. It contains 3207 videos annotated with action instances of 24 classes.

[0160] verify

[0161] The comparison results include classification accuracy (Precision), positioning recall rate (Recall) and frame-level average precision (Frame-mAP); classification accuracy (Precision) indicates the ratio of the number of correctly classified positive samples to the total number of positive samples classified by the classifier during action recognition. The larger the value, the better the classification effect; positioning recall rate (Recall) indicates the ratio of the number of correctly classified positive samples to the total number of positive samples during action detection. The larger the value, the better the positioning effect; frame-level average precision (Frame-mAP) measures the area under the precision-recall curve of each frame detection. The larger the value, the better the effect.

[0162] Please refer to Table 2, which combines Darknet with different variants of Transformer, searches and evaluates them on the UCF101-24 dataset, and analyzes and evaluates the number of parameters (Params), classification accuracy (Precision), positioning recall rate (Recall), and frame-level average precision (Frame-mAP). Note: Due to resource constraints, the following table shows the results of epoch 1.

[0163] Table 2 is a quantitative analysis table of Darknet and different Transformer model variants.

[0164] Model Params Precision Recall Frame-mAP ViT 75825922 86.8 86.2 75.3 SwinT 136034993 90.3 88.9 81.7 PVT 114404554 91.9 88.3 82.2 ALTGVT 125975416 89.5 88.8 80.7 EfficientViT 79008596 86.0 80.6 71.3 PSLT 79253710 89.6 87.9 79.5 LTAS 79474858 92.0 88.7 82.4

[0165] It can be seen from Table 2 that compared with other ViT models and their variants, the model sampled by the present invention achieves good results with a small number of parameters.

[0166] Please refer to Table 3. Different candidate operation combinations are searched and evaluated on the UCF101-24 dataset, and the classification accuracy (Precision), positioning recall rate (Recall) and frame-level average precision (Frame-mAP) are analyzed and evaluated.

[0167] Table 3 is a quantitative analysis table verifying the modular candidate operation selection of the present invention.

[0168] Darknet PSLT TD BS AS C ML Precision Recall F-mAP √ √ √ √ 87.8 87.7 83.8 √ √ √ √ 89.3 87.2 84.7 √ √ √ √ √ 89.6 87.9 84.9 √ √ √ √ √ √ 92.0 88.7 87.8 √ √ √ √ √ √ √ 93.1 87.5 89.4

[0169] Among them, TD refers to Temporal Difference, BS refers to Background Subtraction, AS refers to Adaptive Sampling, C refers to Constructor, and ML refers to Multi-task Loss.

[0170] From the above table, we can see that the comparison between the first and third experiments shows that sampling multi-task loss (ML) can make the model perform two subtasks more effectively, which has a positive impact on the results; the comparison between the second and third experiments shows that background subtraction (BS) on key frames is better than using key frames directly; the third, fourth and fifth experiments show that adding random sampling (AS) and constructors are effective and have a positive impact on the results.

[0171] Table 4 is a quantitative analysis table of the results of the present invention and various prior arts. The present invention and the prior art are analyzed and evaluated on the parameters (Params) and the frame-level average precision mean (Frame-mAP) in the case of extracting T frames and sampling frequency τ on the JHMDB and UCF101-24 datasets.

[0172] Table 4 is a quantitative analysis table of the results of the present invention and various prior arts.

[0173]

[0174]

[0175] Among them, SF-R101-NL is SlowFast-ResNet101-No Long-term

[0176] As can be seen from the table above, the method of the present invention is 2.4 percentage points higher than the current best model on the UCF101-24 dataset. Although the EVAD model has excellent performance on the JHMDB dataset, it has a large number of parameters and slow calculation. Although the model of the present invention has a lower Frame-mAP, it has a fast detection speed and can meet the real-time requirements.

[0177] Experimental results show that the present invention has better effects than the prior art when using fewer parameters.

[0178] In summary, the present invention provides a spatiotemporal action detection method and related device based on multi-task learning lightweight Transformer, which extracts spatiotemporal features through lightweight Transformer and 2D convolutional neural network, obtains multi-layer features through a constructor, performs multi-layer feature fusion to obtain the result, and then performs model training through multi-task loss.

[0179] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0180] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0181] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the present invention can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0182] In the embodiments provided by the present invention, it should be understood that the disclosed devices / terminals and methods can be implemented in other ways. For example, the device / terminal embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0183] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0184] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0185] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.

[0186] 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 embodiments of 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 generate 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.

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

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

[0189] The above contents are only for explaining the technical idea of ​​the present invention and cannot be used to limit the protection scope of the present invention. Any changes made on the basis of the technical solution in accordance with the technical idea proposed by the present invention shall fall within the protection scope of the claims of the present invention.

Claims

1. Spatiotemporal action detection method based on multi-task learning lightweight Transformer, It is characterized in that The following steps are involved: S1. Based on the existing video data, obtain the video frame group to be processed and its labels, and pre-process the video frame to be processed; S2, building a training model including a spatiotemporal feature extraction network pair, a constructor, and a lightweight fusion module; S3, using the training model obtained in step S2 to train the video data to be processed obtained in step S1, extracting the spatiotemporal features of the video to be processed, and obtaining a final prediction and a bounding box; S4. Define the loss function using the multi-task learning idea based on the spatiotemporal features obtained in step S3 to achieve classification and positioning tasks.

2. According to claim 1, the spatiotemporal action detection method based on multi-task learning lightweight Transformer, It is characterized in that Step S1 is specifically as follows: S101, obtain video frame group X and frame x i The labels of , i.e., the target box and the motion category; S102, performing data enhancement on the video frame group X to obtain a frame group X′; S103, applying the inter-frame difference method to the last T-1 frames in the frame group X′ to obtain the motion trend of the video, and adding them proportionally to the first frame processed by the background subtraction method to obtain data X″.

3. The spatiotemporal action detection method based on multi-task learning lightweight Transformer according to claim 2, It is characterized in that Assume that a total of T frames are needed, and the video frame group X is: X={x i ,x i-d ,…,x i-(T-2)*d ,x i-(T-1)*d } Where d is the sampling frequency.

4. The spatiotemporal action detection method based on multi-task learning lightweight Transformer according to claim 1, It is characterized in that In step S2, the spatiotemporal feature extraction network pair includes: Spatial feature extraction module, including the two-dimensional convolutional neural network Darknet; The spatiotemporal feature extraction module is a two-dimensional adaptive sampling ladder Transformer, including convolutional stem, MobileNetV2, squeeze excitation block and lightweight ladder self-attention block; Constructors, including deconvolution and linear interpolation with different step sizes; The lightweight fusion module adopts the channel fusion + attention mechanism solution, including ordinary convolution, depth-wise separable convolution, attention mechanism, batch normalization layer and non-linear activation layer LeakyReLU.

5. The spatiotemporal action detection method based on multi-task learning lightweight Transformer according to claim 1, It is characterized in that Step S3 is specifically as follows: S301, X s Input into Darknet to extract features S302, input X″ into LTAS to extract features S303, feature F s and F t Input into Constructor to obtain 4D feature group F′ s and F′ t ; S304, group 4D features F′ s and F′ t Input into LFM to extract features S305, the detection head is a common 1×1 convolution, which inputs the extracted feature F to obtain the final prediction N A is the number of anchor boxes, N C is the number of action categories, 1 is the confidence of the bounding box, and 4 is the coordinate offset of the bounding box (t x ,t y ,t w ,t h ); S306 , decoupling the coordinates of the bounding box.

6. The spatiotemporal action detection method based on multi-task learning lightweight Transformer according to claim 1, It is characterized in that Step S4 is specifically as follows: S401, define the loss function of each part, which includes three parts: confidence loss, category loss, and bounding box regression loss; S402. Define a total loss function based on the multi-task learning idea. The total loss function includes target box detection loss and action category classification loss.

7. The spatiotemporal action detection method based on multi-task learning lightweight Transformer according to claim 6, It is characterized in that Confidence loss L conf , category loss L cls and bounding box width and height regression loss L wh as follows: Where N is the number of prediction boxes, S is the size of the grid, and λ obj and λ noobj is the penalty factor, If the bounding box j in grid i contains the target, it is 1, otherwise it is 0. j is the center point coordinate, If the bounding box j in grid i contains the target, it is 0, and if it does not contain the target, it is 1. focal is a loss function designed for the problem of class imbalance, a j is the target category, L 1,smooth is the L1 norm loss function after smoothing, is the width of the bounding box, is the height of the bounding box.

8. A spatiotemporal action detection system based on multi-task learning lightweight Transformer, It is characterized in that include: The preprocessing module obtains the video frame group to be processed and its labels based on the existing video data, and preprocesses the video frame to be processed; Building module, building a training model including spatiotemporal feature extraction network pair, constructor and lightweight fusion module; The training module uses the training model to train the video data to be processed, extracts the spatiotemporal features of the video to be processed, and obtains the final prediction and bounding box; The detection module uses multi-task learning ideas to define the loss function based on spatiotemporal features to achieve classification and positioning tasks.

9. A computer-readable storage medium storing one or more programs, It is characterized in that The one or more programs include instructions, which, when executed by a computing device, cause the computing device to perform the method of any one of claims 1 to 7.

10. A computing device, It is characterized in that include: One or more processors, a memory and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs include steps for executing the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Moving target detecting and tracking method combining frame difference method and Gaussian mixture model

    CN107507221A

  • Welding defect detection method and device, electronic equipment and storage medium

    CN111862067A

  • Transfer learning strategy-based real-time few-shot object detection method

    WO2024032010A1

Cited By

  • Target re-identification method and system based on inter-block stepped TRANSFORMER

    CN119723185A

  • Block-based stepwise transformer-based target re-identification method and system

    CN119723185B

  • Human body posture estimation method based on semantic enhancement and multi-scale feature fusion

    CN119763189A

  • Neural network-based magnetic core loss prediction method and related device

    CN121503542A