An improved method and system for human activity recognition based on wearable sensors
By constructing local spatiotemporal features and a multi-stage optimization model, combined with a residual network and a multi-head attention mechanism, the problems of insufficient local feature capture and gradient vanishing in wearable sensor human activity recognition are solved, and high-precision and robust human activity recognition is achieved, which is suitable for medical monitoring and motion analysis.
Patent Information
- Application Number
- CN202510421940.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-07
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2045-04-07
AI Technical Summary
Existing human activity recognition technology based on wearable sensors has problems such as insufficient fine capture of local features, gradient vanishing or exploding problems, incomplete recognition of symmetric and asymmetric activities, insufficient generalization, and lack of accuracy due to reliance on large amounts of data and hyperparameter settings.
Combining the residual network, multi-head attention mechanism and improved Pelican optimization algorithm, by constructing local spatiotemporal features and global spatiotemporal dependency features, using convolutional neural networks and bidirectional gated recurrent neural networks for feature extraction and optimization, combined with the improved multi-head attention mechanism and Pelican optimization algorithm, the extraction of key time step features and the understanding of global features are enhanced.
It significantly improves the accuracy and robustness of human activity recognition, can maintain high-precision recognition performance in complex scenarios, and is suitable for medical monitoring and motion analysis, taking into account both computational efficiency and model depth.
Smart Images

