Fitness yoga action recognition method based on images
Through the multi-head attention mechanism integrated learning model, combined with Mixup image enhancement and ResNet/VGGNet feature extraction, the problem of low accuracy and real-time performance of the yoga posture recognition algorithm is solved, and high-precision and efficient yoga movement recognition is achieved.
Patent Information
- Application Number
- CN202410549030.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-06
- Publication Date
- 2024-09-17
AI Technical Summary
Existing yoga posture recognition algorithms face problems such as limited sample size, narrow coverage, low recognition accuracy, insufficient real-time performance and stability, and lack of versatility and scalability.
An integrated learning model based on a multi-head attention mechanism is used to extract deep features through Mixup image enhancement, ResNet and VGGNet, and xfusion is used for feature stacking and multi-head attention processing, combined with linear layers for classification.
It achieved 100% training accuracy, 89.94% verification accuracy, 93.79% test accuracy and a detection speed of 297FPS, significantly improved the recognition accuracy and stability, and enhanced the model's robustness and real-time detection capabilities.
Smart Images

Figure CN118658197A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of action recognition, and in particular to an image-based fitness yoga action recognition method. Background Art
[0002] Research on yoga posture recognition has made some progress in terms of data set construction, posture recognition algorithms, and posture recognition applications. The key to yoga posture recognition is to establish a large-scale, high-quality yoga posture dataset. There are already some public yoga datasets, including static images and video data, which are widely used in research. The algorithms are mainly based on computer vision and pattern recognition, including posture estimation, key point detection, and action sequence modeling. Commonly used algorithms include deep learning methods such as convolutional neural networks (CNNs) and recurrent neural networks (RNNs), as well as traditional machine learning methods such as support vector machines (SVMs) and random forests. Yoga posture recognition can be applied to health monitoring, sports training, smart fitness, and other fields. By monitoring and identifying yoga postures in real time, accurate feedback and guidance can be provided to help practitioners improve their yoga postures and improve the effectiveness and safety of yoga postures.
[0003] Current yoga pose recognition algorithms face several problems:
[0004] (1) Due to the diversity and complexity of postures, it is challenging to construct a comprehensive and high-quality yoga posture dataset. The datasets usually have limited sample size and narrow coverage and cannot include all common postures.
[0005] (2) The algorithm has limited accuracy. Due to the variations and subtle differences in yoga poses, as well as the effects of lighting, angles, and occlusions, the algorithm often makes misjudgments or misjudgements when identifying complex yoga poses.
[0006] (3) There is still room for improvement in the real-time and stability of the algorithm. In practical applications, the algorithm must accurately and quickly recognize postures in real time and stably adapt to changes in scenes and environments.
[0007] (4) The algorithms often focus on specific postures, lack generality and scalability, and may not be able to accurately recognize some novel or special postures. Summary of the invention
[0008] The present invention provides an image-based fitness yoga action recognition method, which can better recognize the image-based yoga movement features.
[0009] The method for recognizing yoga movements based on images according to the present invention comprises the following steps:
[0010] Step 1: Load yoga exercise images;
[0011] Step 2: Apply Mixup image enhancement to the image;
[0012] Step 3: Use ResNet to extract deep features from the image and load the pre-trained weights of ResNet;
[0013] Step 4: Use VGGNet to extract deep features and load the pre-trained weights of VGGNet;
[0014] Step 5: Use ResNet and VGGNet to stack the extracted features to create new high-order features;
[0015] Step 6: Use multi-head attention to process the stacked features, using xfusion as the input of query, key and value, and the output is the processed feature tensor;
[0016] Step 7: Flatten the features processed by multi-head attention into vectors;
[0017] Step 8: Use the linear layer for classification and output the probability of each category of the final yoga pose.
[0018] Preferably, in step 2, specifically:
[0019] Step 2.1: Randomly select two samples A and B from the training data set;
[0020] Step 2.2: For each sample, generate a random weight factor λ between 0 and 1;
[0021] Step 2.3: For the input features, calculate the mixed new features as:
[0022] Tmixed Feature=λ·FeatureA+(1-λ)·Feature B
[0023] Among them, FeatureA and Feature B are the input features of samples A and B;
[0024] Step 2.4: For the target label, calculate the mixed new label as:
[0025] mixed label=λ·labelA+(1-λ)·label B
[0026] Step 2.5: Repeat the above steps until the required number of mixed samples is obtained;
[0027] Step 2.6: Train the model using the mixed samples.
[0028] Preferably, in step 3, ResNet is one of ResNet18, ResNet34, ResNet50, ResNet101, and ResNet152.
[0029] Preferably, in step 4, VGGNet is constructed by stacking multiple 3x 3 convolutional layers and using pooling layers for downsampling.
[0030] Preferably, in step 4, VGGNet is one of VGGNet11, VGGNet13, VGGNet16, and VGGNet19.
[0031] This paper proposes a fitness yoga action recognition method based on a multi-head attention mechanism integrated learning model to solve the low accuracy problem of the current yoga action recognition algorithm. The present invention uses the Mixup algorithm to enhance yoga motion images, and uses the ResNet and VGGNet models to extract convolutional features from them. These features are stacked together and merged using a multi-head attention mechanism. In ablation and comparative experiments, this method achieves 100% training accuracy, 89.94% verification accuracy, 93.79% test accuracy and 297FPS detection speed, and shows high stability and robustness. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 A flowchart of an image-based fitness yoga action recognition method in an embodiment;
[0033] Figure 2 A schematic diagram of training and verifying accuracy on general yoga movements in an embodiment;
[0034] Figure 3 Graph showing the training and validation losses on general yoga movements in the embodiment;
[0035] Figure 4 It is a confusion matrix diagram evaluated on a self-built data set in the embodiment;
[0036] Figure 5 It is a schematic diagram of the detection results on the yoga posture evaluation dataset in the embodiment. DETAILED DESCRIPTION
[0037] In order to further understand the content of the present invention, the present invention is described in detail in conjunction with the accompanying drawings and embodiments. It should be understood that the embodiments are only for explaining the present invention and are not intended to limit it.
[0038] Example
[0039] like Figure 1 As shown, this embodiment provides an image-based fitness yoga action recognition method, which includes the following steps:
[0040] Step 1: Load yoga motion images; this embodiment has seven yoga postures;
[0041] Step 2: Apply Mixup image enhancement to the image;
[0042] Step 3: Use ResNet to extract deep features from the image and load the pre-trained weights of ResNet (ResNet18, ResNet34, ResNet50, ResNet101, ResNet152);
[0043] Step 4: Use VGGNet to extract deep features and load the pre-trained weights of VGGNet (VGGNet11, VGGNet13, VGGNet16, VGGNet19);
[0044] Step 5: Use ResNet and VGGNet to stack the extracted features to create new high-order features;
[0045] Step 6: Use multi-head attention to process the stacked features, using xfusion as the input of query, key and value, and the output is the processed feature tensor;
[0046] Step 7: Flatten the features processed by multi-head attention into vectors;
[0047] Step 8: Use the linear layer for classification and output the probability of each category of the final yoga pose.
[0048] Hybrid Data Augmentation
[0049] Data augmentation expands the training dataset, using a small amount of data to generate similar data based on prior knowledge. It is often used to compensate for small sample sizes in real applications. Common methods include flipping, rotating, scaling, translating, cropping, adjusting brightness and contrast, adding noise, and color space transformation. These methods are often combined to increase the diversity of training data and improve the generalization ability of deep learning models. However, their ability to enhance the diversity of training data is limited.
[0050] Mixup is used for data augmentation and regularization, and is mainly applied to deep learning models. It enhances the diversity of the data set by performing linear interpolation between samples. For each training sample, another different sample is randomly selected along with a random weight lambda. Mixup then linearly interpolates the feature vectors and labels of the two samples according to the selected weights to generate new feature vectors and labels. For example, in an image classification task, the pixel values of two images can be linearly combined to produce a new image as a training sample. The corresponding labels are also linearly interpolated. This technique can improve the generalization ability and robustness of the model by introducing interactions between samples. The model can learn a more comprehensive feature representation and reduce overfitting on a single sample. Mixing can also serve as a form of regularization to alleviate overfitting in the model.
[0051] Mixup has the following steps:
[0052] Step 2.1: Randomly select two samples A and B from the training data set;
[0053] Step 2.2: For each sample, generate a random weight factor λ between 0 and 1;
[0054] Step 2.3: For the input features, calculate the mixed new features as:
[0055] Tmixed Feature=λ·FeatureA+(1-λ)·Feature B
[0056] Among them, FeatureA and Feature B are the input features of samples A and B;
[0057] Step 2.4: For the target label, calculate the mixed new label as:
[0058] mixed label=λ·labelA+(1-λ)·label B
[0059] Step 2.5: Repeat the above steps until the required number of mixed samples is obtained;
[0060] Step 2.6: Train the model using the mixed samples.
[0061] Residual Network ResNet
[0062] Residual Network ResNet is a deep residual network structure that is widely used in image recognition tasks. It solves the gradient vanishing and exploding problems by adding residual connections. The ResNet network structure uses residual blocks, each of which consists of multiple convolutional layers and identity mappings. In traditional CNNs, each convolutional layer transforms the input, while in ResNet, the input of each residual block can directly skip some convolutional layers and be added to the output of the residual block to obtain the final output. This makes information easier to propagate and learn, effectively alleviating the gradient vanishing problem and improving network performance. In addition, due to the introduction of residual connections, the ResNet structure has good network scalability, allowing depth to be increased without overfitting.
[0063] Commonly used ResNet networks can be shallow networks or deep networks. Shallow networks include ResNet18 and ResNet34, and deep networks include ResNet50, ResNet101, and ResNet152. Shallow network residual structures are mainly used in ResNet18 and ResNet34, while deep structures are used in ResNet50, ResNet101, and ResNet152. In the ResNet model, BatchNormalization is widely used in each residual block to normalize the input of each layer for faster training and improved generalization. In ResNet, batch normalization is usually applied after each convolutional layer and before the nonlinear activation function in each residual block.
[0064] ResNet-101 is a deep CNN that uses residual blocks to solve the vanishing gradient problem during deep network training. In deep learning, the vanishing gradient problem increases with the number of layers, making convergence difficult. ResNet-101 uses residual blocks to build deep networks, making training easier and achieving excellent performance in image recognition tasks.
[0065] The ResNet101 network structure includes the following parts:
[0066] First layer: 7x 7 convolution, 64 filters, stride 2, padding 3, ReLU activation function;
[0067] Second layer: 3x 3 max pooling layer with a stride of 2;
[0068] The third layer: 4 blocks, 3 residual blocks in each block, a total of 12;
[0069] Fourth layer: 4 blocks, 23 residual blocks in each block, a total of 92; Fifth layer: 4 blocks, 3 residual blocks in each block, a total of 12; Global average pooling layer: average pooling is performed on the feature map output by the previous layer to obtain the feature vector; Fully connected layer: the feature vector is connected to 2 output nodes for classification output.
[0070] VGG Network
[0071] The VGG network is a type of deep CNN that has achieved excellent performance in image classification and object recognition tasks. The deep network is built by stacking multiple 3x 3 convolutional layers and using pooling layers to perform downsampling. The VGG network is a type of deep convolutional neural network that has achieved excellent performance in image classification and object recognition tasks. The deep network is built by stacking multiple 3x 3 convolutional layers and using pooling layers to perform downsampling.
[0072] The VGG16 network architecture consists of 13 convolutional layers, 5 max pooling layers, and 3 fully connected layers. The pooling layer is used to reduce the size of the features, and the fully connected layer corresponds to the learning of high-level features for image classification tasks.
[0073] VGGNet has the disadvantages of large parameters and calculations, high memory usage, too many feature extraction layers, lack of position information, and is not suitable for small-size images.
[0074] Multi-head attention mechanism
[0075] Multi-head attention is often used in deep learning. It improves the expressiveness and learning effect of the model by considering multiple attention heads at the same time. In the traditional attention mechanism, only one attention head is used to calculate the attention weight, and the attention weight is calculated. Weighted summation is performed. Multi-head attention has multiple attention heads, which learn and generate their own attention weights.
[0076] This parallel mechanism enables the model to focus on different aspects of the input and capture richer information. The model can learn multiple attention representations at the same time, each of which is calculated in a different subspace, so the attention representation can focus on different information of the input sequence, providing richer expressiveness and more comprehensive information extraction. The model can learn different aspects of features and relations at the same time and integrate them to improve model performance. Multi-head attention has several advantages, including accelerating model training and inference, enhancing the model's ability to represent complex problems, improving robustness and generalization, and adapting to task requirements in various situations.
[0077] experiment
[0078] The data setup, experimental results, and ablation studies are discussed here, and our ensemble and multi-head attention models are compared with other models in terms of accuracy and computational complexity. The proposed method is implemented in Python v3.9.0 on an AMD Ryzen 75700G with a Radeon Graphics 3.80GHz CPU and 8GB onboard memory, and equipped with the Keras deep learning framework and PyTorch backend. The performance is evaluated using a common yoga action dataset and a self-built yoga action dataset.
[0079] The general dataset is used for training and validation, and the self-made dataset is used for evaluation. Both datasets contain seven yoga poses. The general dataset contains 647 bridge poses, 608 cobra poses, 510 downward dog poses, 588 mountain poses, 444 tree poses, 440 triangle poses, and 612 warrior positions. The self-made dataset consists of 18 bridge positions, 18 cobra positions, 15 downward dog positions, 18 mountain positions, 14 tree positions, 25 triangle positions, and 21 warrior positions.
[0080] Figure 2 and Figure 3 The training and validation accuracy and loss plots of our ensemble learning and multi-head attention model on general yoga movements are shown, indicating that the training and validation accuracy and loss are stable, which verifies its convergence.
[0081] We evaluated the trained model on our own dataset, and the results are as follows: Figure 4 As shown. The confusion matrix is an important performance measurement tool used to summarize prediction results and evaluate the performance of classification problems. It is created by comparing the predicted results and the actual results, combining the different results into a matrix to show the accuracy of the model's predictions. 38 We obtained an evaluation accuracy of 93.79%. Figure 4 The confusion matrix between the predicted and actual yoga poses is shown. Darker colors on the diagonal indicate a higher correlation between the predicted and true values. The darker diagonal for our model indicates that it is fairly accurate.
[0082] Figure 5 The evaluation results are shown, from which we can see that our proposed model can recognize more than 30% of the actions with a probability of more than 90%, more than 60% with a probability of more than 80%, more than 90% with a probability of more than 70%, and more than 65% with a probability of more than 65%. This proves the high performance and stable performance of our model.
[0083] Ablation studies
[0084] We compared the performance of ensemble learning and multi-head attention with different lightweight deep learning models on a self-created dataset. We analyzed the improvement of frame detection by different components from multiple perspectives and gave experimental results of ensemble models including ResNet18, ResNet34, ResNet50, ResNet101, ResNet152, VGGNet11, VGGNet13, VGGNet16, and VGGNet19.
[0085] In general, our proposed method combines ResNet and VGGNet with a multi-head attention mechanism, which has excellent accuracy and demonstrates stability and robustness in recognizing yoga movements. The ensemble model based on different ResNet and VGGNet series achieved a recognition accuracy of more than 81% and a detection speed of more than 180FPS. Among all the ensemble models, the multi-head attention ensemble model based on ResNet101 and VGGNet19 performed the best in terms of accuracy, exceeding 93.79% on the evaluation dataset. The detection speed of this model is 297FPS while maintaining efficient real-time detection capabilities.
[0086] To further evaluate the recognition performance of the proposed integrated model with multi-head attention mechanism for different types of yoga poses, we plotted the confusion matrix of the model evaluation results. Overall, the recognition accuracy of the seven yoga poses on the evaluation dataset is high. The recognition performance of the triangle pose is the best, followed by the warrior pose. Overall, the recognition accuracy of the tree pose is the lowest.
[0087] Comparison with other methods
[0088] We compared our method with models from the ResNet and VGGNet series. The ResNet series models use ResNet18, ResNet50, ResNet101, and ResNet152, and the VGGNet series models use VGGNet-11, VGGNet-13, VGGNet-16, and VGGNet-19. From the results, we can see that our method outperforms the ResNet and VGGNet series in both detection speed and detection speed on the evaluation dataset.
[0089] Among the ResNet family models, ResNet34 achieves 72.86% recognition accuracy, ResNet18 and ResNet50 both achieve 65.11%, ResNet101 achieves 52.71%, and ResNet152 achieves 57.36%. Compared to these, our model shows at least 28.72% improvement while maintaining a similarly high detection speed.
[0090] Among the ResNet series migration learning models, ResNet18, ResNet50, and ResNet101 achieved 92.24% recognition accuracy, and ResNet34 and ResNet152 achieved 91.47% and 89.89%, respectively. Our model is at least 1.7% better than these. In terms of detection speed, our model is comparable and has higher real-time detection capabilities.
[0091] Among the VGGNet series of non-transfer learning models, the recognition accuracy of VGGNet13, VGGNet16, and VGGNet19 all reached 65.11%, while VGGNet11 reached 13.95%. Compared with these, our proposed model improves the recognition accuracy by at least 43.95%. In terms of detection speed, our proposed model is comparable and has high real-time detection capability.
[0092] Among the VGGNet series transfer learning models, VGGNet13, VGGNet16, and VGGNet19 achieved 87.24% recognition accuracy, while VGGNet11 achieved 90.69% recognition accuracy. Compared with the VGGNet series non-transfer learning models, our recognition accuracy is at least 3.4% higher. In terms of detection speed, our proposed model is comparable to the VGGNet series transfer learning models and has high real-time detection capabilities.
[0093] From the results, we can see that the training accuracy of STF-ResNet8 and CNN2 networks is 98.60% and 98.58% respectively, while the test accuracy of our method is 93.79% and the training accuracy is 100% accuracy. The training accuracy of Y-PNMSSD, Yolov4 and 3D+LSTM2 is 99.88%, 98.56% and 99.38% respectively. These three are object detection methods, which require a lot of data annotation work during training, resulting in high costs. Our method combines multi-head attention with ensemble learning, which has advantages in recognition accuracy and detection speed.
[0094] This embodiment uses the integrated learning of ResNet101 and VGGNet19 feature stacking to improve the accuracy of yoga pose recognition. The multi-head attention mechanism further enhances the features while reducing redundancy, thereby improving its detection speed. In the ablation experiment, the proposed method combining the multi-head attention mechanism with integrated learning (ResNet101 and VGG19) achieved a maximum training accuracy of 100%, a validation accuracy of 89.94%, and a test accuracy of 93.79%. A large number of ablation experimental results show that our method has high stability and robustness in terms of recognition accuracy. In addition, our method achieves high performance in terms of detection speed. On our self-built fire smoke and flame dataset, our model achieved 100% training accuracy, 89.94% validation accuracy, and 93.79% test accuracy. The comparison results with traditional deep learning models such as ResNet and VGGNet prove the advanced nature of our proposed multi-head attention mechanism integrated learning model for yoga action recognition.
[0095] Our method also shows good performance in terms of detection speed. Comparative analysis with existing studies on yoga pose recognition shows that our proposed method has significant advantages in terms of training accuracy, validation accuracy, and detection speed.
[0096] The present invention and its embodiments are described schematically above, and the description is not restrictive. The drawings show only one embodiment of the present invention, and the actual structure is not limited thereto. Therefore, if a person skilled in the art is inspired by it and designs a structural method and an embodiment similar to the technical solution without creativity without departing from the purpose of the invention, they shall all fall within the protection scope of the present invention.
Claims
1. Fitness yoga action recognition method based on image, Features: The following steps are involved: Step 1: Load yoga exercise images; Step 2: Apply Mixup image enhancement to the image; Step 3: Use ResNet to extract deep features from the image and load the pre-trained weights of ResNet; Step 4: Use VGGNet to extract deep features and load the pre-trained weights of VGGNet; Step 5: Use ResNet and VGGNet to stack the extracted features to create new high-order features; Step 6: Use multi-head attention to process the stacked features, using xfusion as the input of query, key and value, and the output is the processed feature tensor; Step 7: Flatten the features processed by multi-head attention into vectors; Step 8: Use the linear layer for classification and output the probability of each category of the final yoga pose.
2. The method for recognizing yoga movements based on images according to claim 1, Features: In step 2, specifically: Step 2.1: Randomly select two samples A and B from the training data set; Step 2.2: For each sample, generate a random weight factor λ between 0 and 1; Step 2.3: For the input features, calculate the mixed new features as: Tmixed Feature=λ·FeatureA+(1-λ)·Feature B Among them, FeatureA and Feature B are the input features of samples A and B; Step 2.4: For the target label, calculate the mixed new label as: mixed label=λ·labelA+(1-λ)·label B Step 2.5: Repeat the above steps until the required number of mixed samples is obtained; Step 2.6: Train the model using the mixed samples.
3. The method for recognizing yoga movements based on images according to claim 2, Features: In step 3, ResNet is one of ResNet18, ResNet34, ResNet50, ResNet101, and ResNet152.
4. The method for recognizing fitness yoga movements based on images according to claim 3, Features: In step 4, VGGNet is constructed by stacking multiple 3x 3 convolutional layers and using pooling layers for downsampling.
5. The method for recognizing fitness yoga movements based on images according to claim 4, Features: In step 4, VGGNet is one of VGGNet11, VGGNet13, VGGNet16, and VGGNet19.
Citation Information
Patent Citations
Image classification method based on VGGNet and ResNet
CN110543895A
Multi-scale fusion asphalt pavement crack identification method based on multi-head attention
CN115512230A
Fitness yoga action recognition method based on deep residual network and transfer learning
CN116681982A
Dangerous driving action identification method
CN117292363A
