Gait recognition method based on global-local feature fusion of Swin Transformer-3DCNN

By combining Swin Transformer and 3DCNN in gait recognition, the Attention module is introduced, which solves the problem of limited gait recognition performance of existing methods, and achieves a more comprehensive feature representation and recognition performance improvement.

CN118887731APending Publication Date: 2024-11-01NANJING TECH UNIV +1
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410914385.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-09
Publication Date
2024-11-01

AI Technical Summary

Technical Problem

The existing gait recognition methods mainly rely on global information or local information, resulting in limited identification performance. The traditional Transformer model has limitations in time series data processing, making it difficult to fully capture the characteristics and context information of gait.

Method used

A global-local feature fusion method based on Swin Transformer-3DCNN was designed. The modified Swin Transformer module extracted global features, and the Attention module was introduced into the local feature extraction branch, combining 3DCNN to extract local information, and through feature fusion and loss functions Optimize the model and improve identification performance.

Benefits of technology

By integrating global and local information, the model can more comprehensively represent gait features, improve recognition performance, enhance the ability to capture local feature information, and improve the difficulty of identifying traditional methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118887731A_ABST
    Figure CN118887731A_ABST
Patent Text Reader

Abstract

The invention discloses a gait recognition method based on global-local feature fusion of a Swin Transformer-3DCNN (Direct Current Neural Network). A new framework STCG is provided, and gait recognition can be carried out by using global and local information of gait features at the same time. In the STCG, a Swin transform module is introduced to carry out the extraction of global information. According to the module, hierarchical feature extraction is realized by using a shift window, and global features and long-range dependency in an image can be better captured. In a local branch, a plurality of 3DCNNs are used to carry out feature extraction on a feature map, so that local information can be better extracted. In addition, an Attention module is also introduced for enhancing local information extracted by the CNN. Through tests, the performance of the method in gait recognition is greatly improved, and the best recognition is achieved under most conditions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of video image processing and gait recognition in computer vision, and relates to a gait recognition method based on global-local feature fusion of SwinTransformer-3DCNN. Background Art

[0002] Unlike traditional biometric recognition technologies (such as facial and fingerprint recognition), gait recognition is a biometric technology capable of long-distance identification, and therefore has broad application prospects in public security and criminal investigation. The uniqueness of an individual's gait stems from multiple characteristics, such as limb movement, arm swing, and stride length. These factors make gait recognition difficult to fake or replicate. Therefore, gait recognition utilizes each individual's unique walking style as a means of identification. Furthermore, gait recognition performance can be affected by numerous covariates, such as clothing, belongings carried, walking speed, and camera angle, which can increase the difficulty of identification.

[0003] Numerous deep learning-based gait recognition frameworks have been proposed. However, most gait recognition methods utilize global or local gait information for feature representation, which limits recognition performance to a certain extent. In particular, global feature representations may not adequately address the details of gait information. Local feature representations, on the other hand, may lose the global context of gait and overlook the relationships between local features. Furthermore, in gait recognition methods that incorporate the Transformer, traditional Transformer models have limitations when processing time series data. Summary of the Invention

[0004] To address the shortcomings of existing methods, we designed a novel global and local feature extractor. The global feature extraction branch utilizes our modified Swin-Transformer module for information extraction, while the local feature extraction branch utilizes a 3D CNN module. An Attention module is introduced in the local branch to enhance the extracted local information. The extracted global and local features are then fused together, fully utilizing both global and local information for gait recognition. In this architecture, the global feature extraction module focuses on the overall gait appearance, while the local feature extraction module focuses on the details of the gait.

[0005] The specific technical solutions are as follows:

[0006] A gait recognition method based on global-local feature fusion of Swin Transformer-3DCNN, the method comprising the following steps:

[0007] S1. Input a batch of data containing multiple gait samples, represented as X int ∈R T×C×H×W , where C is the number of channels, T is the length of the gait sequence, and (H, W) is the size of each frame image, that is, the width and height of the feature map;

[0008] S2. Use 3D convolution technology to extract features from the original gait input sequence and obtain the primary feature map.

[0009] S3. Input the primary features into the global and local feature extractor we designed. The global and local feature extractor combines the advantages of the global feature extractor and the local feature extractor to simultaneously extract global and local information from the gait image.

[0010] S4. Feature fusion: fusing the extracted local gait features with the global gait features.

[0011] S5. In order to extract effective feature representation from gait image sequences, the present invention further utilizes time pooling and horizontal pooling to implement feature mapping, forward propagates the input feature map through multiple independent fully connected layers, and thus achieves the aggregation of feature information; defines the triplet loss function and the cross entropy loss function, and defines the combined loss function L total , which is the triplet loss L tri and cross entropy loss L ces During the training process, the weight parameters of the model are iteratively updated through the backpropagation algorithm and the optimizer to minimize the combined loss function L total .