Figure CN120277535B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of human activity recognition, and in particular to an improved method and system for human activity recognition based on wearable sensors. Background Art
[0002] With the increasing aging population, healthy aging has become a major issue, providing new opportunities for the application of human activity recognition (HAR). By analyzing human activity signals and identifying movement behaviors, HAR technology demonstrates significant application value and research potential in healthcare, smart homes, human-computer interaction, and other fields. AI-based HAR systems are primarily categorized as those based on computer vision and wearable sensors. Compared to the former, the latter is more widely used due to its low cost, lack of privacy restrictions, and immunity to environmental interference.
[0003] In recent years, the rapid development of deep learning technology has provided new possibilities for automatic feature extraction, improving the recognition accuracy and practicality of human activity recognition systems; however, although many studies have improved classification performance by improving feature engineering and building deep learning models, there are still many shortcomings, including: lack of fine capture of local features; over-reliance on stacked network structures leading to gradient vanishing or explosion problems; focusing on the recognition of symmetric and asymmetric activities, which is not comprehensive enough and lacks generalization when dealing with complex activity classification tasks; reliance on large amounts of data, sensitivity to noise, and performance highly dependent on hyperparameter settings, resulting in a lack of accuracy performance.
[0004] In view of this, the present invention combines residual networks to solve the challenges of high-dimensional and long-term wearable device data in human activity recognition; introduces a multi-head attention mechanism based on sine and cosine periodic functions to generate time encoding, which enhances the extraction of key time step features; at the same time, in response to the problems of insufficient global search ability, poor adaptability and slow convergence of the traditional Pelican Optimization Algorithm (POA), an improvement scheme is proposed to refine the adjustment of key hyperparameters and enhance the synergy between modules; strengthen the understanding of global features and the ability to capture important information, enhance its effective modeling of long-term dependencies, ensure the transmission and retention of important information, and improve the stability and performance of the model. Summary of the Invention
[0005] In view of the defects in the prior art, the present invention provides an improved method and system for human activity recognition based on wearable sensors.
[0006] In order to achieve the above-mentioned objectives, in a first aspect, the present invention provides an improved method for human activity recognition based on wearable sensors, the method comprising the following steps: using a wearable sensor to collect time series original data of human activities, obtaining a time series feature tensor based on the time series original data to construct a local spatiotemporal feature of the human activity; based on the local spatiotemporal feature, combining residual connection to construct a first improved human activity recognition model to obtain a weighted fusion feature of the human activity; based on the weighted fusion feature, combining an improved multi-head attention mechanism to construct a second improved human activity recognition model to obtain a global spatiotemporal dependency feature of the time series original data; optimizing the second improved human activity recognition model according to the improved Pelican optimization algorithm to obtain a human activity recognition optimization model; optimizing the global spatiotemporal dependency feature through the human activity recognition optimization model to obtain a spatiotemporal dependency optimization feature to achieve improved recognition of the human activity. The present invention significantly improves the accuracy and robustness of human activity recognition by constructing local spatiotemporal features and multi-stage optimization models; the time series feature tensor effectively integrates the temporal dynamics and spatial correlation of sensor data, and accurately depicts the multi-dimensional motion patterns of complex activities; the weighted fusion features combined with residual connections enhance the model's ability to express deep features and avoid the gradient vanishing problem; the improved multi-head attention mechanism improves the ability to extract long-period motion features by capturing spatiotemporal dependencies at different time scales in parallel; the improved Pelican optimization algorithm is introduced to achieve global optimization of model parameters, effectively avoiding local optimality while reducing computational complexity; the human activity recognition optimization model finally constructed can maintain high-precision recognition performance in complex scenarios through a multi-level feature enhancement mechanism; it has strong applicability in the fields of medical monitoring and motion analysis, and provides a solution for human activity recognition of wearable devices that takes into account both computational efficiency and model depth.
[0007] Optionally, the method of collecting time series raw data of human activities using wearable sensors and obtaining a time series feature tensor based on the time series raw data to construct the local spatiotemporal features of the human activities includes: performing data preprocessing on the time series raw data to obtain the time series feature tensor, the data preprocessing including Gaussian filtering, sliding window division and normalization; and performing feature extraction on the time series feature tensor based on a convolutional neural network to construct the local spatiotemporal features. The present invention improves the accuracy and adaptability of human activity recognition through data preprocessing and deep feature extraction; Gaussian filtering effectively eliminates high-frequency noise interference in the raw data of the sensor and retains the key signals of the action; sliding window division converts continuous time series data into overlapping segments, which can not only capture the local details of dynamic changes, but also maintain the continuity characteristics of the action; normalization processing eliminates the dimensional differences of different sensors and improves the consistency of data distribution; by constructing a time series feature tensor, the multi-dimensional sensor signals are deeply fused in the time and space dimensions to form a structured representation that depicts the time and space correlation of human motion; feature extraction is performed based on convolutional neural networks, and more discriminative motion features are abstracted layer by layer through multi-layer convolution kernels, thereby effectively distinguishing complex actions with high similarity; it provides high-quality, low-redundancy feature input for subsequent model construction, taking into account both noise robustness and feature expression capabilities.
[0008] Optionally, based on the local spatiotemporal features, the first improved model for human activity recognition is constructed in combination with residual connections to obtain weighted fusion features of the human activity, including: parsing the local spatiotemporal features based on the time distribution layer to obtain forward time series information and backward time series information; performing weighted splicing of the forward time series information and the backward time series information based on the weighted splicing layer to obtain splicing output features; and according to the first improved model for human activity recognition, fusing the local spatiotemporal features and the splicing output features to obtain weighted fusion features. The present invention enhances the spatiotemporal correlation and discrimination ability of human activity characteristics through bidirectional temporal modeling and residual feature fusion mechanism; the time distribution layer captures the movement evolution trend and historical correlation respectively by analyzing the forward and backward temporal information, forming a complementary temporal dynamic representation; the weighted splicing layer dynamically adjusts the contribution weights of the bidirectional features through learnable parameters, balances the sensitivity of the bidirectional information in sudden movements, and realizes adaptive feature fusion; the residual network performs weighted fusion of the original local spatiotemporal features and the splicing output features, which not only retains the shallow detailed information but also integrates the deep abstract semantics; it makes up for the defect of the traditional unidirectional model in insufficient modeling of the temporal dependency of complex movements.
[0009] Optionally, based on the weighted fusion features, a second improved human activity recognition model is constructed in combination with an improved multi-head attention mechanism to obtain the global spatiotemporal dependency features of the time series original data, including: using the weighted fusion features as the input features of the improved multi-head attention mechanism; using linear transformation to obtain the attention scores of the input features, and obtaining multi-head attention distribution based on the weight matrix and the attention scores; according to the input features, different time codes are obtained based on sine periodic functions and cosine periodic functions, and fused multi-scale time codes are obtained based on the time codes; based on the second improved human activity recognition model, the multi-head attention distribution and the fused multi-scale time codes are weightedly summed to obtain output features, and the output features are used as the global spatiotemporal dependency features. The present invention significantly enhances the spatiotemporal dependency modeling capability of complex actions through an improved multi-head attention mechanism; maps weighted fusion features to different subspaces through parallel linear transformation, allowing the model to focus on multiple key spatiotemporal nodes at the same time, effectively capturing global correlations across time steps; obtains multi-scale time coding based on sine periodic functions and cosine periodic functions, adaptively characterizes the periodic laws and non-stationary characteristics of actions, and by fusing time coding of different frequencies, retains short-term action details and models long-term behavior patterns; deeply integrates the context-related features extracted by the attention mechanism with multi-scale temporal semantics through weighted summation, breaking through the traditional model's dependence on fixed time windows, and can still accurately analyze action intentions in intense exercise scenarios, solving the problems of local noise interference and timing drift in wearable sensor data, and having stronger spatiotemporal feature generalization capabilities.
[0010] Optionally, obtaining the attention score of the input feature by using a linear transformation includes:
[0011]
[0012] in, Score for attention, For query, is the key, is the value matrix, is the normalization function, The present invention improves the efficiency of spatiotemporal feature correlation modeling through a dynamic weight allocation mechanism; uses the dot product operation of the query matrix and the key matrix to calculate feature similarity, performs gradient stabilization processing through the key dimension, avoids the problem of excessive numerical values caused by high-dimensional matrix multiplication, and enhances the stability of model training; normalization converts similarity into probability distribution, so that the model adaptively focuses on the significant features of key time nodes; uses the value matrix to realize the aggregate expression of contextual information; accurately captures the dependency relationship between different timestamps in sensor data, and shows higher computational efficiency and feature discrimination in the spatiotemporal pattern recognition of complex human movements.
[0013] Optionally, obtaining a multi-head attention distribution according to a weight matrix combined with the attention score includes:
[0014]
[0015]
[0016] in, is the head of the multi-head attention mechanism, is the attention function, For query, is the key, is the value matrix, For the The weight matrix of each head, is the index of the head, is the multi-head attention distribution, is the splicing function, is the number of heads, The weight matrix after splicing. The present invention significantly enhances the multi-dimensional modeling capability of spatiotemporal dependencies through multi-head parallel computing and feature subspace decomposition strategy; each attention head maps the input to different subspaces through an independent weight matrix, so that the model focuses on differentiated features such as motion intensity, direction change, and timing rhythm; after the splicing function integrates multi-view features, the weight matrix performs adaptive dimensionality reduction and fusion on them, which not only retains the specific information of each subspace but also eliminates redundant interference; breaking through the representation bottleneck of single-head attention, synchronously analyzing multi-granularity associations across channels and time in complex actions, and improving the model's anti-interference ability to local noise and long sequence generalization performance through parameterized feature reconstruction.
[0017] Optionally, the optimizing the second improved human activity recognition model according to the improved Pelican optimization algorithm to obtain the human activity recognition optimization model includes: improving the Pelican optimization algorithm based on chaotic mapping, dynamic nonlinear inertia weight, vertical crossover operator and Pareto distribution to construct the improved Pelican optimization algorithm; optimizing the key hyperparameters of the second improved human activity recognition model by the improved Pelican optimization algorithm to obtain the human activity recognition optimization model. The present invention improves the parameter optimization efficiency and generalization performance of the human activity recognition model through an intelligent search algorithm with multi-strategy collaborative optimization; the chaos map initializes the population to enhance the global exploration ability of the algorithm, avoiding the traditional random initialization from falling into the local optimum; the dynamic nonlinear inertia weight adaptively adjusts the proportion of global search and local development according to the iteration progress; the vertical crossover operator enhances the population diversity through cross-dimensional information interaction and accelerates convergence to the optimal solution domain; the Pareto distribution guides the screening of non-dominated solution sets to achieve multi-objective balanced optimization of model accuracy and computational complexity; the improved Pelican optimization algorithm reduces the cost of manual parameter adjustment while enabling the model to adaptively match the characteristic distribution laws of different activity types. The human activity optimization model finally constructed has significant improvements in training efficiency, noise robustness and cross-user generalization ability, providing reliable algorithm support for real-time activity monitoring of wearable devices in dynamic environments.
[0018] Optionally, the Pelican optimization algorithm is improved based on chaotic mapping, dynamic nonlinear inertia weight, vertical crossover operator and Pareto distribution to construct the improved Pelican optimization algorithm, including: performing chaotic interference on the pelican population based on chaotic mapping to satisfy the following relationship:
[0019]
[0020] in, For the Pelican individuals in The position in dimensional space, is the disturbance amplitude control parameter, is a sine function, is a chaotic map, and the mathematical model of the chaotic map satisfies the following relationship:
[0021]
[0022] in, is the next position of the individual pelican, is the cosine function, is the order of the chaotic map, is the current position of the individual pelican; the new position of the individual pelican in the pelican population is obtained according to the dynamic nonlinear inertia weight, and the dynamic nonlinear inertia weight satisfies the following relationship:
[0023]
[0024] in, is the dynamic nonlinear inertia weight, is the minimum value of the dynamic nonlinear inertia weight, is the maximum value of the dynamic nonlinear inertia weight, is the current iteration number, is the maximum number of iterations; the new position of the pelican individual is updated according to the vertical crossover operator to obtain the updated position of the pelican individual, satisfying the following relationship:
[0025]
[0026] in, For the Pelican individuals in The position in the dimensional space, For the control parameters, The best individual in the current pelican population is The position in the dimensional space, For any random individual in the current pelican population, dimensional space; the Pareto distribution is used to iteratively optimize the updated position of the pelican individual to obtain the optimal position of the pelican individual, so as to construct the improved pelican optimization algorithm. The present invention significantly improves the global search capability and convergence efficiency of the pelican algorithm through multi-mechanism collaborative optimization; the chaotic mapping initializes the population, breaks the uniformity limitation of the traditional random distribution, generates a more diverse initial solution set through high-dimensional nonlinear mapping, and avoids premature convergence; the dynamic nonlinear inertia weight uses a quadratic decay function to dynamically balance global exploration and local development, gives a larger weight in the early iteration to enhance the cross-region search capability, and reduces the weight in the later stage to focus on fine-tuning parameters; the vertical crossover operator linearly interpolates the global optimal solution and the random solution, guiding the individual to approach the Pareto front while maintaining population diversity; the Pareto distribution optimization mechanism selects the multi-objective optimal solution through non-dominated sorting to ensure that the parameter combination is balanced in terms of recognition rate, calculation delay and other indicators; it solves the problem that the traditional optimization algorithm is prone to fall into local optimality and slow convergence in the human activity recognition model, and provides an efficient solution for model adaptive optimization in dynamic scenarios of wearable devices.
[0027] Optionally, the human activity recognition optimization model optimizes the global spatiotemporal dependency features to obtain spatiotemporal dependency optimization features to achieve improved recognition of the human activity, including: based on the fully connected layer, combining the spatiotemporal dependency optimization features to obtain the global features of the human activity; using the output layer to map the global features into category probabilities, classifying the human activities to obtain human activity classification results. The present invention significantly improves the accuracy and generalization performance of human activity recognition through the hierarchical structure of feature abstraction and probabilistic classification; the fully connected layer nonlinearly maps and globally integrates the spatiotemporal dependency optimization features, mines the deep correlations between different sensor channels through activation functions, and eliminates redundant noise to form a highly discriminative global feature vector; the output layer converts the global features into category probability distributions, suppresses overfitting, and ensures the robustness of the model to individual differences and dynamic environments; while retaining local action details, it strengthens the global temporal logic and maintains high classification accuracy in complex scenarios.
[0028] In the second aspect, the present invention provides an improved system for human activity recognition based on wearable sensors. The system executes the improved method for human activity recognition based on wearable sensors provided by the present invention. The system includes an input device, an output device, a processor, and a memory. The hardware facilities integrated by the present invention have excellent performance, and the input device, output device, processor, and memory are interconnected. The present invention builds an efficient information processing system through a high-performance hardware collaborative architecture, which improves the real-time and reliability of human activity recognition; the input device collects multimodal sensor signals with high precision to ensure the integrity of the original data; the processor is equipped with a parallel computing unit to efficiently execute complex algorithms such as spatiotemporal feature extraction and multi-head attention mechanism; the memory uses a high-speed cache mechanism to optimize the access efficiency of feature tensors and model parameters, supporting large-scale time series data processing; the output device provides real-time feedback of classification results. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 This is a flow chart of an improved method for human activity recognition based on wearable sensors according to an embodiment of the present invention;
[0030] Figure 2 This is a structural diagram of a convolutional neural network according to an embodiment of the present invention;
[0031] Figure 3 This is a structural diagram of a bidirectional gated recurrent neural network unit according to an embodiment of the present invention;
[0032] Figure 4 This is a structural diagram of an improved bidirectional gated recurrent neural network according to an embodiment of the present invention;
[0033] Figure 5 This is a structural diagram of the improved multi-head attention mechanism according to an embodiment of the present invention;
[0034] Figure 6 This is a structural flow chart of the improved Pelican optimization algorithm according to an embodiment of the present invention;
[0035] Figure 7 A schematic diagram of the structure of a human activity recognition optimization model according to an embodiment of the present invention;
[0036] Figure 8 This is a curve chart comparing the accuracy of the human activity recognition optimization model according to an embodiment of the present invention;
[0037] Figure 9 This is a loss comparison curve diagram of the human activity recognition optimization model according to an embodiment of the present invention;
[0038] Figure 10 A confusion matrix diagram of the human activity recognition optimization model according to an embodiment of the present invention;
[0039] Figure 11 A comparison chart of ablation experiment results in an embodiment of the present invention;
[0040] Figure 12 This is a framework diagram of an improved system for human activity recognition based on wearable sensors according to an embodiment of the present invention. DETAILED DESCRIPTION
[0041] Specific embodiments of the present invention will be described in detail below. It should be noted that the embodiments described herein are for illustrative purposes only and are not intended to limit the present invention. In the following description, numerous specific details are set forth to provide a thorough understanding of the present invention. However, it will be apparent to one of ordinary skill in the art that these specific details are not necessarily required to practice the present invention. In other instances, well-known circuits, software, or methods are not specifically described to avoid obscuring the present invention.
[0042] Throughout this specification, references to "one embodiment," "an embodiment," "an example," or "an example" mean that a particular feature, structure, or characteristic described in connection with the embodiment or example is included in at least one embodiment of the present invention. Therefore, appearances of the phrases "in one embodiment," "in an embodiment," "an example," or "an example" in various places throughout this specification are not necessarily all referring to the same embodiment or example. Furthermore, the particular features, structures, or characteristics may be combined in any suitable combinations and / or subcombinations in one or more embodiments or examples. Furthermore, those of ordinary skill in the art will appreciate that the figures provided herein are for illustrative purposes only and are not necessarily drawn to scale.
[0043] See Figure 1 An embodiment of the present invention provides an improved method for human activity recognition based on wearable sensors, the method comprising the following steps:
[0044] S1. Use wearable sensors to collect time series raw data of human activities, and obtain a time series feature tensor based on the time series raw data to construct local spatiotemporal features of the human activities.
[0045] In this embodiment, first, wearable sensors (plantar pressure sensor, accelerometer sensor and gyroscope) are used to collect time series raw data of human activities; then, because data collection may be affected by factors such as environmental interference and sensor error, the data is preprocessed, and Gaussian filtering, sliding window division and normalization methods are used to reduce noise, so as to effectively remove noise and retain important signal features. Normalization ensures that all sensor data are processed at the same scale, thereby improving the efficiency and stability of model training; the combination of these three methods not only significantly reduces the impact of noise on the data, but also enhances the availability of the data and further improves the model performance; finally, the preprocessed raw data is feature integrated and converted into a time series feature tensor with the shape of (number of samples, time step, feature dimension).
[0046] Among them, the Gaussian filter parameters are set as , the time window size is set to 50 and the step size is 10, that is, each window contains 50 data points and the window moves forward with a step size of 10 data points.
[0047] Furthermore, the convolutional neural network (CNN) is used to automatically extract the temporal feature tensor to obtain local spatiotemporal features.
[0048] See Figure 2 , the figure shows the structure of a convolutional neural network; as the core component for extracting behavioral features of sensor data, the basic network structure of a convolutional neural network consists of an input layer, a hidden layer, and an output layer; the hidden layer usually contains modules such as a convolution layer and a pooling layer; through the combination of these structures, the convolutional neural network can effectively convert the original sensor signals into features with stronger representation capabilities, thereby improving the accuracy and efficiency of human behavior recognition.
[0049] In this embodiment, a one-dimensional convolutional neural network (1D-CNN) is used to process high-dimensional and long one-dimensional time series data, significantly reducing computational complexity and memory consumption, avoiding the gradient vanishing or exploding problems common in long time series data, and making the model more stable during training. To further improve the performance of the combined model and reduce the risk of overfitting, batch normalization and dropout layers are added after the convolution layer. The model is composed of two convolutional layers. Before optimization, each convolution layer is set with 64 convolution kernels of a kernel size of 3. After each convolution layer, a batch normalization layer, a MaxPooling1D layer, and a final dropout layer are added in sequence. The above additional layers enhance the generalization ability of the model through regularization.
[0050] S2. Constructing a first improved model for human activity recognition based on the local spatiotemporal features and in combination with residual connections to obtain weighted fusion features of the human activity.
[0051] See Figure 3 , the figure shows the structure of the bidirectional gated recurrent neural network unit; the gated recurrent neural network unit (GRU) is an improved recurrent neural network (RNN) designed for processing long-distance dependency problems in sequence data; by introducing update gates and reset gates to alleviate the gradient vanishing problem, thereby learning longer time dependencies, the bidirectional gated recurrent neural network unit (BiGRU) has been improved in both directions in structure, so that it can make fuller use of the previous and next context information, and better use the previous and next context information, so as to more comprehensively understand the temporal relationship in the data.
[0052] In the existing technology, the CNN-BiGRU model achieves efficient analysis of human activity data by combining automatic feature extraction and temporal relationship modeling; the spatial feature extraction of CNN and the temporal dependency modeling of BiGRU work together to enable the model to focus on local details of the activity while capturing global temporal patterns.
[0053] In addition, the combination of CNN and BiGRU also demonstrates unique advantages in balancing the model's expressive power and computational efficiency; CNN is responsible for extracting features while avoiding the complexity of manually designing features, while BiGRU effectively captures the dynamic changes of time series data through comprehensive learning of forward and backward information.
[0054] However, CNN-BiGRU also has some limitations in its application: although deep convolutional neural networks can extract multi-layer features, gradients may still disappear or explode in complex networks, resulting in unstable training or difficulty in model convergence; BiGRU mainly focuses on local temporal dependencies and fails to fully utilize long-term before-after relationships, which makes the model's efficiency in capturing global information limited when processing long sequence data and dynamic and frequently changing activities, and its accuracy is slightly insufficient.
[0055] In this embodiment, the local spatiotemporal features are analyzed based on the time distribution layer (forward GRU, backward GRU) to obtain forward temporal information and backward temporal information; the forward temporal information and backward temporal information are weightedly spliced based on the weighted splicing layer to obtain splicing output features; on the basis of the CNN-BiGRU model, residual connections are added to construct a first improved model for human activity recognition to enhance its effective modeling of long-term dependencies; according to the first improved model for human activity recognition, the local spatiotemporal features and the splicing output features are fused to obtain weighted fusion features.
[0056] See Figure 4, the figure shows the structure of an improved bidirectional gated recurrent neural network; in order to enhance the model's ability to model long-term dependencies and promote information flow, the present invention introduces a residual connection between CNN and BiGRU.
[0057] Specifically, the residual connection adds the input and output of BiGRU to form a skip connection, effectively alleviating the gradient vanishing problem and promoting information flow. In addition, the residual connection also helps BiGRU better capture long-term dependencies and accelerate the convergence process, while enhancing its ability to learn complex time series data patterns.
[0058] In the task of human activity recognition, the contributions of forward and backward temporal information may not be the same; forward temporal information usually reflects the evolution of the current state, while backward temporal information provides a review of the previous state; the traditional BiGRU simply directly concatenates the forward and backward outputs to form the final output.
[0059] In order to make full use of forward and backward timing information, a weighted splicing mechanism is introduced; by assigning different weights to forward and backward timing information, the model can process these two types of information more flexibly; forward timing information can be strengthened through weights, and backward timing information can be adjusted through weights; the forward weight is used as a key hyperparameter and is optimized through an optimization algorithm to find the best weight ratio suitable for the model; the given initial forward weight is 0.5.
[0060] S3. Based on the weighted fusion features, a second improved human activity recognition model is constructed in combination with an improved multi-head attention mechanism to obtain the global spatiotemporal dependency features of the original time series data.
[0061] The multi-head attention mechanism (MHA) fused with temporal coding is introduced to enhance the model's understanding of global features and its ability to capture important information.
[0062] See Figure 5 , the figure shows the structure of the improved multi-head attention mechanism; the improvement is mainly based on the generation of different time codes based on the periodic function of sine and cosine, and these codes are fused with the input features, and then input into the multi-head attention mechanism, which enhances the model's understanding of dynamic changes, enables the model to more flexibly select important features, capture deeper connections, and perform more powerfully in complex and dynamic tasks; the coding range is usually in between; the number of “heads” set is 4, and the initial attention key value is 64.
[0063] In this embodiment, weighted fusion features are used as input features of the improved multi-head attention mechanism; linear transformation is used to obtain the attention score of the input feature, and the multi-head attention distribution is obtained based on the weight matrix and the attention score; according to the input features, different time codes are obtained based on sine periodic functions and cosine periodic functions, and fused multi-scale time codes are obtained based on the time codes; based on the second improved model of human activity recognition, the multi-head attention distribution and the fused multi-scale time codes are weightedly summed to obtain the output features.
[0064] Specifically, the multi-head attention mechanism is a mechanism that enhances the model's attention to different parts of the data and is often used in sequence data analysis. By calculating different attention distributions through multiple "heads", the model can learn multiple features in different dimensions and positions.
[0065] The attention score satisfies the following relationship:
[0066]
[0067] in, Score for attention, For query, is the key, is the value matrix, is the normalization function, The dimension of the key.
[0068] The calculation of each "head" satisfies the following relationship:
[0069]
[0070] in, is the head of the multi-head attention mechanism, is the attention function, For query, is the key, is the value matrix, For the The weight matrix of each head, The index of the header.
[0071] The attention distribution satisfies the following relationship:
[0072]
[0073] in, is the multi-head attention distribution, For query, is the key, is the value matrix, is the splicing function, is the head of the multi-head attention mechanism, is the number of heads, is the concatenated weight matrix.
[0074] S4. Optimize the second improved human activity recognition model according to the improved Pelican optimization algorithm to obtain an optimized human activity recognition model.
[0075] The Pelican Optimization Algorithm (POA) is a nature-inspired algorithm inspired by the hunting behavior of reptiles. It consists of two phases: global search and local search. Before hunting, a population of pelicans must be initialized. In the first phase, the location of prey is randomly generated within the search space. If the new location's fitness value is better than the previous one, the current position is updated. In the second phase, individual pelicans determine their flight direction and distance based on their own position, the global optimal solution, and the positions of other pelicans.
[0076] The traditional Pelican optimization algorithm has the following shortcomings: the algorithm's global search capability in complex optimization spaces is insufficient and it is prone to falling into local optimal solutions; the fixed inertia weight reduces the adaptability of the algorithm and affects the convergence speed; the insufficient diversity of solutions may lead to the loss of exploration potential.
[0077] To solve the above problems, the Pelican optimization algorithm is improved based on chaotic mapping, dynamic nonlinear inertia weight, vertical crossover operator and Pareto distribution to construct an improved Pelican optimization algorithm.
[0078] See Figure 6 ,The figure shows the structural flow chart of the improved Pelican optimization algorithm.
[0079] First, the initialization phase remains unchanged. In the first phase, a chaotic map (Chebyshev map) is introduced to perform chaotic interference to increase the randomness of the pelican population and the diversity of solutions, thereby preventing the algorithm from falling into a local optimum. The following relationship is satisfied:
[0080]
[0081] in, For the Pelican individuals in The position in the dimensional space, is the disturbance amplitude control parameter, is a sine function, is a chaotic map, and the mathematical model of the chaotic map satisfies the following relationship:
[0082]
[0083] in, is the next position of the individual pelican, is the cosine function, is the order of the chaotic map, is the current location of the individual pelican.
[0084] In the second stage, a dynamic nonlinear inertia weight is introduced. A higher dynamic nonlinear inertia weight is initially used to enhance the global search capability, and then the dynamic nonlinear inertia weight is gradually reduced to optimize the local search. The new positions of the individual pelicans in the pelican population are obtained based on the dynamic nonlinear inertia weight, and the dynamic nonlinear inertia weight satisfies the following relationship:
[0085]
[0086] in, is the dynamic nonlinear inertia weight, is the minimum value of the dynamic nonlinear inertia weight, is the maximum value of the dynamic nonlinear inertia weight, is the current iteration number, is the maximum number of iterations.
[0087] in, , .
[0088] Next, the crossover operator is used to generate new solutions for the features of different particles, further enhancing the algorithm's exploration capability. The new positions of the pelicans are updated using the vertical crossover operator to obtain the updated positions of the pelicans, satisfying the following relationship:
[0089]
[0090] in, For the Pelican individuals in The position in dimensional space, is the control parameter, The best individual in the current pelican population is The position in dimensional space, For any random individual in the current pelican population, Position in dimensional space.
[0091] in, .
[0092] Finally, the Pareto distribution is used to iteratively optimize the updated positions of the pelicans to obtain the optimal positions of the pelicans. The Pareto distribution is used to optimize the solutions to ensure that the optimal solution is retained in each iteration, thus accelerating the optimization process.
[0093] In this embodiment, the key hyperparameters of the second improved human activity recognition model are optimized by improving the Pelican optimization algorithm to obtain a human activity recognition optimization model (POA-CNN-ResBiGRU-MHA model). The key hyperparameters, including the learning rate, the number of convolution kernels, the number of GRU units, the forward GRU output weights and the key dimensions of the attention mechanism, are optimized by the improved Pelican optimization algorithm (POA) to improve the stability and performance of the model, and to improve the accuracy and robustness of the model under different activity categories. The improved optimization algorithm can find the optimal parameters more efficiently, and can effectively avoid falling into local optimality, resulting in better results.
[0094] S5. Optimizing the global spatiotemporal dependency features through the human activity recognition optimization model to obtain spatiotemporal dependency optimization features, so as to achieve improved recognition of the human activity.
[0095] In this embodiment, based on the fully connected layer, the global features of the human activities are obtained in combination with the spatiotemporal dependency optimization features; the output layer is used to map the global features into category probabilities, and the human activities are classified to obtain human activity classification results, including walking, climbing stairs, descending stairs, uphill and downhill.
[0096] For details, see Figure 7 , the figure is a structural diagram of the human activity recognition optimization model; it includes five main modules: data preprocessing module, feature extraction module (1DCNN), improved temporal modeling module (ResBiGRU), improved attention module (MHA) and improved model optimization algorithm module (POA).
[0097] Sensor data first undergoes feature integration in a preprocessing module, converting it into a time series feature tensor with the shape (number of samples, time steps, feature dimensions). A convolutional neural network then automatically extracts local spatiotemporal features, which are then manipulated in the temporal dimension by the time distribution layer. The BiGRU module captures forward and backward temporal information, and the weighted concatenation layer performs a weighted fusion of the forward and backward outputs. Residual connections are used to add the input features to the concatenated output features to minimize information loss.
[0098] A multi-head attention mechanism that combines two temporal encodings calculates the relative importance of input features, focusing on different parts of the data in parallel and comprehensively learning the temporal and spatial dependencies within the data. Next, a fully connected layer with ReLU activation further processes and maps the extracted features. Finally, a softmax-activated output layer maps the features to class probabilities for classification. Finally, an improved Pelican Optimization Algorithm (POA) is introduced to optimize key hyperparameters to ensure optimal model performance, thereby improving the recognition accuracy and robustness of different categories of human activity.
[0099] S6. Experimental verification and analysis.
[0100] S6 specifically includes the following steps:
[0101] S61. Experimental dataset preparation and public dataset.
[0102] The data acquisition equipment consists of a homemade smart insole, a homemade smart bracelet and a smart phone. It integrates multiple sensors such as flexible thin film pressure sensors, accelerometers and gyroscopes to achieve comprehensive collection of human activity data.
[0103] During the experimental preparation phase, in order to evaluate the performance of the improved algorithm, each experimenter wore corresponding data acquisition equipment, with a thin film pressure sensor attached to the foot, an inertial sensor placed at the ankle, a smart bracelet placed at the wrist, and a smartphone placed in the outer pocket of the shirt.
[0104] The experiment selected 12 volunteers to participate in the test, half of whom were men and half were women. The volunteers were required to perform five actions in the selected experimental environment, including walking, climbing stairs, descending stairs, going uphill and downhill, until the entire distance was completed. The sensor rate was set to 20Hz, and the whole process took an average of 7.3 minutes to complete. A total of 98,696 sets of data were collected from all experiments to form the experimental dataset.
[0105] The public dataset uses a multimodal gait database created and provided by Honda Europe. It primarily records everyday walking scenes in natural urban environments, including the simultaneous collection of IMU (inertial measurement unit), FSR (plantar pressure sensor), and gaze data. The participants include 20 men and women of various ages, and the data is collected from three different field routes. All sensor data was downsampled at 60Hz, and a total of 846,715 data sets were collected.
[0106] S62. Data preprocessing.
[0107] To better classify time series, the sensor data collected in the experiment requires specific processing to meet the model requirements. First, the required data is exported from the host computer and then preprocessed. Because data collection may be affected by factors such as environmental interference and sensor errors, Gaussian filtering, sliding window partitioning, and normalization methods are used to reduce noise. The parameter settings are the same as those for the preprocessing in step S1.
[0108] S63. Training process and result evaluation.
[0109] In terms of experimental environment, all classification methods are implemented in Python 3.9 environment using TensorFlow framework and related libraries. During the model training process, the batch size is set to 64 and the learning rate is , Adam was selected as the optimizer. The experimental dataset was divided into training, validation, and test sets in a ratio of 7:1:2. All experiments were conducted on the experimental dataset, and the final results are based on the performance on the test set.
[0110] The confusion matrix is a fundamental tool for evaluating model classification performance. However, when dealing with large amounts of data, the confusion matrix alone may not be able to accurately assess the overall performance of the model. Therefore, the accuracy, error, precision, recall, and F1 metrics are introduced to expand the analysis of the confusion matrix. The mathematical expressions of the evaluation metrics are as follows:
[0111]
[0112]
[0113]
[0114]
[0115] in, is the accuracy, For a real example, is a true negative example, For a false positive example, is a false negative example, is the accuracy, is the recall rate, is the F1 indicator,
[0116] During training, the model is trained and validated under preset parameters until a sufficient number of iterations are reached to produce test set results. By introducing an early stopping function, we repeatedly try to determine the optimal number of iterations. After more than twenty epochs, the results fluctuate within an acceptable range, so we set the training epoch number to 30.
[0117] See Figure 8 The figure shows the accuracy comparison curve of the human activity recognition optimization model; it includes the accuracy curves on the training set and the validation set, describing the changing trend of the accuracy with the training rounds.
[0118] See Figure 9 The figure shows the loss comparison curve of the human activity recognition optimization model; it includes the loss curves on the training set and the validation set, describing the change trend of the loss with the training rounds.
[0119] from Figure 8 and Figure 9 It can be seen that the fitting of the human activity recognition optimization model is very good, and the model can achieve an accuracy of 98.52% on the training set and 97.32% on the validation set.
[0120] See Figure 10 , the figure shows the confusion matrix diagram of the human activity recognition optimization model; the confusion matrix of the model on the experimental dataset is plotted, which further verifies the effectiveness and stability of the proposed model in multi-person activity recognition tasks in complex activities and dynamic scenes.
[0121] Furthermore, the optimized human activity recognition model demonstrated superior performance and effectiveness in human behavior recognition tasks. Experimental comparisons were conducted on a multimodal gait dataset using the latest existing models in the field of human activity recognition, including CNN-ResBiGRU-MHA, Transform-BiLSTM, CNN-BiLSTM, CNN-BiGRU, and DWCNN. The comparison results are shown in Table 1:
[0122] Table 1: Performance comparison of various algorithms on multimodal gait public datasets
[0123]
[0124] As can be seen from Table 1, in terms of overall accuracy, the human activity recognition optimization model of the present invention outperforms other comparison models in all evaluation indicators, and the average accuracy on the selected public dataset can reach 98.94%, further verifying the superiority and practical application potential of the human activity recognition optimization model in human activity recognition tasks.
[0125] S64. Ablation experiment.
[0126] See Figure 11 The figure shows a comparison of ablation experiment results. To verify the effectiveness and contribution of each component of the optimized human activity recognition model, we removed or replaced different modules or features one by one to observe changes in model performance. All models were tested on public datasets, with a training batch size of 30 and 20 iterations of testing. The accuracy on the test set was recorded for each iteration.
[0127] Experimental results show that the basic CNN and BiGRU models have low accuracy, reflecting their inability to model long time periods and capture local features. However, the introduction of the multi-head attention mechanism significantly improves model performance, validating the effectiveness of the attention mechanism in extracting key time-step features from time series data and enhancing its ability to capture global features and important information.
[0128] Compared with CNN-ResBiGRU-MHA, the accuracy of the human activity recognition optimization model is further improved and more stable, which further demonstrates that the hyperparameters obtained by the optimization algorithm POA can effectively improve the model performance, thereby enhancing the accuracy and robustness under different activity categories. It also proves that the various modules and improvements are very necessary and reasonable.
[0129] See Figure 12 In an optional embodiment, the present invention provides an improved system for human activity recognition based on wearable sensors. The system includes an input device, an output device, a processor, and a memory, wherein the hardware components are interconnected. The memory is used to store a computer program, which includes program instructions. The processor is configured to invoke the program instructions and execute the specific steps of the embodiments of the improved method for human activity recognition based on wearable sensors provided by the present invention. The improved system for human activity recognition based on wearable sensors provided by the present invention has a complete structure, is objective and stable, and enhances the overall applicability and practical application capabilities of the present invention.
[0130] In summary, the present invention provides an improved method and system for wearable sensor-based human activity recognition. It also proposes an optimized model for wearable sensor-based human activity recognition, combining a residual network to address the challenges of high-dimensional, long-duration wearable device data in human activity recognition. The model introduces a multi-head attention mechanism based on time encoding generated by periodic sine and cosine functions, enhancing the extraction of key time-step features. Furthermore, to address the shortcomings of the traditional Pelican optimization algorithm, such as insufficient global search capability, poor adaptability, and slow convergence, an improved solution is proposed, aiming to refine the adjustment of key hyperparameters and enhance the synergy between modules. Validation on experimental datasets created in real environments and public datasets demonstrates that the model algorithm performs optimally and exhibits good robustness. Future research will explore the potential application of optimization algorithms in edge computing, as well as few-shot learning techniques, which will enhance the real-world applicability of the model and promote the diversification and universality of field technologies.
[0131] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or make equivalent replacements for some or all of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present invention, and they should all be included in the scope of the claims and description of the present invention.
Claims
1. An improved method for human activity recognition based on wearable sensors, characterized in that: The steps include: Using wearable sensors to collect time series raw data of human activities, obtaining a time series feature tensor based on the time series raw data to construct local spatiotemporal features of the human activities; Constructing a first improved model for human activity recognition based on the local spatiotemporal features and in combination with residual connections to obtain weighted fusion features of the human activity; Based on the weighted fusion features, a second improved human activity recognition model is constructed in combination with an improved multi-head attention mechanism to obtain the global spatiotemporal dependency features of the original time series data; Optimizing the second improved human activity recognition model according to the improved Pelican optimization algorithm to obtain an optimized human activity recognition model; Optimizing the global spatiotemporal dependency features by using the human activity recognition optimization model to obtain spatiotemporal dependency optimization features, so as to achieve improved recognition of the human activity; The first improved human activity recognition model is constructed based on the local spatiotemporal features and combined with residual connections to obtain weighted fusion features of the human activity, including: Analyzing the local spatiotemporal features according to the time distribution layer to obtain forward time series information and backward time series information; Performing weighted splicing on the forward time series information and the backward time series information based on a weighted splicing layer to obtain a splicing output feature; According to the first improved model for human activity recognition, the local spatiotemporal features and the spliced output features are fused to obtain weighted fusion features; The second improved human activity recognition model is constructed based on the weighted fusion features and combined with the improved multi-head attention mechanism to obtain the global spatiotemporal dependency features of the time series original data, including: Using the weighted fusion features as input features of the improved multi-head attention mechanism; Using linear transformation to obtain the attention score of the input feature, and combining the attention score with the weight matrix to obtain a multi-head attention distribution; According to the input features, different time codes are obtained based on a sine periodic function and a cosine periodic function, and a fused multi-scale time code is obtained according to the time codes; Based on the second improved human activity recognition model, performing weighted summation on the multi-head attention distribution and the fused multi-scale time coding to obtain an output feature, wherein the output feature serves as the global spatiotemporal dependency feature; The step of optimizing the second improved human activity recognition model according to the improved Pelican optimization algorithm to obtain the human activity recognition optimization model includes: The Pelican optimization algorithm is improved based on chaos mapping, dynamic nonlinear inertia weight, vertical crossover operator and Pareto distribution to construct the improved Pelican optimization algorithm; Optimizing the key hyperparameters of the second improved human activity recognition model using the improved Pelican optimization algorithm to obtain the human activity recognition optimization model; The Pelican optimization algorithm is improved based on chaotic mapping, dynamic nonlinear inertia weight, vertical crossover operator and Pareto distribution to construct the improved Pelican optimization algorithm, including: The chaotic interference of the pelican population based on the chaotic map satisfies the following relationship: in, For the Pelican individuals in The position in the dimensional space, is the disturbance amplitude control parameter, is a sine function, is a chaotic map, and the mathematical model of the chaotic map satisfies the following relationship: in, is the next position of the individual pelican, is the cosine function, is the order of the chaotic map, is the current location of the individual pelican; The new position of each pelican in the pelican population is obtained according to the dynamic nonlinear inertia weight, wherein the dynamic nonlinear inertia weight satisfies the following relationship: in, is the dynamic nonlinear inertia weight, is the minimum value of the dynamic nonlinear inertia weight, is the maximum value of the dynamic nonlinear inertia weight, is the current iteration number, is the maximum number of iterations; The new position of the pelican individual is updated according to the vertical crossover operator to obtain the updated position of the pelican individual, which satisfies the following relationship: in, For the Pelican individuals in The position in dimensional space, is the control parameter, The best individual in the current pelican population is The position in dimensional space, For any random individual in the current pelican population, Position in dimensional space; The Pareto distribution is used to iteratively optimize the updated positions of the pelican individuals to obtain the optimal positions of the pelican individuals, so as to construct the improved pelican optimization algorithm.
2. The improved method for human activity recognition based on wearable sensors according to claim 1 is characterized in that: The method of collecting time series raw data of human activities using a wearable sensor and obtaining a time series feature tensor based on the time series raw data to construct local spatiotemporal features of the human activities includes: Performing data preprocessing on the original time series data to obtain the time series feature tensor, wherein the data preprocessing includes Gaussian filtering, sliding window division and normalization; Feature extraction is performed on the time series feature tensor based on a convolutional neural network to construct the local spatiotemporal feature.
3. The improved method for human activity recognition based on wearable sensors according to claim 1, characterized in that: The obtaining of the attention score of the input feature by using a linear transformation includes: in, Score for attention, For query, is the key, is the value matrix, is the normalization function, The dimension of the key.
4. The improved method for human activity recognition based on wearable sensors according to claim 1, characterized in that: The multi-head attention distribution is obtained according to the weight matrix combined with the attention score, including: in, is the head of the multi-head attention mechanism, is the attention function, For query, is the key, is the value matrix, For the The weight matrix of each head, is the index of the head, is the multi-head attention distribution, is the splicing function, is the number of heads, is the concatenated weight matrix.
5. The improved method for human activity recognition based on wearable sensors according to claim 1, characterized in that: The optimizing model for human activity recognition is used to optimize the global spatiotemporal dependency features to obtain spatiotemporal dependency optimization features, so as to improve the recognition of the human activity, including: Based on the fully connected layer, the global features of the human activity are obtained by combining the spatiotemporal dependency optimization features; The global features are mapped into category probabilities using an output layer, and the human activities are classified to obtain human activity classification results.
6. An improved system for human activity recognition based on wearable sensors, characterized in that: The system includes an input device, an output device, a processor and a memory, wherein the input device, the output device, the processor and the memory are interconnected, wherein the memory is used to store a computer program, the computer program includes program instructions, and the processor is configured to call the program instructions to execute the improved method for human activity recognition based on wearable sensors according to any one of claims 1 to 5.
Citation Information
Patent Citations
Robot path planning method based on improved pelican optimization algorithm
CN117471919A
Human body behavior recognition method and system based on space-time fusion network
CN119541053A