Indoor Human Activity Recognition Method Based on WiFi and Cross-Adversarial Training
Patent Information
- Application Number
- CN202410393879.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-02
- Publication Date
- 2026-09-18
- Estimated Expiration
- 2044-04-02
AI Technical Summary
然而,传统的对抗训练会带来两个问题:处理速度慢和模型准确率低
将本发明中交叉对抗训练方法(CAT)训练得到的EI框架与原始EI框架(ORI)、传统对抗训练方法(SAT)训练得到的EI框架进行对比,在三种领域适应情况下,比较了三个EI框架的测试准确率和对抗鲁棒性。将目标域数据集随机分成验证集(20%)和测试集(80%)。测试准确率表示模型在测试集上的表现,其中模型权重通过验证集获得。对抗鲁棒性指的是模型在对抗样本上的准确率。本发明选择一系列ε值,ε∈{-1/15,-1/20,-1/30,-1/50,-1/100,-1/300,-1/600,-1/1000,-1/2500,-1/5000,-1/8000,0,1/9000,1/8000,1/5000,1/2500,1/1000,1/600,1/300,1/100,1/50,1/30,1/15},并依次应用这些参数值攻击测试集,生成对抗样本集。然后,使用通过验证集获得的模型权重来评估模型在这些对抗样本上的准确率。
Smart Images