[0012] S6. Use the obtained network model to split the training and test data sets to obtain test results; and determine the final recognition model.

[0013] S7. Use the trained model to identify gaits in the video. First, preprocess the video data to meet the model's input requirements. Then, the processed data is input into the final recognition model determined in S6 for feature extraction, and finally, the recognition results are output.

[0014] Furthermore, in S3, the gait recognition method integrates global and local feature extractors to extract global and local gait information from gait images. The global feature extraction branch uses our modified Swin-Transformer module for information extraction, while the local feature extraction branch uses a 3DCNN module for information extraction. The Attention module is introduced in the local branch to enhance the extracted local information, fully utilizing both global and local information for recognition. The specific details are as follows:

[0015] S11. In our global-local feature extraction structure STCG (Swin Transformer-Conventional Neural Network Gait Recognition framework), the input is X int ∈R T×C×H×W In the local feature extraction module, the input feature map is divided into n parts. n is the number of regions we divide into, Corresponding to the size of the feature map of each part. After the convolution operation, the data is spliced.

[0016] The output feature map size is C1 is the new number of channels obtained after the convolution operation, and the concat operation is the splicing operation.

[0017] S12. In the local feature extraction branch, we added the Attention module. First, we reshape the R T×C1×H×W Transformed into R T×(C1×H×W) Each time frame is a token, and the dimension of each token is C1×H×W. Multiply the reshaped matrix by the three weight matrices W Q ,W K and W V , we get the matrix X Q 、X K and X V Then calculate the similarity between the query and the key to get the attention score, scale the attention score and use the softmax function to get the attention weight, as shown below: Among them, d k Represents X K The dimension of , softmax(·) is the softmax activation function. Multiply the attention weight by value and sum them to get the output of self-attention. The formula is: Attention output =Attention weight ·X V At this time, the output is still R T×C1×H×W .

[0018] S13. In the global feature extraction branch, in order to input the data into our modified Swin transformer model, we first use the bilinear interpolation layer to adjust the feature map so that the input X' int ∈R T×C×H'×W', H' and W' are the height and width of the adjusted feature map. In 3D patch partition, we set the patch size to (1, 2, 2). 3D tokens, and then a linear embedding layer is applied to project the features of each token into a 4C-dimensional vector, which is then input into the 3D swin transformer block. Subsequently, a patch merging module is used for downsampling, which reduces the resolution of the feature map by half, while the number of channels is doubled. It is then input into the 3D swin transformer block. After these two operations, the final output size is C2 is the final number of channels, H1 and W1 are the height and width of the final feature map.

[0019] Furthermore, in S4, after convolution, downsampling and finally frame-by-frame adjustment through the bilinear interpolation layer, the final output of the local feature extraction branch is After the splicing operation, the global and local information are fused.

[0020] The output is

[0021] Furthermore, in said S5, it is characterized in that: said triplet loss function is as follows:

[0022] Ltri=Max(m+d(a,s)-d(a,t),0)

[0023] where a and s are samples from the same class, while a and t are samples from different classes, d(·) is the Euclidean distance between the two samples, and m is the margin of the triplet loss.

[0024] The combined loss function is as follows:

[0025] L total =L tri +L ces

[0026] Among them, L tri represents triplet loss, L ces represents the cross entropy loss.

[0027] Beneficial effects of the present invention

[0028] Compared to traditional Transformers, the Swin Transformer module we use, by introducing a local window-based attention mechanism, can better process multi-scale temporal features. Specifically, by fusing local information extracted by a 3DCNN with global information extracted by the Swin transformer, we can more comprehensively represent gait features, thereby improving the model's recognition performance. Furthermore, within the local feature extraction branch, we introduce an Attention module that combines local features extracted by a 3DCNN, enabling the model to better capture dependencies between features and enhance the local feature information extracted by the CNN. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 This is the overall architecture diagram of the gait recognition system based on global-local feature fusion of Swin Transformer-3DCNN.

[0030] Figure 2 This is a structural diagram of the global feature and local feature extractor (STCG) in the present invention.

[0031] Figure 3 The test results of the present invention are compared with the traditional GaitSet, GaitPart and GaitGL models. DETAILED DESCRIPTION

[0032] The present invention will be further described below with reference to the embodiments, but the scope of protection of the present invention is not limited thereto:

[0033] like Figure 1 As shown in the figure, the present invention provides a gait recognition method based on global-local feature fusion of Swin Transformer-3DCNN, which uses gait profile image sequences as the input of the entire framework. First, the sequence is converted into a feature map through convolution, and then sent to the global-local feature extraction module designed by us. After further fusion, feature mapping is achieved using time pooling and horizontal pooling. Finally, triplet loss function and cross entropy loss function are used for joint training. The overall network architecture is shown in the figure. Figure 1 shown.

