An incremental learning method and system applied to human activity recognition
Patent Information
- Application Number
- CN202611061560.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-16
- Publication Date
- 2026-10-20
AI Technical Summary
[0006]本发明的目的在于提供一种应用于人体活动识别的增量学习方法及系统,用于解决现有技术中时间序列增量学习方法对于新运动类别的加入,难以进行新旧类别针对性优化导致增量学习效率较低、优化效果不佳的问题
[0047]本发明上述的应用于人体活动识别的增量学习系统的技术方案能够实现与上述的应用于人体活动识别的增量学习方法一致的有益效果。
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This invention belongs to the field of artificial intelligence and time-series data processing, and specifically relates to an incremental learning method and system for human activity recognition. Background Technology
[0002] With the widespread adoption of IoT devices, time-series data is prevalent in modern applications. Smartwatches, wristbands, and medical monitoring devices generate massive amounts of human motion time-series data. The distribution of this data is often non-stationary, and new categories (such as new activity patterns and new types of arrhythmias) continue to emerge over time.
[0003] Deep learning models excel on static datasets, but when faced with dynamic motion sensor data streams, model parameters are updated to adapt to new categories, often leading to the forgetting of previously learned knowledge for older categories. This problem is particularly pronounced in human activity recognition scenarios: First, limited by the memory constraints of smart wearable edge devices, commonly used random sample replay strategies struggle to retain high-dimensional samples capturing core movement patterns, resulting in significant sample bias within the buffer. Second, the limited number of stored samples lacks feature diversity, and different human activities often exhibit high similarity in sensor waveforms (feature confusion), such as "fast walking" versus "jogging," or "climbing stairs" versus "hiking," which are easily confused in three-axis acceleration signals, leading to feature space collapse. Finally, with the continuous addition of new motion categories, overlapping distributions easily occur between old and new categories in the feature space, and existing methods lack effective mechanisms to decouple this global distribution.
[0004] Existing time-series incremental learning methods, such as regularization-based LwF, replay-based ER, and DER++, often focus only on single-level optimization. For example, simple replay methods ignore the importance of buffer sample quality; regularization methods perform poorly when there are large task differences; and methods based on pre-trained models have limitations in adaptability to specific domains. These problems not only restrict the long-term usability of models in dynamic environments but also directly affect the user experience and commercial value of smart wearable devices. For example, misidentification of movement patterns due to model forgetting can reduce the reliability of health monitoring data.
[0005] Chinese invention patent application CN107886061A discloses a method and system for human behavior recognition based on a multimodal deep Boltzmann machine. The method includes the following steps: 1) acquiring data from visual and wearable sensors; 2) establishing a multimodal fusion model of visual data and wearable sensor data; 3) using a deep neural network for heterogeneous transfer learning to reconstruct missing data; 4) using a softmax regression model classifier for classification; and 5) adaptively adjusting the deep network model generated from public sample data according to individual user characteristics. This invention can improve the accuracy of human behavior recognition in complex scenarios and when data is missing. Specifically, it trains the model generated from public data using labeled sample data and mini-batch incremental learning. This involves dividing all samples into several parts, updating parameters for each part. The larger the sample size in each part, the higher the model training accuracy, but the more time is required. Therefore, a reasonable choice of mini-batch size is necessary to balance accuracy and time. Furthermore, frequent large-scale model updates for learning new actions increase device energy consumption and computational burden, which does not meet the core requirements of high efficiency and low power consumption for wearable devices. Summary of the Invention
[0006] The purpose of this invention is to provide an incremental learning method and system for human activity recognition, which solves the problem that existing time-series incremental learning methods are difficult to optimize for new and old categories when adding new motion categories, resulting in low incremental learning efficiency and poor optimization effect.
[0007] To achieve the above objectives, a first aspect of the present invention provides an incremental learning method for human activity recognition, comprising:
[0008] Based on the collected new category samples of human activity, extract the features of the new category samples; extract the features of each old category sample respectively; each category contains a set of non-overlapping category samples corresponding to the human activity category; the category samples contain the time series data corresponding to that category;
[0009] Based on the features of all old category samples for each old category, calculate the prototype anchor point for each category and select the old category sample with the highest similarity to the prototype anchor point in each category as the anchor point sample;
[0010] Anchor samples are augmented temporally to obtain augmented samples. Anchor samples and augmented samples of the same category are considered positive sample pairs, while anchor samples and augmented samples of different categories are considered negative sample pairs.
[0011] The recognition model is trained using a dynamic loss function to achieve incremental learning. The dynamic loss function includes an adaptive weighted loss term and a contrastive loss term. The adaptive weighted loss term is obtained by weighting the classification loss of the recognition model calculated for the new category sample features and each old category sample features according to the adaptive weights calculated by the distances between the new category sample features and each old category sample features. The contrastive loss term is used to bring positive sample pairs closer together and push negative sample pairs apart.
[0012] The first aspect of this invention provides an incremental learning method for human activity recognition. In one possible implementation, the dynamic loss function further includes a basic classification loss term. The basic classification loss term is calculated based on the classification results obtained from the input recognition model of anchor samples of each old category and samples of the new category, along with the corresponding true category labels.
[0013] The first aspect of this invention provides an incremental learning method for human activity recognition. In one possible implementation, the adaptive weights are calculated from the distances between the features of the new category samples and the features of each old category sample, including:
[0014] Calculate the MMD distance between the features of the new category samples and each feature of the old category samples; adjust the calculated MMD distances for each group based on the activation function and sensitivity coefficient, and calculate the adaptive weights based on the adjusted MMD distances; adjust the sensitivity coefficients according to the dynamic loss function so that the calculated adaptive weights are smaller when the difference between the features of the new category samples and the features of the old category samples is large, and larger when the difference between the features of the new category samples and the features of the old category samples is small.
[0015] The first aspect of this invention provides an incremental learning method for human activity recognition. In one possible implementation, the method for calculating the classification loss of the recognition model for each new category and each old category includes:
[0016] For each new category and each old category, the classification loss is calculated based on the mini-batch sample set obtained from the old and new categories during the training of the recognition model, the true category label of each sample, the value of the true category label in the logit output of the recognition model for each sample, and the sum of the logit exponents of the old and new categories.
[0017] The first aspect of this invention provides an incremental learning method for human activity recognition. In one possible implementation, the temporal enhancement of anchor samples includes strong enhancement and weak enhancement. Strong enhancement enhances anchor samples by combining fragment substitution and strong jitter to simulate significant temporal pattern changes, so that the model learns the semantic invariance of local features. Weak enhancement enhances anchor samples by combining scaling and weak jitter to simulate sensor noise and subtle amplitude fluctuations.
[0018] The first aspect of this invention provides an incremental learning method for human activity recognition. In one possible implementation, the method of calculating the prototype anchor point for each category based on the features of all old category samples for each old category and selecting the old category sample with the highest similarity to the prototype anchor point in each category as the anchor point sample includes:
[0019] Calculate the arithmetic mean of the feature vectors of all old category samples for each old category. Based on the arithmetic mean calculated for each old category, obtain the prototype anchor point for each old category. Then, select the old category sample with the highest similarity to the prototype anchor point in each category and store them in the buffer as anchor point samples for each category.
[0020] The first aspect of this invention provides an incremental learning method for human activity recognition. In one possible implementation, the calculation of the contrast loss term includes:
[0021] The contrast loss term is calculated using the similarity between each anchor sample and its corresponding positive sample, the similarity between each anchor sample and other samples containing the corresponding positive and negative samples, the temperature scaling factor, the set of indices of all anchor samples, and the set of corresponding positive samples of all anchor samples, with temperature scaling normalized cross-entropy loss.
[0022] The first aspect of this invention provides an incremental learning method for human activity recognition. In one possible implementation, the calculation of the MMD distance between the features of the new category sample and the features of each old category sample includes:
[0023] By using a multi-kernel Gaussian kernel function, the features of each old category feature set and the new category feature set are mapped to the regenerated kernel Hilbert space.
[0024] By calculating the kernel matrix in blocks, and using the mapping results, the MMD distance between each old category feature set and the new category feature set is solved. Each old category feature set contains old category sample features extracted from all category samples of that category. The new category feature set contains new category sample features extracted from all category samples of that category.
[0025] The first aspect of the present invention provides an incremental learning method for human activity recognition. In one possible implementation, the multi-kernel Gaussian kernel function is an adaptive bandwidth multi-kernel Gaussian kernel function. For each mapping between the old category feature set and the new category feature set, the bandwidth parameter of the multi-kernel Gaussian kernel function is generated accordingly based on the median Euclidean distance between the feature pairs in the old category feature set and the new category feature set.
[0026] The above-described technical solution of the present invention provides a novel incremental learning method for human activity recognition, the beneficial effects of which include:
[0027] At the sample layer, a prototype anchor-based sample selection method is adopted. By calculating the class center prototype anchors of various motion modes and combining similarity to screen high-fidelity sensor data samples, core motion temporal patterns are retained. At the feature layer, a prototype contrastive learning driven by temporal data augmentation is adopted. By using temporal augmentation and structured contrastive loss that brings positive sample pairs closer and pushes negative sample pairs apart, the feature diversity under different wearing positions and motion intensities is reconstructed, and feature confusion between similar actions is reduced. At the distribution layer, a global distribution deentanglement mechanism guided by maximum mean difference distance (i.e., MMD distance) is adopted. Specifically, the multi-kernel maximum mean difference is used to measure the distribution overlap between new and old motion categories, and adaptive dynamic weights are used to penalize confused categories, thereby effectively balancing the stability and plasticity of the model in continuous data stream.
[0028] The present invention also provides an incremental learning system for human activity recognition, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the following steps of an incremental learning method for human activity recognition, including:
[0029] Based on the collected new category samples of human activity, extract the features of the new category samples; extract the features of each old category sample respectively; each category contains a set of non-overlapping category samples corresponding to the human activity category; the category samples contain the time series data corresponding to that category;
[0030] Based on the features of all old category samples for each old category, calculate the prototype anchor point for each category and select the old category sample with the highest similarity to the prototype anchor point in each category as the anchor point sample;
[0031] Anchor samples are augmented temporally to obtain augmented samples. Anchor samples and augmented samples of the same category are considered positive sample pairs, while anchor samples and augmented samples of different categories are considered negative sample pairs.
[0032] The recognition model is trained using a dynamic loss function to achieve incremental learning. The dynamic loss function includes an adaptive weighted loss term and a contrastive loss term. The adaptive weighted loss term is obtained by weighting the classification loss of the recognition model calculated for the new category sample features and each old category sample features according to the adaptive weights calculated by the distances between the new category sample features and each old category sample features. The contrastive loss term is used to bring positive sample pairs closer together and push negative sample pairs apart.
[0033] The second aspect of the present invention provides an incremental learning system for human activity recognition. In one possible implementation, the dynamic loss function further includes a basic classification loss term. The basic classification loss term is calculated based on the classification results obtained from the input of anchor samples of each old category and samples of the new category into the recognition model, along with the corresponding true category labels.
[0034] The second aspect of this invention provides an incremental learning system for human activity recognition. In one possible implementation, the adaptive weights are calculated from the distances between the features of the new category samples and the features of each old category sample, including:
[0035] Calculate the MMD distance between the features of the new category samples and each feature of the old category samples; adjust the calculated MMD distances for each group based on the activation function and sensitivity coefficient, and calculate the adaptive weights based on the adjusted MMD distances; adjust the sensitivity coefficients according to the dynamic loss function so that the calculated adaptive weights are smaller when the difference between the features of the new category samples and the features of the old category samples is large, and larger when the difference between the features of the new category samples and the features of the old category samples is small.
[0036] The second aspect of this invention provides an incremental learning system for human activity recognition. In one possible implementation, the method for calculating the classification loss of the recognition model for each new category and each old category includes:
[0037] For each new category and each old category, the classification loss is calculated based on the mini-batch sample set obtained from the old and new categories during the training of the recognition model, the true category label of each sample, the value of the true category label in the logit output of the recognition model for each sample, and the sum of the logit exponents of the old and new categories.
[0038] The second aspect of the present invention provides an incremental learning system for human activity recognition. In one possible implementation, the temporal enhancement of anchor samples includes strong enhancement and weak enhancement. Strong enhancement enhances anchor samples by combining fragment substitution and strong jitter to simulate significant temporal pattern changes so that the model learns the semantic invariance of local features. Weak enhancement enhances anchor samples by combining scaling and weak jitter to simulate sensor noise and subtle amplitude fluctuations.
[0039] The second aspect of this invention provides an incremental learning system for human activity recognition. In one possible implementation, the method of calculating the prototype anchor point for each category based on the features of all old category samples for each old category and selecting the old category sample with the highest similarity to the prototype anchor point in each category as the anchor point sample includes:
[0040] Calculate the arithmetic mean of the feature vectors of all old category samples for each old category. Based on the arithmetic mean calculated for each old category, obtain the prototype anchor point for each old category. Then, select the old category sample with the highest similarity to the prototype anchor point in each category and store them in the buffer as anchor point samples for each category.
[0041] The second aspect of this invention provides an incremental learning system for human activity recognition, in one possible implementation where the calculation of the contrast loss term includes:
[0042] The contrast loss term is calculated using the similarity between each anchor sample and its corresponding positive sample, the similarity between each anchor sample and other samples containing the corresponding positive and negative samples, the temperature scaling factor, the set of indices of all anchor samples, and the set of corresponding positive samples of all anchor samples, with temperature scaling normalized cross-entropy loss.
[0043] The second aspect of this invention provides an incremental learning system for human activity recognition. In one possible implementation, the calculation of the MMD distance between the features of the new category sample and the features of each old category sample includes:
[0044] By using a multi-kernel Gaussian kernel function, the features of each old category feature set and the new category feature set are mapped to the regenerated kernel Hilbert space.
[0045] By calculating the kernel matrix in blocks, and using the mapping results, the MMD distance between each old category feature set and the new category feature set is solved. Each old category feature set contains old category sample features extracted from all category samples of that category. The new category feature set contains new category sample features extracted from all category samples of that category.
[0046] The second aspect of the present invention provides an incremental learning system for human activity recognition. In one possible implementation, the multi-kernel Gaussian kernel function is an adaptive bandwidth multi-kernel Gaussian kernel function. For each mapping between the old category feature set and the new category feature set, the bandwidth parameter of the multi-kernel Gaussian kernel function is generated accordingly based on the median Euclidean distance between the feature pairs in the old category feature set and the new category feature set.
[0047] The technical solution of the incremental learning system for human activity recognition described above in this invention can achieve the same beneficial effects as the incremental learning method for human activity recognition described above. Attached Figure Description
[0048] Figure 1 This is a flowchart illustrating the incremental learning method for human activity recognition in an implementation of the present invention.
[0049] Figure 2 This is a schematic diagram illustrating the principle of the incremental learning method for human activity recognition in the implementation of the incremental learning method for human activity recognition according to the present invention.
[0050] Figure 3a This is an example diagram of the original data before temporal enhancement in the incremental learning method for human activity recognition according to the present invention;
[0051] Figure 3b This is an example diagram illustrating the effect of the original data after strong enhancement and fragment replacement in the incremental learning method for human activity recognition according to the present invention.
[0052] Figure 3c This is an example diagram illustrating the effect of strong jitter on the original data after strong enhancement in the incremental learning method for human activity recognition according to the present invention.
[0053] Figure 3d This is an example diagram showing the effect of scaling the original data after weak enhancement in the incremental learning method implementation of the present invention for human activity recognition;
[0054] Figure 4a This is an example diagram illustrating data characteristics where there are significant differences in temporal signal patterns among different samples within the same category in an incremental learning method for human activity recognition according to the present invention.
[0055] Figure 4b This diagram illustrates data characteristics where signal patterns are highly similar between different categories in the incremental learning method for human activity recognition, as described in this invention. Detailed Implementation
[0056] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments.
[0057] Implementation of Incremental Learning Methods Applied to Human Activity Recognition
[0058] This embodiment presents a technical solution for an incremental learning method applied to human activity recognition. It proposes a three-level collaborative optimization framework, which significantly improves the stability and recognition accuracy of the human activity recognition model during the continuous learning process through stepwise optimization and collaborative training of the sample layer, feature layer and distribution layer.
[0059] Reference Figure 1 The method specifically includes:
[0060] Based on the collected new category samples of human activity, extract the features of the new category samples; extract the features of each old category sample respectively; each category contains a set of non-overlapping category samples corresponding to the human activity category; the category samples contain the time series data corresponding to that category;
[0061] Based on the features of all old category samples for each old category, calculate the prototype anchor point for each category and select the old category sample with the highest similarity to the prototype anchor point in each category as the anchor point sample;
[0062] Anchor samples are augmented temporally to obtain augmented samples. Anchor samples and augmented samples of the same category are considered positive sample pairs, while anchor samples and augmented samples of different categories are considered negative sample pairs.
[0063] The recognition model is trained using a dynamic loss function to achieve incremental learning. The dynamic loss function includes an adaptive weighted loss term and a contrastive loss term. The adaptive weighted loss term is obtained by weighting the classification loss of the recognition model calculated for the new category sample features and each old category sample features according to the adaptive weights calculated by the distances between the new category sample features and each old category sample features. The contrastive loss term is used to bring positive sample pairs closer together and push negative sample pairs apart.
[0064] At the sample layer, this method employs a prototype anchor-based sample selection approach. By calculating the class center prototype anchors for various motion modes and combining similarity to filter high-fidelity sensor data samples, it retains core motion temporal patterns. At the feature layer, it uses prototype contrastive learning driven by temporal data augmentation. By utilizing temporal augmentation and a structured contrastive loss that brings positive sample pairs closer and pushes negative sample pairs apart, it reconstructs feature diversity under different wearing positions and motion intensities, and reduces feature confusion between similar actions. At the distribution layer, it adopts a global distribution deentanglement mechanism guided by maximum mean difference distance (MMD distance). Specifically, it uses multi-kernel maximum mean difference to measure the distribution overlap between new and old motion categories, and combines adaptive dynamic weights to penalize confused categories, thereby effectively balancing the stability and plasticity of the model in continuous data streams.
[0065] Reference Figure 2 The method of calculating the prototype anchor point for each category based on the features of all old category samples for each old category and selecting the old category sample with the highest similarity to the prototype anchor point in each category as the anchor point sample includes:
[0066] Calculate the arithmetic mean of the feature vectors of all old category samples for each old category. Based on the arithmetic mean calculated for each old category, obtain the prototype anchor point for each old category. Then, select the old category sample with the highest similarity to the prototype anchor point in each category and store them in the buffer as anchor point samples for each category.
[0067] In one specific embodiment, the feature prototype anchor point for each old category is first calculated, which is the arithmetic mean of the feature vectors of the category samples. :
[0068]
[0069] In the formula, This represents a feature extractor used to obtain feature vectors for class samples. Let be the set of all old category samples belonging to old category c. This represents the category samples within the set.
[0070] In this embodiment, the similarity between the old category samples and the prototype anchor points is selected using cosine similarity, which can be expressed as:
[0071]
[0072] Represents category samples The cosine similarity is calculated between the candidate sample (i.e., all old category samples in the category) and the prototype anchor of its category. Based on the obtained similarity value, the samples in the set of old category samples are sorted in descending order. The high-fidelity sample that is closest to the prototype center is selected first as the knowledge anchor (i.e., anchor sample) and stored in the buffer for later use.
[0073] In this embodiment, the temporal enhancement of the anchor samples includes strong enhancement and weak enhancement. Strong enhancement enhances the anchor samples by combining fragment replacement and strong jitter to simulate significant temporal pattern changes so that the model can learn the semantic invariance of local features. Weak enhancement enhances the anchor samples by combining scaling and weak jitter to simulate sensor noise and subtle amplitude fluctuations.
[0074] In one embodiment, strong and weak enhancements are applied to anchor samples in the buffer to generate enhanced samples for multiple views, simulating the temporal variations and noise interference prevalent in the original data, thereby reconstructing the lost diversity at the feature level. (Original data reference) Figure 3a Strongly enhanced binding fragment replacement (e.g.) Figure 3b (as shown) and strong jitter (e.g.) Figure 3c As shown in the figure, it is used to simulate significant temporal pattern changes, forcing the model to learn the semantic invariance of local features; weak enhancement combined with scaling (e.g. Figure 3d (as shown in the figure) and weak jitter are used to simulate sensor noise and subtle amplitude fluctuations; through the above enhancements, a set of semantically consistent enhanced views (i.e. enhanced samples) are generated around each anchor point, thereby enriching the feature space coverage.
[0075] Furthermore, at the feature layer, the contrast loss term is calculated by using the similarity between each anchor sample and its corresponding positive sample, the similarity between each anchor sample and other samples containing the corresponding positive and negative samples, the temperature scaling factor, the index set of all anchor samples, and the set of corresponding positive samples of all anchor samples, and then applying the temperature-scaled normalized cross-entropy loss to obtain the contrast loss term.
[0076] like Figure 2 As shown, this design, in constructing the structured contrastive learning objective, strengthens semantic invariance by defining anchor points and their augmented samples as positive sample pairs, bringing them closer together; and by defining anchor points and their augmented versions of different classes as negative sample pairs, pushing them apart. Specifically, the original anchor points and their augmented samples are projected into the latent space through a shared encoder to obtain feature representation vectors in the latent space. Within the feature space, anchor points and their augmented samples are defined as positive sample pairs, bringing them closer together to strengthen semantic invariance; negative sample pairs are defined as those constructed between anchor points and their augmented versions of different classes, pushing them apart to expand the inter-class decision boundaries.
[0077] In one specific embodiment, the similarity of samples is measured using the cosine similarity between sample features, which is used to calculate the temperature-scaled normalized cross-entropy loss L of the contrastive loss term. B Example as follows:
[0078]
[0079] In the formula, This represents the set of sample indices for all anchor samples in the buffer. This represents the set of positive samples corresponding to anchor sample i. Represents cosine similarity. This represents the temperature scaling factor. Where, The sample features representing anchor sample i and the corresponding positive sample features Cosine similarity between them; The sample features representing anchor sample i Sample features of any sample (including positive and negative samples) in the buffer. The cosine similarity between them. It can be seen that the contrast loss term L... B In the formula, the denominator includes all positive and negative samples. The larger the denominator, the more similar the negative samples are, and the greater the loss. This forces the recognition model to reduce the similarity of negative samples, thereby bringing positive sample pairs closer together and pushing negative sample pairs further apart.
[0080] In this embodiment, only the contrast loss term L is calculated. B Positive and negative sample pairs containing augmented samples were used; when calculating other loss terms, augmented samples were irrelevant, and the definitions of augmented samples and positive and negative sample pairs only applied to the contrast loss term L. B Effective.
[0081] To further differentiate between highly similar categories, the above-mentioned method of calculating adaptive weights based on the distances between the features of the new category samples and the features of each old category samples includes:
[0082] Calculate the MMD distance between the features of the new class samples and each feature of the old class samples; adjust the calculated MMD distances for each group based on the activation function and sensitivity coefficient, and calculate adaptive weights based on the adjusted MMD distances; adjust the sensitivity coefficient according to the dynamic loss function to ensure that the calculated adaptive weights are optimal when there is a large difference between the features of the new class samples and the features of the old class samples. When the differences between the features of new category samples and the features of old category samples are small, the calculated adaptive weights are relatively small. The weights are relatively large. By using such dynamically changing adaptive weights to adjust the loss function, the model can impose stronger discriminative constraints on highly similar class pairs, optimize the decision boundary, and reduce the confusion rate; specifically, it applies high-weight separation constraints to easily confused old and new class pairs, and low-weights to class pairs that are far apart. This explicitly decouples overlapping distributions and clarifies the decision boundary.
[0083] Furthermore, the calculation methods for the MMD distance between the new category sample features and each old category sample feature include:
[0084] By using a multi-kernel Gaussian kernel function, the features of each old category feature set and the new category feature set are mapped to the regenerated kernel Hilbert space.
[0085] By calculating the kernel matrix in blocks, and using the mapping results, the MMD distance between each old category feature set and the new category feature set is solved. Each old category feature set contains old category sample features extracted from all category samples of that category. The new category feature set contains new category sample features extracted from all category samples of that category.
[0086] In other implementations, other existing kernel functions can also be used to calculate the MMD distance.
[0087] In this embodiment, to improve the modeling capability for non-Gaussian distributed time series features, the multi-kernel Gaussian kernel function is an adaptive bandwidth multi-kernel Gaussian kernel function. For each mapping between the old and new class feature sets, the bandwidth parameter of the multi-kernel Gaussian kernel function is generated accordingly based on the median Euclidean distance between feature pairs in the old and new class feature sets. In other embodiments, the bandwidth parameter of the multi-kernel Gaussian kernel function can also be determined in other ways.
[0088] In one specific embodiment, an adaptive bandwidth multi-kernel Gaussian kernel function is used. Map the features to the reproducing kernel Hilbert space:
[0089]
[0090] In the formula, the bandwidth parameter The algorithm adaptively generates features based on the median of the Euclidean distance between feature pairs (i.e., feature pairs formed by features from the old and new class feature sets) to improve the modeling ability for non-Gaussian distributed time series features. L represents the number of different bandwidths (kernels) in the multi-kernel Gaussian kernel function, i.e., the number of Gaussian kernels participating in the weighted average. Each kernel corresponds to a bandwidth parameter. ( ).
[0091] Based on this, implicit and efficient solution for each old category feature set is achieved through block computation of the kernel matrix. Separate and new category feature sets MMD distance between:
[0092]
[0093] in , These are the i-th features in the old category feature set and the new category feature set, respectively, extracted from category samples of the old and new categories; similarly, , These are the j-th features in the old category feature set and the new category feature set, respectively.
[0094] Adaptive weights are constructed based on the Sigmoid function (i.e., the activation function), and category-aware weights are designed to adaptively adjust the penalty intensity according to the MMD distance. Specifically, high-weight separation constraints are applied to easily confused new and old class pairs, while low-weight class pairs with greater distance are applied, thereby explicitly decoupling overlapping distributions and clarifying the decision boundary.
[0095]
[0096] The MMD distance between the old and new class pairs; For the new category and old categories The adaptive weights are calculated separately for the new category and each old category. For example, if there are 100 old categories, the adaptive weights for the new category and each old category are calculated separately, resulting in 100 sets.
[0097] and All hyperparameters are manually set, ranging from [0.1-1]; in this embodiment, the baseline weight... Set to 1.0, which corresponds to the minimum weight value of MMD. Set according to the model's convergence status; It is the sigmoid activation function; The Sigmoid sensitivity coefficient (i.e., the sensitivity factor) controls the weights ( The rate at which MMD changes with distance, i.e., the steepness of the change with MMD. Wherein, If it is a monotonically increasing function of MMD (the larger MMD is, the closer the output is to 1), then That is, it becomes a monotonically decreasing function of MMD, so that the weights corresponding to MMD ( () decreases as MMD increases, and increases as MMD decreases. When the differences between categories are small, leading to easy category confusion, ( When the weight of a category is adjusted to a larger value, and the differences between categories are large enough to distinguish between them, ( The weights are adjusted to smaller values, thereby imposing stronger discriminative constraints on highly similar category pairs. This dynamic weight adjustment of the loss function further strengthens the discriminative constraints on highly similar category pairs, optimizes the decision boundary, and reduces the confusion rate.
[0098] In addition, the methods for calculating the classification loss of the recognition model for each new category and each old category include:
[0099] For each new category and each old category, the classification loss is calculated based on the mini-batch sample set obtained from the old and new categories during the training of the recognition model, the true category label of each sample, the value of the true category label in the logit output of the recognition model for each sample, and the sum of the logit exponents of the old and new categories.
[0100] In one specific embodiment, the classification loss of the recognition model for the new category and each old category is calculated as follows:
[0101]
[0102] in, For the new category and old categories The classification loss, i.e., the contrast loss term; To train the recognition model from the old categories and new categories The small batch of samples obtained by mid-sample; each sample Real category labels yes or ; For the model to sample The output logit corresponds to the real category The value; For old class With new categories The sum of the logit exponents.
[0103] Furthermore, in this embodiment, the dynamic loss function also includes a basic classification loss term; the basic classification loss term is calculated based on the classification results obtained from inputting anchor samples of each old category and samples of the new category into the recognition model, along with the corresponding true category labels. Setting such a basic classification loss term ensures the basic classification ability of the trained recognition model on all known categories.
[0104] In a complete specific embodiment, the overall process of the above-described incremental learning method for human activity recognition is exemplified as follows:
[0105] S1: Initialize the feature extractor and classifier, construct a memory buffer, receive continuous time-series data streams generated by human activities, and divide them into multiple non-overlapping learning tasks; such as Figure 4a As shown, different samples within the same category may exhibit significant differences in temporal signal patterns, reflecting the diverse characteristics of human activity time-series data; while... Figure 4b As shown, signal patterns can be highly similar across different categories, reflecting the inherent confounding characteristics of human activity time series data.
[0106] Specifically, the feature extractor and classifier are first initialized, and a fixed-capacity memory buffer is constructed. Then, a continuous stream of non-stationary sensor time-series data is received and divided into multiple non-overlapping learning tasks arriving in chronological order. Each task contains a set of mutually exclusive human activity categories, and each task, i.e., each category, contains a set of non-overlapping category samples corresponding to that human activity category. During each incremental learning iteration, all tasks with earlier chronological order belong to the old category; the task with the latest chronological order belongs to the new category.
[0107] S2: During the task transition phase, the prototype anchor strategy is executed. First, the feature prototype anchor of the old category is calculated and used as the semantic center. Then, the most representative Top-K samples are selected from the historical data and updated to the buffer in combination with cosine similarity to build a high-fidelity replay set.
[0108] In this step, the prototype anchor strategy first uses a feature extractor to calculate the prototype vector (i.e., prototype anchor) of the old category in the current feature space, which represents the semantic center of the category.
[0109] Subsequently, the cosine similarity between all candidate samples of the category (i.e., all old category samples in the category) and the prototype anchor of the category is calculated. The set of samples with the highest similarity is selected as the knowledge anchor, i.e., the anchor samples, and stored in the buffer for later use. These anchor samples can capture the core temporal patterns of the category to the greatest extent and build a high-fidelity representative buffer.
[0110] S3: Employ a local feature reconstruction strategy to perform semantically preserved data augmentation on samples in the buffer, and enhance the stability and discriminativeness of the feature extractor through a contrastive learning mechanism;
[0111] In this step, the local feature reconstruction strategy involves dual-strategy data augmentation and a structured contrastive loss function.
[0112] First, the dual-strategy data augmentation specifically involves applying strong and weak augmentations to anchor samples in the buffer to generate augmented samples with multiple views, simulating the temporal variations and noise interference that are widespread in the original data, thereby reconstructing the lost diversity at the feature level.
[0113] Building upon this, a structured contrastive learning objective (i.e., a contrastive loss term) is introduced to bring anchor points closer to their enhanced views in the feature space while simultaneously pushing anchor points of different categories further apart. This mechanism forces the model to learn semantically consistent and highly discriminative feature representations, effectively mitigating feature confusion. The objective function corresponding to the contrastive loss term is based on a high-fidelity semantic representation surrounding the anchor points, thus ensuring that the contrastive alignment is performed around the prototype features.
[0114] S4: Adopt a global distribution decoupling strategy, utilize the maximum mean difference of multi-core to measure the distribution overlap between the old and new categories, and apply a dynamic loss penalty term to separate the confused categories;
[0115] In this step, the global distribution decoupling strategy utilizes the multi-kernel maximum mean difference (MMD) to measure the distribution overlap between the old and new categories. Specifically, the global distribution decoupling strategy maps features to the regenerating kernel Hilbert space using an adaptive bandwidth multi-kernel Gaussian kernel function; based on this, it implicitly and efficiently solves for the MMD distance between each old category feature set and the new category feature set through block-based kernel matrix computation.
[0116] Next, adaptive weights are constructed based on the Sigmoid function, and category-aware weights (i.e., sensitivity coefficients) are designed to adaptively adjust the penalty intensity according to the MMD distance, thereby imposing stronger discriminative constraints on highly similar class pairs, optimizing the decision boundary and reducing the confusion rate.
[0117] S5: Combine contrastive loss and constrained classification loss to jointly train the model, and perform non-task-aware evaluation on a test set containing all learned categories.
[0118] This step specifically combines contrastive loss and constrained classification loss to jointly train the model. During the training of incremental tasks, a total objective function is constructed that includes cross-entropy classification loss, buffered contrastive loss, and adaptive weighted MMD loss. Backpropagation is used to collaboratively update the parameters of the feature extractor and classifier, thereby solidifying the feature structure and distribution boundaries of old knowledge while learning new knowledge. The jointly optimized total objective loss function is:
[0119]
[0120] The standard cross-entropy loss, i.e. the basic classification loss term, is calculated for all training samples (i.e., new data and buffer data, i.e., anchor samples of each old class and samples of the new class), ensuring the model's basic classification ability on all known classes; To balance the hyperparameters, the weights of the contrastive loss and the pairwise classification loss are controlled separately; This is the set of all category pairs that need to be considered, that is, all category pairs consisting of the new category and each of the old categories.
[0121] In summary, the incremental learning method for human activity recognition in this embodiment addresses the issues of limited device memory and data noise by employing a prototype anchoring strategy at the sample layer, enabling the construction of a high-fidelity buffer with minimal storage space. This directly reduces the algorithm's hardware storage resource requirements, making the method easily deployable and run on the edge of resource-constrained wearable devices.
[0122] To address the issue of decreased recognition rates caused by confusion between similar movement patterns, enhanced contrastive learning at the feature layer effectively reconstructs and strengthens the discriminative power of the features. This significantly improves the average accuracy of the recognition model when faced with similar activities such as walking and running, directly enhancing the activity recognition experience for end users.
[0123] To address the forgetting problem caused by conflicts between old and new knowledge during incremental updates, a distributed layer MMD-guided decoupling mechanism is used to explicitly manage category distribution. This ensures that the system maintains a high average recognition accuracy for old activities even after long-term learning of new activities, preserving model stability, and eliminating the need to retrain the entire model, thus saving computational costs.
[0124] The three-level optimization process described above achieves an optimal balance between model stability and adaptability under strict memory constraints. This method can be directly integrated into the firmware of devices such as smartwatches and fitness trackers, providing them with the ability to continuously learn new user movement patterns without uploading all data to the cloud. This protects user privacy while improving the response speed and reliability of localized intelligent services.
[0125] Implementation of Incremental Learning System for Human Activity Recognition
[0126] This embodiment provides a technical solution for an incremental learning system applied to human activity recognition, including a memory, a processor, and a computer program stored in the memory. The processor executes the computer program to implement the following steps of an incremental learning method applied to human activity recognition, including:
[0127] Based on the collected new category samples of human activity, extract the features of the new category samples; extract the features of each old category sample respectively; each category contains a set of non-overlapping category samples corresponding to the human activity category; the category samples contain the time series data corresponding to that category;
[0128] Based on the features of all old category samples for each old category, calculate the prototype anchor point for each category and select the old category sample with the highest similarity to the prototype anchor point in each category as the anchor point sample;
[0129] Anchor samples are augmented temporally to obtain augmented samples. Anchor samples and augmented samples of the same category are considered positive sample pairs, while anchor samples and augmented samples of different categories are considered negative sample pairs.
[0130] The recognition model is trained using a dynamic loss function to achieve incremental learning. The dynamic loss function includes an adaptive weighted loss term and a contrastive loss term. The adaptive weighted loss term is obtained by weighting the classification loss of the recognition model calculated for the new category sample features and each old category sample features according to the adaptive weights calculated by the distances between the new category sample features and each old category sample features. The contrastive loss term is used to bring positive sample pairs closer together and push negative sample pairs apart.
[0131] At the sample layer, this method employs a prototype anchor-based sample selection approach. By calculating the class center prototype anchors for various motion modes and combining similarity to filter high-fidelity sensor data samples, it retains core motion temporal patterns. At the feature layer, it uses prototype contrastive learning driven by temporal data augmentation. By utilizing temporal augmentation and a structured contrastive loss that brings positive sample pairs closer and pushes negative sample pairs apart, it reconstructs feature diversity under different wearing positions and motion intensities, and reduces feature confusion between similar actions. At the distribution layer, it adopts a global distribution deentanglement mechanism guided by maximum mean difference distance (MMD distance). Specifically, it uses multi-kernel maximum mean difference to measure the distribution overlap between new and old motion categories, and combines adaptive dynamic weights to penalize confused categories, thereby effectively balancing the stability and plasticity of the model in continuous data streams.
[0132] The method of calculating the prototype anchor point for each category based on the features of all old category samples and selecting the old category sample with the highest similarity to the prototype anchor point as the anchor point sample includes:
[0133] Calculate the arithmetic mean of the feature vectors of all old category samples for each old category. Based on the arithmetic mean calculated for each old category, obtain the prototype anchor point for each old category. Then, select the old category sample with the highest similarity to the prototype anchor point in each category and store them in the buffer as anchor point samples for each category.
[0134] In one specific embodiment, the feature prototype anchor point for each old category is first calculated, which is the arithmetic mean of the feature vectors of the category samples. :
[0135]
[0136] In the formula, This represents a feature extractor used to obtain feature vectors for class samples. Let be the set of all old category samples belonging to old category c. This represents the category samples within the set.
[0137] In this embodiment, the similarity between the old category samples and the prototype anchor points is selected using cosine similarity, which can be expressed as:
[0138]
[0139] Represents category samples The cosine similarity is calculated between the candidate sample (i.e., all old category samples in the category) and the prototype anchor of its category. Based on the obtained similarity value, the samples in the set of old category samples are sorted in descending order. The high-fidelity sample that is closest to the prototype center is selected first as the knowledge anchor (i.e., anchor sample) and stored in the buffer for later use.
[0140] In this embodiment, the temporal enhancement of the anchor samples includes strong enhancement and weak enhancement. Strong enhancement enhances the anchor samples by combining fragment replacement and strong jitter to simulate significant temporal pattern changes so that the model can learn the semantic invariance of local features. Weak enhancement enhances the anchor samples by combining scaling and weak jitter to simulate sensor noise and subtle amplitude fluctuations.
[0141] In one embodiment, strong and weak enhancements are applied to anchor point samples in the buffer to generate enhanced samples with multiple views, simulating the temporal variations and noise interference prevalent in the original data, thereby reconstructing the lost diversity at the feature level. Strong enhancement, combined with fragment permutation and strong jitter, is used to simulate significant temporal pattern changes, forcing the model to learn the semantic invariance of local features; weak enhancement, combined with scaling and weak jitter, is used to simulate sensor noise and subtle amplitude fluctuations. Through these enhancements, a set of semantically consistent enhanced views (i.e., enhanced samples) is generated around each anchor point, thereby enriching the feature space coverage.
[0142] Furthermore, at the feature layer, the contrast loss term is calculated by using the similarity between each anchor sample and its corresponding positive sample, the similarity between each anchor sample and other samples containing the corresponding positive and negative samples, the temperature scaling factor, the index set of all anchor samples, and the set of corresponding positive samples of all anchor samples, and then applying the temperature-scaled normalized cross-entropy loss to obtain the contrast loss term.
[0143] In constructing the structured contrastive learning objective, this design strengthens semantic invariance by defining anchor points and their augmented samples as positive sample pairs, bringing them closer together; and by defining anchor points and their augmented versions of different classes as negative sample pairs, pushing them apart. Specifically, the original anchor points and their augmented samples are projected into the latent space through a shared encoder to obtain feature representation vectors in the latent space. Within the feature space, anchor points and their augmented samples are defined as positive sample pairs, bringing them closer together to strengthen semantic invariance; negative sample pairs are defined as those constructed between anchor points and their augmented versions of different classes, pushing them apart to expand the inter-class decision boundaries.
[0144] In one specific embodiment, the similarity of samples is measured using the cosine similarity between sample features, which is used to calculate the temperature-scaled normalized cross-entropy loss L of the contrastive loss term. B Example as follows:
[0145]
[0146] In the formula, This represents the set of sample indices for all anchor samples in the buffer. This represents the set of positive samples corresponding to anchor sample i. Represents cosine similarity. This represents the temperature scaling factor. Where, The sample features representing anchor sample i and the corresponding positive sample features Cosine similarity between them; The sample features representing anchor sample i Sample features of any sample (including positive and negative samples) in the buffer. The cosine similarity between them. It can be seen that the contrast loss term L... B In the formula, the denominator includes all positive and negative samples. The larger the denominator, the more similar the negative samples are, and the greater the loss. This forces the recognition model to reduce the similarity of negative samples, thereby bringing positive sample pairs closer together and pushing negative sample pairs further apart.
[0147] In this embodiment, only the contrast loss term L is calculated. B Positive and negative sample pairs containing augmented samples were used; when calculating other loss terms, augmented samples were irrelevant, and the definitions of augmented samples and positive and negative sample pairs only applied to the contrast loss term L. B Effective.
[0148] To further differentiate between highly similar categories, the above-mentioned method of calculating adaptive weights based on the distances between the features of the new category samples and the features of each old category samples includes:
[0149] The MMD distance between the features of the new category and each feature of the old category is calculated. Each MMD distance is adjusted using an activation function and a sensitivity coefficient, and adaptive weights are calculated based on these adjusted MMD distances. The sensitivity coefficient is adjusted according to a dynamic loss function, so that the calculated adaptive weights are smaller when the differences between the features of the new and old categories are large, and larger when the differences are small. This dynamically changing adaptive weight adjustment of the loss function allows the model to impose stronger discriminative constraints on highly similar category pairs, optimizing the decision boundary and reducing the confusion rate. Specifically, high-weight separation constraints are applied to easily confused new and old category pairs, while low-weight separation constraints are applied to distant category pairs. This explicitly decouples overlapping distributions and clarifies the decision boundary.
[0150] Furthermore, the calculation methods for the MMD distance between the new category sample features and each old category sample feature include:
[0151] By using a multi-kernel Gaussian kernel function, the features of each old category feature set and the new category feature set are mapped to the regenerated kernel Hilbert space.
[0152] By calculating the kernel matrix in blocks, and using the mapping results, the MMD distance between each old category feature set and the new category feature set is solved. Each old category feature set contains old category sample features extracted from all category samples of that category. The new category feature set contains new category sample features extracted from all category samples of that category.
[0153] In other implementations, other existing kernel functions can also be used to calculate the MMD distance.
[0154] In this embodiment, to improve the modeling capability for non-Gaussian distributed time series features, the multi-kernel Gaussian kernel function is an adaptive bandwidth multi-kernel Gaussian kernel function. For each mapping between the old and new class feature sets, the bandwidth parameter of the multi-kernel Gaussian kernel function is generated accordingly based on the median Euclidean distance between feature pairs in the old and new class feature sets. In other embodiments, the bandwidth parameter of the multi-kernel Gaussian kernel function can also be determined in other ways.
[0155] In one specific embodiment, an adaptive bandwidth multi-kernel Gaussian kernel function is used. Map the features to the reproducing kernel Hilbert space:
[0156]
[0157] In the formula, the bandwidth parameter The algorithm adaptively generates features based on the median of the Euclidean distance between feature pairs (i.e., feature pairs formed by features from the old and new class feature sets) to improve the modeling ability for non-Gaussian distributed time series features. L represents the number of different bandwidths (kernels) in the multi-kernel Gaussian kernel function, i.e., the number of Gaussian kernels participating in the weighted average. Each kernel corresponds to a bandwidth parameter. ( ).
[0158] Based on this, implicit and efficient solution for each old category feature set is achieved through block computation of the kernel matrix. Separate and new category feature sets MMD distance between:
[0159]
[0160] in , These are the i-th features in the old category feature set and the new category feature set, respectively, extracted from category samples of the old and new categories; similarly, , These are the j-th features in the old category feature set and the new category feature set, respectively.
[0161] Adaptive weights are constructed based on the Sigmoid function (i.e., the activation function). The design incorporates category-aware weights, adaptively adjusting the penalty intensity based on the MMD distance. Specifically, it applies high-weight separation constraints to easily confused old and new category pairs, and low-weights to distant category pairs, thereby explicitly decoupling overlapping distributions and clarifying the decision boundary.
[0162]
[0163] The MMD distance between the old and new class pairs; For the new category and old categories The adaptive weights are calculated separately for the new category and each old category. For example, if there are 100 old categories, the adaptive weights for the new category and each old category are calculated separately, resulting in 100 sets.
[0164] and All hyperparameters are manually set, ranging from [0.1-1]; in this embodiment, the baseline weight... Set to 1.0, which corresponds to the minimum weight value of MMD. Set according to the model's convergence status; It is the sigmoid activation function; The Sigmoid sensitivity coefficient (i.e., the sensitivity factor) controls the weights ( The rate at which MMD changes with distance, i.e., the steepness of the change with MMD. Wherein, If it is a monotonically increasing function of MMD (the larger MMD is, the closer the output is to 1), then That is, it becomes a monotonically decreasing function of MMD, so that the weights corresponding to MMD ( () decreases as MMD increases, and increases as MMD decreases. When the differences between categories are small, leading to easy category confusion, ( When the weight of a category is adjusted to a larger value, and the differences between categories are large enough to distinguish between them, ( The weights are adjusted to smaller values, thereby imposing stronger discriminative constraints on highly similar category pairs. This dynamic weight adjustment of the loss function further strengthens the discriminative constraints on highly similar category pairs, optimizes the decision boundary, and reduces the confusion rate.
[0165] In addition, the methods for calculating the classification loss of the recognition model for each new category and each old category include:
[0166] For each new category and each old category, the classification loss is calculated based on the mini-batch sample set obtained from the old and new categories during the training of the recognition model, the true category label of each sample, the value of the true category label in the logit output of the recognition model for each sample, and the sum of the logit exponents of the old and new categories.
[0167] In one specific embodiment, the classification loss of the recognition model for the new category and each old category is calculated as follows:
[0168]
[0169] in, For the new category and old categories The classification loss, i.e., the contrast loss term; To train the recognition model from the old categories and new categories The small batch of samples obtained by mid-sample; each sample Real category labels yes or ; For the model to sample The output logit corresponds to the real category The value; For old class With new categories The sum of the logit exponents.
[0170] Furthermore, in this embodiment, the dynamic loss function also includes a basic classification loss term; the basic classification loss term is calculated based on the classification results obtained from inputting anchor samples of each old category and samples of the new category into the recognition model, along with the corresponding true category labels. Setting such a basic classification loss term ensures the basic classification ability of the trained recognition model on all known categories.
[0171] In a complete specific embodiment, the overall process of the above-described incremental learning method for human activity recognition is exemplified as follows:
[0172] S1: Initialize the feature extractor and classifier, build a memory buffer, receive continuous time series data streams, and divide them into multiple non-overlapping learning tasks;
[0173] Specifically, the feature extractor and classifier are first initialized, and a fixed-capacity memory buffer is constructed. Then, a continuous stream of non-stationary sensor time-series data is received and divided into multiple non-overlapping learning tasks arriving in chronological order. Each task contains a set of mutually exclusive human activity categories, and each task, i.e., each category, contains a set of non-overlapping category samples corresponding to that human activity category. During each incremental learning iteration, all tasks with earlier chronological order belong to the old category; the task with the latest chronological order belongs to the new category.
[0174] S2: During the task transition phase, the prototype anchor strategy is executed. First, the feature prototype anchor of the old category is calculated and used as the semantic center. Then, the most representative Top-K samples are selected from the historical data and updated to the buffer in combination with cosine similarity to build a high-fidelity replay set.
[0175] In this step, the prototype anchor strategy first uses a feature extractor to calculate the prototype vector (i.e., prototype anchor) of the old category in the current feature space, which represents the semantic center of the category.
[0176] Subsequently, the cosine similarity between all candidate samples of the category (i.e., all old category samples in the category) and the prototype anchor of the category is calculated. The set of samples with the highest similarity is selected as the knowledge anchor, i.e., the anchor samples, and stored in the buffer for later use. These anchor samples can capture the core temporal patterns of the category to the greatest extent and build a high-fidelity representative buffer.
[0177] S3: Employ a local feature reconstruction strategy to perform semantically preserved data augmentation on samples in the buffer, and enhance the stability and discriminativeness of the feature extractor through a contrastive learning mechanism;
[0178] In this step, the local feature reconstruction strategy involves dual-strategy data augmentation and a structured contrastive loss function.
[0179] First, the dual-strategy data augmentation specifically involves applying strong and weak augmentations to anchor samples in the buffer to generate augmented samples with multiple views, simulating the temporal variations and noise interference that are widespread in the original data, thereby reconstructing the lost diversity at the feature level.
[0180] Building upon this, a structured contrastive learning objective (i.e., a contrastive loss term) is introduced to bring anchor points closer to their enhanced views in the feature space while simultaneously pushing anchor points of different categories further apart. This mechanism forces the model to learn semantically consistent and highly discriminative feature representations, effectively mitigating feature confusion. The objective function corresponding to the contrastive loss term is based on a high-fidelity semantic representation surrounding the anchor points, thus ensuring that the contrastive alignment is performed around the prototype features.
[0181] S4: Adopt a global distribution decoupling strategy, utilize the maximum mean difference of multi-core to measure the distribution overlap between the old and new categories, and apply a dynamic loss penalty term to separate the confused categories;
[0182] In this step, the global distribution decoupling strategy utilizes the multi-kernel maximum mean difference (MMD) to measure the distribution overlap between the old and new categories. Specifically, the global distribution decoupling strategy maps features to the regenerating kernel Hilbert space using an adaptive bandwidth multi-kernel Gaussian kernel function; based on this, it implicitly and efficiently solves for the MMD distance between each old category feature set and the new category feature set through block-based kernel matrix computation.
[0183] Next, adaptive weights are constructed based on the Sigmoid function, and category-aware weights (i.e., sensitivity coefficients) are designed to adaptively adjust the penalty intensity according to the MMD distance, thereby imposing stronger discriminative constraints on highly similar class pairs, optimizing the decision boundary and reducing the confusion rate.
[0184] S5: Jointly train the model using contrastive loss and constrained classification loss, and perform non-task-aware evaluation on a test set containing all learned categories. Specifically, this step combines contrastive loss and constrained classification loss for joint training. During incremental task training, a total objective function is constructed that includes cross-entropy classification loss, buffered contrastive loss, and adaptive weighted MMD loss. Backpropagation is used to collaboratively update the parameters of the feature extractor and classifier, thereby solidifying the feature structure and distribution boundaries of old knowledge while learning new knowledge. The jointly optimized total objective loss function is:
[0185]
[0186] The standard cross-entropy loss, i.e. the basic classification loss term, is calculated for all training samples (i.e., new data and buffer data, i.e., anchor samples of each old class and samples of the new class), ensuring the model's basic classification ability on all known classes; To balance the hyperparameters, the weights of the contrastive loss and the pairwise classification loss are controlled separately; This is the set of all category pairs that need to be considered, that is, all category pairs consisting of the new category and each of the old categories.
[0187] In summary, the incremental learning method for human activity recognition in this embodiment addresses the issues of limited device memory and data noise by employing a prototype anchoring strategy at the sample layer, enabling the construction of a high-fidelity buffer with minimal storage space. This directly reduces the algorithm's hardware storage resource requirements, making the method easily deployable and run on the edge of resource-constrained wearable devices.
[0188] To address the issue of decreased recognition rates caused by confusion between similar movement patterns, enhanced contrastive learning at the feature layer effectively reconstructs and strengthens the discriminative power of the features. This significantly improves the average accuracy of the recognition model when faced with similar activities such as walking and running, directly enhancing the activity recognition experience for end users.
[0189] To address the forgetting problem caused by conflicts between old and new knowledge during incremental updates, a distributed layer MMD-guided decoupling mechanism is used to explicitly manage category distribution. This ensures that the system maintains a high average recognition accuracy for old activities even after long-term learning of new activities, preserving model stability, and eliminating the need to retrain the entire model, thus saving computational costs.
[0190] The three-level optimization process described above achieves an optimal balance between model stability and adaptability under strict memory constraints. This method can be directly integrated into the firmware of devices such as smartwatches and fitness trackers, providing them with the ability to continuously learn new user movement patterns without uploading all data to the cloud. This protects user privacy while improving the response speed and reliability of localized intelligent services.
[0191] It should be understood that the above-described specific embodiments of the present invention are merely illustrative or explanatory of the principles of the present invention, and do not constitute a limitation thereof.
Claims
1. An incremental learning method for human activity recognition, characterized in that, include: Based on the collected category samples of new human activities, extract the features of the new category samples; Extract features from each old category sample; each category contains a set of non-overlapping category samples corresponding to the human activity category; each category sample contains the time series data corresponding to that category; Based on the features of all old category samples for each old category, calculate the prototype anchor point for each category and select the old category sample with the highest similarity to the prototype anchor point in each category as the anchor point sample; Anchor samples are augmented temporally to obtain augmented samples. Anchor samples and augmented samples of the same category are considered positive sample pairs, while anchor samples and augmented samples of different categories are considered negative sample pairs. The recognition model is trained using a dynamic loss function to achieve incremental learning. The dynamic loss function includes an adaptive weighted loss term and a contrastive loss term. The adaptive weighted loss term is obtained by weighting the classification loss of the recognition model calculated for the new category sample features and each old category sample features according to the adaptive weights calculated by the distances between the new category sample features and each old category sample features. The contrastive loss term is used to bring positive sample pairs closer together and push negative sample pairs apart.
2. The incremental learning method for human activity recognition according to claim 1, characterized in that, The dynamic loss function also includes a basic classification loss term; the basic classification loss term is calculated based on the classification results obtained from the recognition model by inputting anchor samples of each old category and samples of the new category, along with the corresponding true category labels.
3. The incremental learning method for human activity recognition according to claim 1 or 2, characterized in that, The methods for calculating adaptive weights from the distances between the features of the new category samples and the features of each old category sample include: Calculate the MMD distance between the features of the new category samples and each feature of the old category samples; adjust the calculated MMD distances for each group based on the activation function and sensitivity coefficient, and calculate the adaptive weights based on the adjusted MMD distances; adjust the sensitivity coefficients according to the dynamic loss function so that the calculated adaptive weights are smaller when the difference between the features of the new category samples and the features of the old category samples is large, and larger when the difference between the features of the new category samples and the features of the old category samples is small.
4. The incremental learning method for human activity recognition according to claim 1 or 2, characterized in that, The methods for calculating the classification loss of the recognition model for each new category and each old category include: For each new category and each old category, the classification loss is calculated based on the mini-batch sample set obtained from the old and new categories during the training of the recognition model, the true category label of each sample, the value of the true category label in the logit output of the recognition model for each sample, and the sum of the logit exponents of the old and new categories.
5. The incremental learning method for human activity recognition according to claim 1 or 2, characterized in that, Temporal augmentation of anchor samples includes strong augmentation and weak augmentation; strong augmentation enhances anchor samples by combining fragment substitution and strong jitter to simulate significant temporal pattern changes so that the model can learn the semantic invariance of local features; weak augmentation enhances anchor samples by combining scaling and weak jitter to simulate sensor noise and subtle amplitude fluctuations.
6. The incremental learning method for human activity recognition according to claim 1 or 2, characterized in that, The method of calculating the prototype anchor point for each category based on the features of all old category samples and selecting the old category sample with the highest similarity to the prototype anchor point as the anchor point sample includes: Calculate the arithmetic mean of the feature vectors of all old category samples for each old category. Based on the arithmetic mean calculated for each old category, obtain the prototype anchor point for each old category. Then, select the old category sample with the highest similarity to the prototype anchor point in each category and store them in the buffer as anchor point samples for each category.
7. The incremental learning method for human activity recognition according to claim 1 or 2, characterized in that, The methods for calculating the comparative loss term include: The contrast loss term is calculated using the similarity between each anchor sample and its corresponding positive sample, the similarity between each anchor sample and other samples containing the corresponding positive and negative samples, the temperature scaling factor, the set of indices of all anchor samples, and the set of corresponding positive samples of all anchor samples, with temperature scaling normalized cross-entropy loss.
8. The incremental learning method for human activity recognition according to claim 3, characterized in that, The calculation methods for the MMD distance between the features of the new category and each feature of the old category include: By using a multi-kernel Gaussian kernel function, the features of each old category feature set and the new category feature set are mapped to the regenerated kernel Hilbert space. By calculating the kernel matrix in blocks, and using the mapping results, the MMD distance between each old category feature set and the new category feature set is solved. Each old category feature set contains old category sample features extracted from all category samples of that category. The new category feature set contains new category sample features extracted from all category samples of that category.
9. The incremental learning method for human activity recognition according to claim 8, characterized in that, The multi-kernel Gaussian kernel function is an adaptive bandwidth multi-kernel Gaussian kernel function. For each mapping between the old and new class feature sets, the bandwidth parameter of the multi-kernel Gaussian kernel function is generated according to the median Euclidean distance between the feature pairs in the old and new class feature sets.
10. An incremental learning system for human activity recognition, comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the steps of the incremental learning method for human activity recognition as described in any one of claims 1-9.
Citation Information
Patent Citations
Human behavior recognition method and system based on multi-mode deep Boltzmann machine
CN107886061A