Figure CN118312776B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of human activity recognition technology, and more specifically to an indoor human activity recognition method based on WiFi and cross-adversarial training. Background Technology
[0002] In recent years, Human Activity Recognition (HAR) has attracted much attention, with wide applications in smart homes, medical monitoring, virtual reality, and other fields. Traditional HAR research mainly falls into two categories: computer vision-based methods and mobile device-based methods. The former uses cameras to capture images or videos to analyze human behavior, which may lead to user privacy issues. The latter requires users to wear mobile smart devices (such as smartwatches and smartphones), placing an additional burden on them. Therefore, wireless HAR, especially HAR based on the most common wireless signal—WiFi (Wireless Fidelity), has become a popular research topic.
[0003] The workflow of a commonly used WiFi-based human activity recognition (HAR) model is as follows: Figure 1 As shown. Figure 1 In this system, a WiFi signal field is created between the WiFi transmitter and receiver. Based on the Doppler effect, human behavior influences the WiFi signal, and the Channel State Information (CSI) received by the receiver carries implicit human behavioral characteristics. The data processor preprocesses the CSI, performing Short Time Fourier Transform (STFT) and Principal Component Analysis (PCA) to derive spectral data of human activity from the CSI. This spectral data is then input into a WiFi-based human activity recognition model, outputting the human activity recognition result, i.e., the specific category of the human activity. The Environment Independent (EI) framework is currently the mainstream WiFi-based human activity recognition model. The EI framework employs unsupervised domain adaptation technology, extracting shared features across environments through a mini-maximum game between the activity recognizer and the domain discriminator.
[0004] Despite the promising performance of WiFi-based human activity recognition models, several issues remain. First, these models lack robustness and perform poorly against malicious attacks; even slight perturbations can lead to drastically different outputs (see: Vulnerability of WiFi-based Human Activity Recognition Systems, later). Therefore, exploring robust defenses against traditional adversarial attacks is crucial for WiFi-based human activity recognition models. Second, the effectiveness of Standard Adversarial Training (SAT) methods is limited. While SAT is a fundamental method for defending against adversarial attacks, recent research has extensively examined its impact on model accuracy and robustness. In computer vision, SAT is generally considered to impair accuracy on clean images in supervised learning environments. However, recent computer vision research has shown that adversarial features can benefit model recognition. In robot learning, SAT may induce undesirable behaviors. In natural language processing, however, SAT has been shown to improve model performance. To explore the effectiveness of traditional adversarial training in WiFi-based human activity recognition, this invention applies traditional adversarial training to the EI framework. The results show that traditional adversarial training is ineffective, reduces the stability of the EI framework, and decreases the accuracy of the model (see: Limitations of Existing Traditional Adversarial Training Methods below).
[0005] 1. Vulnerabilities of WiFi-based human activity recognition systems: While typical WiFi-based human activity recognition models (i.e., the EI framework) can achieve relatively high model accuracy, they perform poorly against traditional white-box attacks, such as the Fast Gradient Sign Method (FGSM). In such attacks, the attacker knows the model's structure and parameters, obtains test data from the target domain, and generates adversarial examples that cause the model to make incorrect predictions. This invention employs the fast gradient sign method to attack the EI framework. During the attack, a series of attack parameters ε are used, ε∈{-1 / 15, -1 / 20, -1 / 30, -1 / 50, -1 / 100, -1 / 300, -1 / 600, -1 / 1000, -1 / 2500, -1 / 5000, -1 / 8000, 0, 1 / 9000, 1 / 8000, 1 / 5000, 1 / 2500, 1 / 1000, 1 / 600, 1 / 300, 1 / 100, 1 / 50, 1 / 30, 1 / 15}. Here, ε=0 indicates that the model has not been attacked, and the corresponding accuracy is the original accuracy of the model. Figure 2This paper demonstrates the impact of fast gradient symbolic attacks on the EI framework under the E2 (source domain) to E1 (target domain) domain adaptation condition, including the impact on the original EI framework (denoted as ORI), the EI framework obtained by traditional adversarial training (denoted as SATs, SAT+, SATt), and the EI framework obtained by the Cross-Adversarial Training (CAT) method of this invention (denoted as CATs, CATt). Specifically, during the training process of the WiFi-based human activity recognition model, SATs attacks the source domain (ε∈[-1 / 15,1 / 15]), SAT+ attacks the source domain (ε∈[0,1 / 15]), SATt attacks the target domain (ε∈[-1 / 15,1 / 15]), CATs alternately attacks the source domain (ε∈[-1 / 15,1 / 15]), and CATt alternately attacks the target domain (ε∈[-1 / 15,1 / 15]). It can be observed that the accuracy of adversarial examples in the ORI curve is significantly lower than the initial accuracy of the model (71.45%). Specifically, when ε=1 / 15, the accuracy of adversarial examples drops to 39.87%. This indicates that the performance of the WiFi-based human activity recognition model deteriorates significantly under adversarial attacks. Therefore, the robustness and generalization ability of the WiFi-based human activity recognition model are poor, and the features extracted by the model are not representative enough. Worse still, the model can produce completely different prediction results due to slight data perturbations. This poses a serious threat to the WiFi-based human activity recognition model, as attackers may exploit this vulnerability to tamper with data, attack the model, and compromise the security of the entire system in actual deployment. Therefore, it is necessary to explore a method to enhance the robustness of the WiFi-based human activity recognition model.
[0006] 2. Limitations of existing traditional adversarial training methods: A simple approach to addressing the robustness vulnerabilities of WiFi-based human activity recognition models is traditional adversarial training (SAT). Existing techniques have demonstrated that SAT can produce robust deep learning models. In existing techniques, SAT is formulated as a mini-maximum optimization problem: finding a model that can correctly classify adversarial samples with perturbations δ within a certain range S, i.e.: ; in, These represent the original data and the corresponding labels, respectively. Indicates data distribution, Represents the loss function. This represents the model parameters. Traditional adversarial training enhances the interpretability of network gradients, emphasizing overall features rather than details. However, traditional adversarial training introduces two problems: slow processing speed and low model accuracy. The model's accuracy decreases for both normal and adversarial samples.
[0007] Traditional adversarial training typically uses fixed parameter values to generate adversarial examples. This invention applies the fast gradient sign method to the EI framework training process, alternately attacking source domain data to perform cross-adversarial training. For example... Figure 2 As shown, in source domain adversarial training, this invention considers both attack parameters ε∈[-1 / 15, 1 / 15] (SATs) and attack parameters ε∈[0, 1 / 15] (SAT+), performing adversarial attacks on each batch of source domain training data. The accuracy of SATs is 58.68%, while the accuracy of SAT+ is 47.27%, indicating that the uneven distribution of adversarial samples reduces the model's accuracy during source domain adversarial training. Simultaneously, cross-adversarial training uses attack parameters ε∈[-1 / 15, 1 / 15] to alternately attack each batch of source domain training data (CATs). The comparison between CAT and SAT shows that cross-attacking each batch of source domain training data improves the model's accuracy and robustness. In target domain adversarial training, SATt uses attack parameters ε∈[-1 / 15, 1 / 15], resulting in a slight decrease in model accuracy, but no significant improvement in robustness. CATt also uses attack parameters ε∈[-1 / 15, 1 / 15] and alternates between attacking the target domain training data in each batch. Compared to CATs, CATt does not show a stable improvement in model robustness, indicating that alternating attacks on the target domain data do not produce significant improvements.
[0008] This invention addresses three points: 1) First, traditional adversarial training uses only specific parameter values to generate adversarial examples, which may lead to two problems: a) The robustness of the model is limited by attacks where the parameter values are less than or equal to the parameter values used in adversarial training. b) Sample distribution bias reduces the model's accuracy. To address the first problem, this invention randomly selects parameter values within a specific range to generate adversarial examples, because it is difficult to accurately determine the attacker's attack parameters ε in real-world scenarios. To address the second problem, the parameter values selected in this invention should span the zero point of ε, thereby balancing the sample distribution and improving the model's accuracy. 2) Second, attacking a subset of the training data batch instead of all the data can accelerate adversarial training. Each attack generates adversarial examples, which consumes significant computational resources and time. Therefore, reducing the attack frequency can shorten the adversarial training time. 3) Finally, WiFi-based human activity recognition models primarily address domain adaptation issues; therefore, attacking source domain data helps in identifying target domain data. Summary of the Invention
[0009] To address the aforementioned technical problems, this invention provides an indoor human activity recognition method based on WiFi and cross-adversarial training.
[0010] To solve the above-mentioned technical problems, the present invention adopts the following technical solution: An indoor human activity recognition method based on WiFi and cross-adversarial training is disclosed. The method preprocesses channel state information collected in a WiFi signal field, inputs the obtained human activity spectrum data into a trained human activity recognition model, and obtains the human activity recognition result. The human activity recognition model is trained through cross-adversarial training, specifically including the following steps: Step 1: Construct a human activity recognition model: The collected channel state information is preprocessed to obtain human activity spectrum data; the annotated human activity spectrum data is used as the source domain data. Source domain data With corresponding human activity tags Unlabeled human activity spectrum data will be used as the target domain data. Source domain data and target domain data Collectively referred to as data samples The human activity recognition model adopts the EI framework; the EI framework includes a feature extractor, an activity recognizer, and a domain discriminator; the feature extractor is used to extract human activity features from human activity spectrum data; the human activity features are input into the activity recognizer, which is used to classify human activities to obtain human activity recognition results; the human activity features and human activity recognition results are input into the domain discriminator to output domain labels. Step two involves constructing adversarial examples and performing cross-adversarial training on the human activity recognition model, specifically including: For the i-th data sample ,Will As the number of loops Take values from 1 to N sequentially, and repeat the following operation: Based on the i-th source domain data The i-th source domain data Corresponding human activity tags The i-th target domain data and overall loss function The human activity recognition model is subjected to cross-adversarial training. During the cross-adversarial training process, source domain adversarial examples are generated alternately to update the model parameters of the human activity recognition model. The alternating generation of source domain adversarial samples refers to generating a source domain adversarial sample once every loop iteration in the following manner, and replacing the source domain data with the source domain adversarial sample during training: The range is the attack parameters Random assignment based on attack parameters The overall loss function of the human activity recognition model The i-th data sample is generated using either the fast sign gradient method or the gradient descent projection method. Adversarial examples Adversarial examples Including source domain adversarial examples Adversarial examples in the target domain Target domain adversarial examples are used to evaluate human activity recognition models. This represents the threshold at which adversarial examples can be distinguished by the human eye. This indicates the total number of data samples.
[0011] Furthermore, in step two, the i-th data sample is generated using the fast gradient sign method. Adversarial examples At that time, source domain adversarial examples for: ; in, Represents the gradient; Target domain adversarial examples for: .
[0012] Furthermore, in step two, the i-th data sample is generated using the gradient descent projection method. Adversarial examples Adversarial examples are generated through multiple iterations, where the source domain adversarial examples are... for: ; in, Let represent the source domain adversarial sample obtained in the (t+1)th iteration, and let the source domain adversarial sample obtained in the last iteration be taken as the final source domain adversarial sample. ; Represents the set of possible perturbations; Represents the gradient; Target domain adversarial examples for: ; This represents the target domain adversarial sample obtained in the (t+1)th iteration, and the target domain adversarial sample obtained in the last iteration is taken as the final target domain adversarial sample. .
[0013] Furthermore, in step two, based on the i-th source domain data... The i-th source domain data Corresponding human activity tags The i-th target domain data and overall loss function Cross-adversarial training is performed on the human activity recognition model to update its model parameters. Specifically, this includes: right Perform a traversal; if i is even, use adversarial examples from the source domain. The i-th target domain data and overall loss function Train the human activity recognition model and update its model parameters. : If i is odd, then use the i-th source domain data. The i-th target domain data and overall loss function Train the human activity recognition model and update its model parameters. : ; Indicates the learning rate; or: right Perform a traversal; if i is odd, use adversarial examples from the source domain. The i-th target domain data and overall loss function Train the human activity recognition model and update its model parameters. : If i is even, then use the i-th source domain data. The i-th target domain data and overall loss function Train the human activity recognition model and update its model parameters. : .
[0014] Furthermore, the overall loss function for: ; in, It is the loss of labeled data; This is the loss of unlabeled data; It is the loss between the domain label output by the domain discriminator and the real domain label. It is a balance constraint. It is a confidence level control constraint. It is a smoothing constraint. and These are weighted parameters. , and These are predefined hyperparameters.
[0015] Furthermore, in step one, when performing data preprocessing on the channel state information, the process includes performing short-time Fourier transform and principal component analysis on the channel state information.
[0016] Compared with the prior art, the beneficial technical effects of the present invention are: The EI framework trained using the cross-adversarial training method (CAT) in this invention is compared with the original EI framework (ORI) and the EI framework trained using the traditional adversarial training method (SAT). Under three domain adaptation conditions, the test accuracy and adversarial robustness of the three EI frameworks are compared. The target domain dataset is randomly divided into a validation set (20%) and a test set (80%). Test accuracy represents the model's performance on the test set, where the model weights are obtained from the validation set. Adversarial robustness refers to the model's accuracy on adversarial examples. This invention selects a series of ε values, ε∈{-1 / 15, -1 / 20, -1 / 30, -1 / 50, -1 / 100, -1 / 300, -1 / 600, -1 / 1000, -1 / 2500, -1 / 5000, -1 / 8000, 0, 1 / 9000, 1 / 8000, 1 / 5000, 1 / 2500, 1 / 1000, 1 / 600, 1 / 300, 1 / 100, 1 / 50, 1 / 30, 1 / 15}, and sequentially applies these parameter values to attack the test set, generating an adversarial example set. Then, the model weights obtained from the validation set are used to evaluate the model's accuracy on these adversarial examples.
[0017] 1. Test accuracy assessment: Figures 7a to 7c , Figures 8a to 8c , Figures 9a to 9cIn the diagram, ε=0 represents the original test dataset, where the data has not been subjected to adversarial attacks. The intersection of each curve with ε=0 corresponds to the model's test accuracy. ORI test accuracy is represented by a diamond, SAT-derived EI frame accuracy by a square, and CAT-derived EI frame accuracy by a triangle. Compared to ORI, SAT leads to a decrease in model test accuracy, while CAT leads to a moderate increase. This indicates that the CAT-derived EI frame outperforms both ORI and SAT-derived EI frames in terms of test accuracy. Averaging the experimental results, when using FGSM and PGD for adversarial training, the CAT-derived EI frame's test accuracy is on average 10.37% and 16.33% higher than the SAT-derived EI frame, respectively, while the SAT-derived EI frame's test accuracy is on average 6.37% and 12.53% lower than the original ORI model, respectively.
[0018] 2. Robustness assessment: like Figures 7a to 7c , Figures 8a to 8c , Figures 9a to 9c As shown, examining the curves within the positive ε range (ε>0), it was found that the EI framework obtained by SAT exhibits unstable and poor defensive performance, sometimes even falling below the ORI curve. In contrast, the EI framework obtained by CAT consistently outperforms both the ORI and SAT frameworks, indicating that the CAT-obtained EI framework demonstrates better model robustness against traditional adversarial attacks based on FGSM. Furthermore, observing the curves within the negative ε range (ε<0), it was noted that the CAT-obtained EI framework outperformed both the ORI and SAT frameworks in most cases, suggesting that the CAT-obtained EI framework exhibits better model robustness in most situations. Attached Figure Description
[0019] Figure 1 A flowchart illustrating the workflow of a WiFi-based human activity recognition model; Figure 2 The robustness effect of the adversarial training method for WiFi-based human activity recognition model is shown in the figure. Figure 3 A schematic diagram of the generated adversarial examples; Figure 4 This is a schematic diagram of the framework of the cross-adversarial training method of the present invention; Figure 5 A schematic diagram illustrating how the effectiveness of FGSM against attacks varies with ε; Figure 6 This is a mathematical simulation diagram of the cross-adversarial training method of the present invention; Figure 7a , Figure 7b and Figure 7cThis is a schematic diagram illustrating the accuracy assessment and adversarial robustness assessment; where, Figure 7a This indicates a domain adaptation from E2 to E1. Figure 7b This indicates domain adaptation from E3 to E6. Figure 7c The domain adaptation from E4 to E5 is represented by the adversarial attack method FGSM used for model robustness testing and model training (ε∈[-1 / 15,1 / 15]). E2, E3, and E4 are three source domain environments, and E1, E5, and E6 are three target domain environments. Specifically, E1, E2, E3, E4, E5, and E6 represent the lobby, corridor, conference room, laboratory, open platform, and building entrance, respectively. Figure 8a , Figure 8b and Figure 8c This is a schematic diagram illustrating the accuracy assessment and adversarial robustness assessment, where... Figure 8a This indicates a domain adaptation from E2 to E1. Figure 8b This indicates domain adaptation from E3 to E6. Figure 8c This represents the domain adaptation from E4 to E5. The adversarial attack method used for model robustness testing is PGD (iteration number t=1), and the adversarial attack method used in model training is PGD (t=1, ε∈[-1 / 9,1 / 9]). Figure 9a , Figure 9b and Figure 9c This is a schematic diagram illustrating the accuracy assessment and adversarial robustness assessment, where... Figure 9a This indicates a domain adaptation from E2 to E1. Figure 9b This indicates domain adaptation from E3 to E6. Figure 9c This represents the domain adaptation from E4 to E5. The adversarial attack method used for model robustness testing is PGD (t=3), and the adversarial attack method used in model training is PGD (t=1, ε∈[-1 / 9,1 / 9]). Detailed Implementation
[0020] A preferred embodiment of the present invention will now be described in detail with reference to the accompanying drawings.
[0021] First, it needs to be clarified that the source domain and target domain in this invention have specific technical meanings and are not abstract mathematical terms. In this invention, source domain data refers to labeled human activity spectrum data with corresponding human activity labels; target domain data refers to unlabeled human activity spectrum data, which, because it is not labeled, does not have human activity labels. This invention is applied to the field of human activity recognition, and the resulting human activity recognition model can solve a specific technical problem, namely, the problem that human activity recognition models perform poorly against malicious attacks in test or deployment environments.
[0022] To address the poor robustness of WiFi-based human activity recognition models and the limitations of existing traditional adversarial training methods, this invention proposes a Cross-Adversarial Training (CAT) method for WiFi-based human activity recognition models, based on a thorough analysis of WiFi-based human activity recognition models and adversarial training. This method aims to enhance the robustness and accuracy of WiFi-based human activity recognition models, thereby better meeting the performance and security requirements of WiFi-based human activity recognition.
[0023] The present invention will now be described in detail in several parts.
[0024] 1. The roles of the source and target domains: WiFi-based human activity recognition models primarily focus on addressing domain adaptation issues. The WiFi environment for human activity recognition can vary significantly, and the WiFi environment during training and testing is often inconsistent. Furthermore, human activity recognition models trained in a single domain contain environment-specific attributes, making it difficult to generalize to other domains. The EI framework utilizes labeled, raw source domain data. And unlabeled raw target domain data To maximize the domain loss of the domain discriminator, the feature extractor is forced to extract human activity features that are independent of the environment. With these features that can be shared across different environments, the EI framework can identify human activities in unknown environments. The overall loss function of the EI framework... as follows: .
[0025] in, It is the loss of labeled data; This is the loss of unlabeled data; It is the loss between the domain label output by the domain discriminator and the real domain label. It is a balance constraint. It is a confidence level control constraint. It is a smoothing constraint. and These are weighted parameters. , and These are predefined hyperparameters.
[0026] In the EI framework, source domain data provides features distinct from target domain data, enabling human activity recognition models to acquire environment-independent characteristics. Simultaneously, target domain data provides specific features relevant to the target domain. Attacking the source domain data during adversarial training can provide a wider variety of target domain features.
[0027] 2. Adversarial examples: This invention employs classic adversarial example methods: Fast Signed Gradient Method (FGSM) and Projective Gradient Descent (PGD). These methods process data samples within the [0,1] interval, and the generated adversarial examples are also limited to this range. Therefore, this invention utilizes a min-max normalization method to pre-standardize the data sample x.
[0028] .
[0029] in, This indicates taking the minimum value. This indicates taking the maximum value. This represents a standardized data sample. Next, the initial sample is perturbed. The process of generating WiFi-based adversarial examples for human activity identification using FGSM is as follows: Figure 3 As shown, the perturbed adversarial examples will be misclassified. To simplify notation and facilitate textual description, standardized data samples will be used subsequently. It is still referred to as data sample x.
[0030] Figure 3 The original sample spectrum data is classified as category 1. Using the FGSM method, it is perturbed by ε=1 / 9 to obtain the perturbed adversarial sample spectrum data. The WiFi-based human activity recognition model misclassifies the adversarial sample as category 2.
[0031] 1) Fast Gradient Sign Method (FGSM): Fast Gradient Sign Method is a method for rapidly generating adversarial examples. It is a gradient-based, single-step adversarial example generation method. Fast Gradient Sign Method aligns the direction of the sample perturbation with the gradient direction of the loss function. This adjustment leads to the maximum change in the loss function and the maximum change in the classification result. This invention applies Fast Gradient Sign Method to the EI framework and derives the formulas for generating adversarial examples in the target and source domains: The i-th source domain adversarial sample for: ; The i-th target domain adversarial sample for: .
[0032] in, This represents the i-th source domain data. This represents the data of the i-th target domain. express The corresponding human activity labels; where ε is the attack parameter. Adversarial examples in the target domain are generated during the model testing phase to evaluate the model's robustness, while adversarial examples in the source domain are generated during the model training phase for adversarial training.
[0033] 2) Gradient Descent Projection (PGD): Gradient descent projection is a multi-step variant of the fast gradient sign method. It uses uniform random noise for initialization, thus possessing stronger attack power than uninitialized iterative methods. To limit the perturbation magnitude, gradient descent projection projects the adversarial example in each iteration onto a benign sample (i.e., a normal sample that has not been maliciously tampered with or manipulated). Within the neighborhood, this ensures that adversarial perturbations remain below ε. Gradient descent projection generates adversarial examples through multiple iterations, thus its attack performance is superior to the fast gradient sign method in some cases. This invention applies gradient descent projection to the EI framework and derives formulas for generating adversarial examples in the target and source domains: The i-th source domain adversarial sample for: ; The i-th target domain adversarial sample for: .
[0034] Here, ε is the attack parameter. Adversarial examples in the target domain are generated during the model testing phase to evaluate the robustness of the model, while adversarial examples in the source domain are generated during the model training phase for adversarial training.
[0035] 3. Overall defense framework: like Figure 4 As shown, the defense framework of this invention consists of a filter and cross-adversarial training. During the training phase of the human activity recognition model, a binary classifier in the filter evaluates the perturbation boundary of adversarial examples that are discriminable to the human eye, establishing a discrimination threshold for adversarial examples, denoted as C. Subsequently, cross-adversarial training alternately attacks each batch of source domain data. During the attack process, adversarial examples are generated within a specific parameter range. In the actual deployment and testing phase of the human activity recognition model, the filter first discards adversarial examples that are discriminable to the human eye, and then the remaining adversarial examples are input into the WiFi-based human activity recognition model obtained through cross-adversarial training to classify human activity categories.
[0036] 3.1 Filter: When deploying WiFi-based human activity recognition models, visually distinguishing adversarial examples is impractical. Figure 5The paper demonstrates the visual effects of adversarial examples generated by FGSM with different ε values, where ε=0 corresponds to the spectral data of the original data samples. Generally, the larger the absolute value of ε, the easier it is for people to distinguish adversarial examples. This indicates that adversarial examples exhibit a significant threshold in terms of human visual discrimination ability. Therefore, this invention introduces a supervised filter to train a convolutional neural network (CNN) binary classifier to filter out adversarial examples that are discriminable to the human eye. This invention defines C as the discrimination threshold of the attack parameter ε corresponding to adversarial examples that are discriminable to the human eye. The attack parameter ε of the filtered adversarial examples satisfies the following condition: .
[0037] 3.2 Cross-competitive training: Cross-adversarial training involves the dual application of cross-thinking, including crossing zero points and cross-attacks. Table 1 shows the pseudocode of the cross-adversarial training algorithm. The main differences between cross-adversarial training (CAT) and traditional adversarial training (SAT) are in two aspects. First, in terms of adversarial example generation, the cross-adversarial training method of this invention randomly generates adversarial examples across the zero value of ε, which are difficult for the human eye to distinguish. Second, in terms of attack range, the cross-adversarial training method of this invention performs adversarial attacks on each batch of source domain samples in an interleaved manner.
[0038] Table 1. Pseudocode of the cross-adversarial training algorithm (taking FGSM as an example).
[0039]
[0040] In Table 1, the numbers preceding the pseudocode are row numbers; the first row represents the random initialization of model parameters. The second line indicates the setting of the loop body, looping... The third line indicates a conditional check: if the current loop count is even, then lines 4, 5, and 6 are executed; line 4 indicates... exist The values are randomly selected within the range; line 5 indicates that the FGSM method is applied to the original source domain data to construct source domain adversarial examples; line 6 indicates the source domain adversarial examples... Target domain data and human activity tags The model parameters are updated using gradient descent. Line 7 indicates that if the condition in line 3 is not met, then proceed to line 8; line 8 indicates that no source domain adversarial examples are constructed, but rather based on source domain data. Target domain data and human activity tags The model parameters are updated using gradient descent. Line 9 indicates the termination condition; line 10 indicates the end of the loop; line 11 indicates the return of the last updated model parameters. .
[0041] 1) Crossing the Zero Point: Traditional adversarial training typically uses only a fixed parameter value or a set of parameter values to construct adversarial examples. However, if ε is restricted to a positive value when generating adversarial examples, it will generate adversarial examples in the gradient ascent direction, potentially shifting the data distribution in that direction and affecting the accuracy of the human activity recognition model on the original samples. Therefore, this invention uses both positive and negative values of ε to generate adversarial examples. Cross-adversarial training generates adversarial examples across the zero point of ε, aiming to balance the sample distribution bias caused by adversarial examples and improve the stability of the accuracy of the human activity recognition model.
[0042] Furthermore, determining the attacker's ε value is also a challenge when defending against attacks. Worse still, attackers might use different combinations of ε to launch attacks. Therefore, this invention considers multiple ε values, randomly selecting ε to generate adversarial examples, closely simulating the possibility of generating potential adversarial examples. The boundary of ε in cross-adversarial training is equal to the discrimination threshold C. Cross-adversarial training traverses the positive and negative ε intervals, randomly selecting ε values to generate adversarial examples under specified constraints. .
[0043] 2) Cross-Attack: Traditional adversarial training attacks each batch of training data without considering redundancy and its negative impact on model accuracy. This method wastes a lot of time and resources due to redundant adversarial attacks. In contrast, the cross-adversarial training of this invention attacks each batch of source domain training data alternately. Through cross-attack, this invention alternately performs two steps: First, it guides the overall loss function to descent only along the gradient of the model parameters. Second, it encourages the overall loss function to descent along the partial derivative direction of the samples, and then along the gradient of the model parameters, alternating between training adversarial examples and original data samples. Therefore, compared with traditional adversarial training, the cross-adversarial training in this invention can reduce the time required to generate adversarial examples by half. In addition, this method broadens the direction of gradient descent, making it possible to escape local minima, but also carries the risk of escaping global minima.
[0044] 3) Cross-adversarial training illustration model: such as Figure 6 As shown, this invention provides a mathematical simulation model for cross-adversarial training. Let's focus only on... and For the overall loss function The impact, assuming Select a point on the surface, represented by a black dot, with coordinates [coordinates missing]. Then, the negative gradient direction of J with respect to θ is represented by a solid line, i.e., the gradient descent direction. The dotted and dashed lines represent the directions of J relative to θ, respectively. The sign function of the partial derivative corresponds to the positive and negative intervals of ε, respectively, representing adversarial attacks. The dashed ellipse represents the projection of the three gradient directions onto the x-axis. On the plane, the solid line in the middle represents the original gradient descent direction, and the two solid lines on either side represent the potential direction synthesized from the adversarial attack and traditional gradient descent. The traditional gradient descent direction and the synthesized new direction alternately influence the training process of cross-adversarial training. The bottom left corner shows the two steps of cross-adversarial training: Step 1: No adversarial attack; Step 2: Possible synthesized directions with adversarial attack. If an iteration does not involve adversarial attack, Step 1 is followed. In the next iteration, as in Step 2, adversarial attack is introduced, resulting in a new synthesized direction that combines the effects of adversarial attack and traditional gradient descent. Here, the direction on the right represents ε>0, and the direction on the left represents ε<0. Cross-adversarial training enhances the optimization process, expands the range of effective gradient descent directions, and ultimately improves the model's accuracy and robustness.
[0045] 4. Example: 4.1 Experimental Environment Configuration: The system configuration is as follows: Central Processing Unit (CPU): i7-8700; Graphics Processing Unit (GPU): GTX 1080 Ti; Operating System (OS): Ubuntu 18.04.
[0046] The method of this invention is implemented in Python, using the PyTorch deep learning framework to train the human activity recognition model. Each training session consists of 100 epochs. Furthermore, the Adam optimizer is used to optimize the human activity recognition model, with the learning rate set to 1.0e-3 and the batch size set to 16.
[0047] 4.2 Data Collection and Preprocessing: Nine volunteers were recruited, ranging in height from 165 cm to 195 cm and weight from 50 kg to 90 kg. These volunteers were asked to perform four activities (walking, standing or sitting, jumping, and turning) in six different environments (hall, corridor, meeting room, laboratory, open platform, and building entrance). Each activity was repeated for 300 seconds in each environment. Channel state information was collected using an Intel 5300 wireless network card. The dataset contained 9156 samples, evenly distributed across the environments. Channel state information, as a fine-grained measurement, provides detailed channel information between WiFi devices and is sensitive to human behavior during human activity identification, capturing channel changes as people move. Changes in channel state information values are influenced by different human activities and can be used for activity analysis. However, the acquired channel state information measurements often contain noise. Therefore, this invention uses a Hampel filter for initial denoising, discarding initial unstable data, and divides the remaining activities into 8-second time segments. For each segment, principal component analysis is used to extract common features from multiple subcarriers, thereby reducing dimensionality. This invention selects the first 20 principal components of the channel state information matrix. Subsequently, a short-time Fourier transform is performed on these principal components to generate human activity spectrum data, which serves as input to the human activity recognition model. During training, this invention randomly adjusts the order of the principal component components to prevent overfitting to a specific flattened sequence.
[0048] 4.3 System Implementation: In the cross-adversarial training phase of the WiFi-based human activity recognition model, this invention determines the discrimination threshold C of adversarial samples ε that are discriminable to the human eye through a filter, filters out adversarial samples that are discriminable to the human eye, and then inputs the training data from the source and target domains into the cross-adversarial training method for cross-adversarial training. During the cross-adversarial training process, each batch of source domain training data is attacked alternately, crossing the zero point of ε, and adversarial samples are randomly selected within the range [-C, C] to construct ε. The model is trained for 100 training epochs, and the effect of cross-adversarial training is evaluated through a validation set. The model weights W that achieve the highest accuracy of the human activity recognition model on the validation set are saved.
[0049] During the testing or actual deployment phase of the WiFi-based human activity recognition model, the preprocessed human activity spectrum data is input into a filter to remove adversarial examples that are discernible to the human eye. Then, it is input into the EI framework with loaded model weights W (W is obtained by evaluation of the validation set during the training phase). The activity recognizer of the EI framework can then complete the classification and recognition of human behavior actions.
[0050] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered in all respects as exemplary and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the present invention, and no reference numerals in the claims should be construed as limiting the scope of the claims.
[0051] Furthermore, it should be understood that although this specification describes embodiments, not every embodiment contains only one independent technical solution. This narrative style is merely for clarity. Those skilled in the art should consider the specification as a whole, and the technical solutions in each embodiment can also be appropriately combined to form other embodiments that can be understood by those skilled in the art.
Claims
1. A method for indoor human activity recognition based on WiFi and cross-antagonistic training, characterized in that, The channel state information collected in the WiFi signal field is preprocessed, and the obtained human activity spectrum data is input into the trained human activity recognition model to obtain the human activity recognition result. The human activity recognition model is trained through cross-adversarial training, specifically including the following steps: Step 1: Construct a human activity recognition model: The collected channel state information is preprocessed to obtain human activity spectrum data; the annotated human activity spectrum data is used as the source domain data. Source domain data With corresponding human activity tags Unlabeled human activity spectrum data will be used as the target domain data. Source domain data and target domain data Collectively referred to as data samples The human activity recognition model adopts the EI framework; the EI framework includes a feature extractor, an activity recognizer, and a domain discriminator; the feature extractor is used to extract human activity features from human activity spectrum data; the human activity features are input into the activity recognizer, which is used to classify human activities to obtain human activity recognition results; the human activity features and human activity recognition results are input into the domain discriminator to output domain labels. Step two involves constructing adversarial examples and performing cross-adversarial training on the human activity recognition model, specifically including: For the i-th data sample ,Will As the number of loops Take values from 1 to N sequentially, and repeat the following operation: Based on the i-th source domain data The i-th source domain data Corresponding human activity tags The i-th target domain data and overall loss function The human activity recognition model is subjected to cross-adversarial training. During the cross-adversarial training process, source domain adversarial examples are generated alternately to update the model parameters of the human activity recognition model. Specifically, this includes: Perform a traversal; if i is even, use adversarial examples from the source domain. The i-th target domain data and overall loss function Train the human activity recognition model and update its model parameters. : If i is odd, then use the i-th source domain data. The i-th target domain data and overall loss function Train the human activity recognition model and update its model parameters. : ; Indicates the learning rate; or: right Perform a traversal; if i is odd, use adversarial examples from the source domain. The i-th target domain data and overall loss function Train the human activity recognition model and update its model parameters. : If i is even, then use the i-th source domain data. The i-th target domain data and overall loss function Train the human activity recognition model and update its model parameters. : ; The alternating generation of source domain adversarial samples refers to generating a source domain adversarial sample once every loop iteration in the following manner, and replacing the source domain data with the source domain adversarial sample during training: The range is the attack parameters Random assignment based on attack parameters The overall loss function of the human activity recognition model The i-th data sample is generated using either the fast sign gradient method or the gradient descent projection method. Adversarial examples Adversarial examples Including source domain adversarial examples Adversarial examples in the target domain Target domain adversarial examples are used to evaluate human activity recognition models. This represents the threshold at which adversarial examples can be distinguished by the human eye. This indicates the total number of data samples.
2. The indoor human activity recognition method based on WiFi and cross-adversarial training according to claim 1, characterized in that, In step two, the i-th data sample is generated using the fast gradient sign method. Adversarial examples At that time, source domain adversarial examples for: ; in, Represents the gradient; Target domain adversarial examples for: 。 3. The indoor human activity recognition method based on WiFi and cross-adversarial training according to claim 1, characterized in that, In step two, the i-th data sample is generated using the gradient descent projection method. Adversarial examples Adversarial examples are generated through multiple iterations, where the source domain adversarial examples are... for: ; in, Let represent the source domain adversarial sample obtained in the (t+1)th iteration, and let the source domain adversarial sample obtained in the last iteration be taken as the final source domain adversarial sample. ; Represents the set of possible perturbations; Represents the gradient; Target domain adversarial examples for: ; This represents the target domain adversarial sample obtained in the (t+1)th iteration, and the target domain adversarial sample obtained in the last iteration is taken as the final target domain adversarial sample. .
4. The indoor human activity recognition method based on WiFi and cross-adversarial training according to claim 1, characterized in that, The overall loss function for: ; in, It is the loss of labeled data; This is the loss of unlabeled data; It is the loss between the domain label output by the domain discriminator and the real domain label. It is a balance constraint. It is a confidence level control constraint. It is a smoothing constraint. and These are weighted parameters. , and These are predefined hyperparameters.
5. The indoor human activity recognition method based on WiFi and cross-adversarial training according to claim 1, characterized in that, In step one, the channel state information is preprocessed, including performing short-time Fourier transform and principal component analysis.