[0034] like Figure 1 、 2 As shown, the present invention proposes a gait recognition method based on global-local feature fusion of Swin Transformer-3DCNN, which includes the following steps:

[0035] S1. Prepare the dataset and preprocess the gait dataset, normalizing each frame image to a size of 64×44;

[0036] The dataset used in this embodiment is the CASIA-B dataset.

[0037] The Institute of Sciences' Gait Database (dataset B) gait dataset (Yu et al., 2006) is a public dataset widely used to evaluate cross-view gait recognition. It contains 124 people, three walking states, and 11 different viewpoints (0°, 18°, ..., 180°). Each person has six sequences in the normal state (NM#01-06), two sequences in the coat state (CL#01-02), and two sequences in the backpack state (BG#01-02). Therefore, each person has 11 × (6 + 2 + 2) = 110 sequences.

[0038] During the training phase, three training scales are used: small-scale training (ST), medium-scale training (MT), and large-scale training (LT). 24, 62, and 74 subjects are selected as the training set, respectively, while the remaining 100, 62, and 50 subjects are used for testing. During the training phase, all gait data from the training set are used to train the proposed model. During the testing phase, the first four sequences of the NM condition (NM#1-4) are treated as the gallery, while sequences NM#05-NM#06, BG#01-BG#02, and CL#01-CL#02 are treated as the probe set to evaluate model performance.

[0039] S2. Use the convolution layer with a convolution kernel of 3×3×3 to extract the features of the original gait input sequence and obtain the primary feature map, X int ∈R T×C×H×W .

[0040] S3. Global-local feature extraction module, such as Figure 2 As shown:

[0041] In the local feature extraction module, the input feature map is divided into n parts. n is the number of regions we divide into, Corresponding to the size of the feature map of each part. After the convolution operation, the data is spliced. The feature map output at this time C1 is the new number of channels obtained after the convolution operation, and the concat operation is the splicing operation.

[0042] In the local feature extraction branch, we added the Attention module. First, we reshape the Transformed into Each time frame is a token, and the dimension of each token is C1×H×W. Multiply the reshaped matrix by the three weight matrices W Q ,W K and W V , we get the matrix X Q 、X K and X V Then calculate the similarity between the query and the key to get the attention score, scale the attention score and use the softmax function to get the attention weight, as shown below: Among them, d k Represents X K The dimension of , softmax(·) is the softmax activation function. Multiply the attention weight by value and sum them to get the output of self-attention. The formula is: Attention output =Attention weight ·X V The output is still

[0043] In the global feature extraction branch, in order to input the data into our modified Swin transformer model, we first use the bilinear interpolation layer to adjust the feature map so that the input X' int ∈R T×C×H'×W' In 3D patchpartition, we set the patch size to (1, 2, 2). A linear embedding layer is then applied to project the features of each token into a 4C-dimensional vector, which is then fed into the 3D swin transformer block. Subsequently, a Patch Merging module is used to downsample the feature map, halving the resolution while doubling the number of channels. This is then fed into the 3D swin transformer block. After these two operations, the final output size is C2 is the final number of channels, H1 and W1 are the height and width of the final feature map.

[0044] After convolution, downsampling, and finally frame-by-frame adjustment through the bilinear interpolation layer, the final output of the local feature extraction branch is After the splicing operation, the global and local information are fused. The output is

[0045] S4. Further use time pooling and horizontal pooling to realize feature mapping, and forward propagate the input feature map through multiple independent fully connected layers to achieve the aggregation of feature information; define the triplet loss function and cross entropy loss function, and define the combined loss function L total , which is the triplet loss L tri and cross entropy loss L ces During the training process, the weight parameters of the model are iteratively updated through the backpropagation algorithm and the optimizer to minimize the combined loss function L total .

[0046] The triplet loss function is as follows:

[0047] Ltri=Max(m+d(a,s)-d(a,t),0)

[0048] where a and s are samples from the same class, while a and t are samples from different classes, d(·) is the Euclidean distance between the two samples, and m is the margin of the triplet loss.

[0049] The combined loss function is as follows:

[0050] L total =L tri +L ces

[0051] S6. Use the obtained network model to split the training and test data sets to obtain test results; and determine the final recognition model.

[0052] S7. Use the trained model to identify gaits in the video. First, preprocess the video data to meet the model's input requirements. Then, the processed data is input into the final recognition model determined in S6 for feature extraction, and finally, the recognition results are output.

[0053] Compared to traditional Transformers, the Swin Transformer module we use, by introducing a local window-based attention mechanism, can better process multi-scale temporal features. Specifically, by fusing local information extracted by a 3DCNN with global information extracted by the Swin transformer, we can more comprehensively represent gait features, thereby improving the model's recognition performance. Furthermore, within the local feature extraction branch, we introduce an Attention module that combines local features extracted by a 3DCNN, enabling the model to better capture dependencies between features and enhance the local feature information extracted by the CNN.

[0054] The specific embodiments described herein are merely illustrative of the spirit of the present invention. Persons skilled in the art may make various modifications, additions, or substitutions to the described specific embodiments without departing from the spirit of the present invention or exceeding the scope of the appended claims.

Claims

1. A gait recognition method based on global-local feature fusion of Swin Transformer-3DCNN, characterized by: The method comprises the following steps: S1. Input a batch of data X containing multiple gait samples int ∈R T×C×H×W As a gait sequence, where C is the number of channels, T is the length of the gait sequence; H and W are the height and width of the feature map, respectively, indicating the size of each frame image; S2. Use 3D convolution technology to extract features from the original gait sequence and obtain a primary feature map; S3. inputting the primary features into the global and local feature extractors to extract local gait features and global gait features; S4. Feature fusion, fusing the extracted local gait features with the global gait features; S5. Use time pooling and horizontal pooling to realize feature mapping, and forward propagate the input feature map through multiple independent fully connected layers to achieve aggregation of feature information; define triplet loss function and cross entropy loss function, and define combined loss function L total During the training process, the weight parameters of the model are iteratively updated through the back-propagation algorithm and optimizer to minimize the combined loss function L total ; S6. Use the obtained network model to split the training and test data sets to obtain test results; determine the final recognition model; S7. Use the trained model to recognize gait in the video.

2. The method according to claim 1, characterized in that: In S3, the modified Swin-Transforme module is used to extract global gait feature information, the 3DCNN module is used to extract local gait feature information, and the Attention module is introduced in the local branch to enhance the extracted local information, so as to make full use of the global and local information for recognition.

3. The method according to claim 2, characterized in that: In S3, the specific steps of extracting local gait features and global gait features are: S11. Construct a global-local feature extraction structure STCG, including local feature extraction branches and global feature extraction branches. The input of STCG is X int ∈R T×C×H×W ; In the local feature extraction branch, the input global feature map is mapped into n parts, that is, n is the number of partitions, Corresponding to the size of the feature map of each part; then the local gait features of the mapped feature map are input into the corresponding 3DCNN convolution block for convolution operation; after the convolution operation, data splicing is performed, and the output feature map size is C1 is the number of new channels obtained after the convolution operation, the concat operation is the concatenation operation, and conv represents the convolution operation corresponding to the local features; S12. In the local feature extraction branch, add the Attention module; first reshape the output after the convolution operation Transformed into Each time frame is a token, and the dimension of each token is C1×H×W; multiply the reshaped matrix by the three weight matrices W Q ,W K and W V , we get the matrix X Q , X K and X V ; Then calculate the similarity between query and key to get the attention score, scale the attention score and use the softmax function to get the attention weight Attention weight , as follows: Among them, d k Represents X K dimension, softmax(·) is the softmax activation function; the attention weight is multiplied by value and the weighted sum is obtained to obtain the output of self-attention output , the formula is: Attention output =Attention weight ·X V At this time the output is still S13. In the global feature extraction branch, the feature map is first adjusted using a bilinear interpolation layer so that the input X' int ∈R T×C×H’×W’ , H' and W' are the height and width of the adjusted feature map; In 3D patch partition, the patch size is set to (1, 2, 2); the feature map adjusted by the bilinear interpolation layer is obtained by segmenting 3D tokens, and then apply a linear embedding layer to project the features of each token into a 4C-dimensional vector to input into the 3D swin transformer Block; Afterwards, a Patch Merging module is used for downsampling to halve the resolution of the feature map, while the number of channels is doubled. It is then input into the 3D swin transformer Block. After two operations, the final output size is C2 is the final number of channels, H1 and W1 are the height and width of the final feature map.

4. The method according to claim 1, characterized in that: In S4, after convolution, downsampling and finally frame-by-frame adjustment through a bilinear interpolation layer, the final output of the local feature extraction branch is After the splicing operation, the global and local information are fused, and the output is Y out =Y out-gobal +Y out-local , 5. The method according to claim 1, characterized in that: The triplet loss function is as follows: L tri=Max(m+d(a,s)-d(a,t),0) where a and s are samples from the same class, while a and t are samples from different classes, d(·) is the Euclidean distance between two samples, and m is the margin of triplet loss.

6. The method according to claim 1, characterized in that: The cross entropy loss function is as follows: Where N is the gait category, y i represents the true label, p i Represents the prediction result.

7. The method according to claim 1, characterized in that: The combined loss function is as follows: L total =L tri +L ces Among them, L tri represents triplet loss, L ces represents the cross entropy loss.

Citation Information

Cited By

  • Multi-scale parallel dual-channel pneumoconiosis lesion grading identification method

    CN119785085A

  • Gait recognition model and recognition method

    CN120126216A