Power data backdoor detection method and device, equipment, storage medium and program product
By using feature extraction network and feature dimensionality reduction technology in power data detection, the problem of large-scale calculation overhead of detection of power data in the prior art is solved, and real-time detection of large-scale power data is realized.
Patent Information
- Application Number
- CN202411759788.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-03
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2044-12-03
AI Technical Summary
The prior art has a large calculation overhead when detecting power data, making it difficult to realize real-time detection of large-scale power data.
By inputting the power data to be detected into the feature extraction network, deep data features are extracted, and feature dimensionality reduction processing is performed to obtain low-dimensional data features. Then, the Euclidean distance between the low-dimensional data features and the reference cluster center of the category cluster corresponding to the predetermined clean power data set is determined, and whether the distance constraint is satisfied is determined, thereby determining the detection result.
The calculation overhead of detecting power data is reduced and real-time detection of large-scale power data is realized.
Smart Images

Figure CN119598453A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, equipment, storage medium and program product for detecting backdoors in power data. Background Art
[0002] Neural network backdoor attack is a malicious attack method against deep learning models. Attackers can poison the training data set by injecting some malicious samples with specific triggers into the training data, so that the model learns the strong association between the trigger and the target category during the training process, forming a model backdoor. In the inference stage, once the poisoned sample with a trigger is input into the model, the backdoor of the model will be activated, and the backdoor model will produce incorrect output results according to the attacker's intention. The backdoor attack on the power monitoring system is that the attacker tampers with the power system data, injects backdoor triggers into the power data by setting the voltage to zero, falsifying the measurement value, and injecting data noise, constructs a poisoned data set, and covertly implants the backdoor during the training process of the power monitoring system, causing the power monitoring system to make wrong decisions, thereby causing serious impacts on the operation of the power system and the social economy.
[0003] At present, backdoor defense in the field of power systems mainly includes autoencoding preprocessing methods, STRIP detection methods, and Fine-Pruning methods. However, when using the above methods to detect power data, it is necessary to superimpose multiple different patterns on the input data to obtain a set of perturbed data samples, and then input the model to evaluate the output changes of the set of data samples to detect poisoned samples. Since each input data must be perturbed multiple times, when the number of input samples is large, a large number of perturbed samples will be generated and input into the model, which causes huge computational overhead in both the data processing stage and the model reasoning stage, and is therefore not suitable for the problem of detecting large-scale real-time power data.
[0004] Therefore, how to reduce the computational overhead of detecting power data and thus realize real-time detection of large-scale power data has become an urgent problem to be solved. Summary of the invention
[0005] The embodiments of the present application provide a method, apparatus, device, storage medium and program product for detecting backdoors in power data, which can reduce the computational overhead of detecting power data, thereby achieving real-time detection of large-scale power data.
[0006] In a first aspect, an embodiment of the present application provides a method for detecting power data, the method comprising:
[0007] Inputting the power data to be detected into a feature extraction network to obtain data features of the power data to be detected; the feature extraction network includes multiple hidden layers;
[0008] Perform feature dimensionality reduction on data features to obtain low-dimensional data features;
[0009] Determine the first Euclidean distance between the low-dimensional data feature and the benchmark cluster centers of the plurality of category clusters corresponding to the predetermined clean power data set;
[0010] Based on a plurality of first Euclidean distances and a predetermined distance constraint of each category cluster, a detection result of the power data to be detected is determined; the detection result is clean power data or poisoned power data.
[0011] In one of the embodiments, based on multiple first Euclidean distances and predetermined distance constraints for each category cluster, a detection result for the power data to be detected is determined, including: when it is determined that any first Euclidean distance is less than or equal to the distance constraint corresponding to the category cluster corresponding to the first Euclidean distance, the power data to be detected is determined to be clean power data; when it is determined that each first Euclidean distance is greater than the distance constraint corresponding to the category cluster corresponding to the first Euclidean distance, the power data to be detected is determined to be poisoned power data.
[0012] In one of the embodiments, the benchmark cluster centers of the multiple category clusters corresponding to the clean power data set are determined in the following manner: multiple power data in the acquired clean power data set are input into a feature extraction network to obtain a data feature matrix corresponding to the multiple power data; feature dimension reduction processing is performed on the data feature matrix to obtain a low-dimensional feature matrix; the low-dimensional feature matrix is clustered to obtain multiple category clusters; based on each low-dimensional feature in each category cluster and the number of low-dimensional features in the category cluster, the initial cluster center of each category cluster is determined; the initial cluster center of each category cluster is updated by minimizing the objective function to obtain the benchmark cluster center of each category cluster.
[0013] In one of the embodiments, the distance constraint of each category cluster is determined by: determining the second Euclidean distance between each low-dimensional feature in each category cluster and the benchmark cluster center of the category cluster; and determining the distance constraint of each category cluster based on multiple second Euclidean distances corresponding to each category cluster.
[0014] In one of the embodiments, based on multiple second Euclidean distances corresponding to each category cluster, the distance constraint of each category cluster is determined, including: for each category cluster, determining the average value of the multiple second Euclidean distances corresponding to the category cluster; and taking the product of the average value and a preset value as the distance constraint of the category cluster.
[0015] In one embodiment, the data features are processed for feature dimensionality reduction to obtain low-dimensional data features, including: using principal component analysis to perform feature dimensionality reduction on the data features to obtain low-dimensional data features.
[0016] In a second aspect, the present application provides a power data backdoor detection device, the device comprising:
[0017] A feature extraction module is used to input the power data to be detected into a feature extraction network to obtain data features of the power data to be detected; the feature extraction network includes multiple hidden layers;
[0018] The feature dimension reduction module is used to perform feature dimension reduction processing on data features to obtain low-dimensional data features;
[0019] A determination module, used to determine a first Euclidean distance between the low-dimensional data feature and respective benchmark cluster centers of a plurality of category clusters corresponding to a predetermined clean power data set;
[0020] The determination module is also used to determine the detection result of the power data to be detected based on multiple first Euclidean distances and the predetermined distance constraints of each category cluster; the detection result is clean power data or poisoned power data.
[0021] In a third aspect, the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0022] Inputting the power data to be detected into a feature extraction network to obtain data features of the power data to be detected; the feature extraction network includes multiple hidden layers;
[0023] Perform feature dimensionality reduction on data features to obtain low-dimensional data features;
[0024] Determine the first Euclidean distance between the low-dimensional data feature and the benchmark cluster centers of the plurality of category clusters corresponding to the predetermined clean power data set;
[0025] Based on a plurality of first Euclidean distances and a predetermined distance constraint of each category cluster, a detection result of the power data to be detected is determined; the detection result is clean power data or poisoned power data.
[0026] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the following steps are implemented:
[0027] Inputting the power data to be detected into a feature extraction network to obtain data features of the power data to be detected; the feature extraction network includes multiple hidden layers;
[0028] Perform feature dimensionality reduction on data features to obtain low-dimensional data features;
[0029] Determine the first Euclidean distance between the low-dimensional data feature and the benchmark cluster centers of the plurality of category clusters corresponding to the predetermined clean power data set;
[0030] Based on a plurality of first Euclidean distances and a predetermined distance constraint of each category cluster, a detection result of the power data to be detected is determined; the detection result is clean power data or poisoned power data.
[0031] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:
[0032] Inputting the power data to be detected into a feature extraction network to obtain data features of the power data to be detected; the feature extraction network includes multiple hidden layers;
[0033] Perform feature dimensionality reduction on data features to obtain low-dimensional data features;
[0034] Determine the first Euclidean distance between the low-dimensional data feature and the benchmark cluster centers of the plurality of category clusters corresponding to the predetermined clean power data set;
[0035] Based on a plurality of first Euclidean distances and a predetermined distance constraint of each category cluster, a detection result of the power data to be detected is determined; the detection result is clean power data or poisoned power data.
[0036] The above-mentioned power data backdoor detection method, device, equipment, storage medium and program product, the computer device can input the power data to be detected into the feature extraction network to obtain the data features of the power data to be detected; the feature extraction network includes multiple hidden layers; the data features are subjected to feature dimensionality reduction processing to obtain low-dimensional data features; the first Euclidean distance between the low-dimensional data features and the respective benchmark clustering centers of multiple category clusters corresponding to the predetermined clean power data set is determined; based on the multiple first Euclidean distances and the predetermined distance constraints of each category cluster, the detection result of the power data to be detected is determined; the detection result is clean power data, or poisoned power data. Using this method, the computer device can extract the deep data features of the power data to be detected, and perform dimensionality reduction processing on the deep data features to obtain low-dimensional deep data features, and then determine the Euclidean distance between the low-dimensional deep data features and the benchmark clustering centers of each category cluster corresponding to the predetermined clean power data set, and judge whether the distance constraints are met, thereby determining the detection result for the power data to be detected. In this way, compared with the existing power data detection method, there is no need to perform complex data processing on the input data, thereby reducing the computational overhead of detecting power data, thereby realizing real-time detection of large-scale power data. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0038] Figure 1 This is a schematic diagram of an application scenario of a power data backdoor detection method provided in an embodiment of the present application;
[0039] Figure 2 It is a flowchart of a power data backdoor detection method provided in an embodiment of the present application;
[0040] Figure 3 It is a flowchart of another power data backdoor detection method provided in an embodiment of the present application;
[0041] Figure 4 It is a structural schematic diagram of a power data backdoor detection device provided in an embodiment of the present application;
[0042] Figure 5 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0044] The following introduces the application scenarios of the power data detection method provided in the embodiments of the present application.
[0045] See also Figure 1 , Figure 1 Schematic diagram of an application scenario of a power data backdoor detection method provided by an embodiment of the present application. Figure 1 As shown, the computer device 101 ( Figure 1 In the figure, the computer device 101 is drawn as an example of a terminal device) and a database server 102, wherein data can be transmitted between the computer device 101 and the database server 102 via a network.
[0046] The database server 102 may be used to store the power data to be detected, the reference cluster centers of the respective multiple category clusters corresponding to the predetermined clean power data set, and the distance constraints of each category cluster.
[0047] The computer device 101 may first obtain the power data to be detected from the database server 102, and then input the power data to be detected into a feature extraction network including multiple hidden layers to obtain the deep data features of the power data to be detected; secondly, perform feature dimension reduction on the deep data features to obtain low-dimensional deep data features of the power data to be detected; thereafter, the computer device 101 may obtain the respective benchmark clustering centers of multiple category clusters corresponding to a predetermined clean power data set from the database server 102, and determine the Euclidean distance between the low-dimensional deep data features and the benchmark clustering center of each category cluster; finally, obtain the distance constraint of each category cluster from the database server 102, and determine the detection result of the power data to be detected based on the multiple Euclidean distances and the distance constraint of each category cluster; the detection result is clean power data, or poisoned power data. By adopting this method, the computer device can extract the deep data features of the power data to be detected, and perform dimensionality reduction processing on the deep data features to obtain low-dimensional deep data features. After that, the Euclidean distance between the low-dimensional deep data features and the reference cluster center of each category cluster corresponding to the predetermined clean power data set is determined to determine whether the distance constraint is met, thereby determining the detection result for the power data to be detected. In this way, compared with the existing power data detection method, there is no need to perform complex data processing on the input data, thereby reducing the computational overhead of detecting power data, thereby realizing real-time detection of large-scale power data.
[0048] Optionally, the computer device 101 may be a terminal device or a server. The terminal device mentioned here may include but is not limited to: a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart watch, a smart TV, a smart car terminal, etc. The server mentioned here may be an independent physical server, or a server cluster or a distributed system composed of multiple physical servers.
[0049] See also Figure 2 , Figure 2 1 is a flow chart of a method for detecting a backdoor in power data provided by an embodiment of the present application. The method may be executed by a computer device (for example, the computer device 101 described above). Figure 2 As shown, the power data backdoor detection method may include but is not limited to the following steps:
[0050] S201, inputting the power data to be detected into a feature extraction network to obtain data features of the power data to be detected; the feature extraction network includes multiple hidden layers.
[0051] Since the feature extraction network includes multiple hidden layers, the computer device inputs the power data to be detected into the feature extraction network, and the data features of the power data to be detected are deep data features. Among them, the deep data features contain richer semantic information, which is more conducive to distinguishing clean power data from poisoned power data. In this way, when the power data to be detected is subsequently detected based on the deep data features, the accuracy of the detection results can be improved.
[0052] S202: Perform feature dimensionality reduction processing on the data features to obtain low-dimensional data features.
[0053] In this way, the computer device can obtain low-dimensional data features by reducing the dimensions of the data features, thereby helping to reduce the computational overhead of detecting power data.
[0054] S203: Determine a first Euclidean distance between the low-dimensional data feature and respective benchmark cluster centers of a plurality of category clusters corresponding to a predetermined clean power data set.
[0055] In an optional implementation, before step S203, the computer device may also determine the benchmark cluster centers of the multiple category clusters corresponding to the clean power data set.
[0056] S204. Determine a detection result of the power data to be detected based on the multiple first Euclidean distances and the predetermined distance constraint of each category cluster; the detection result is clean power data or poisoned power data.
[0057] In an optional implementation, before step S204, the computer device may further determine distance constraints of a plurality of category clusters corresponding to the clean power data set.
[0058] In an embodiment of the present application, the computer device can input the power data to be detected into the feature extraction network to obtain the data features of the power data to be detected; the feature extraction network includes multiple hidden layers; the data features are processed by feature dimensionality reduction to obtain low-dimensional data features; the first Euclidean distance between the low-dimensional data features and the respective benchmark clustering centers of multiple category clusters corresponding to the predetermined clean power data set is determined; based on the multiple first Euclidean distances and the predetermined distance constraints of each category cluster, the detection result of the power data to be detected is determined; the detection result is clean power data or poisoned power data. Using this method, the computer device can extract the deep data features of the power data to be detected, and perform dimensionality reduction processing on the deep data features to obtain low-dimensional deep data features, and then determine the Euclidean distance between the low-dimensional deep data features and the benchmark clustering centers of each category cluster corresponding to the predetermined clean power data set, and judge whether the distance constraints are met, so as to determine the detection result for the power data to be detected. In this way, compared with the existing power data detection method, there is no need to perform complex data processing on the input data, thereby reducing the computational overhead of detecting power data, and thus realizing real-time detection of large-scale power data.
[0059] See also Figure 3 , Figure 3 is a flow chart of another method for detecting a backdoor in power data provided by an embodiment of the present application. Figure 2 Compared with the power data backdoor detection method shown in Figure 3 The method also describes how the computer device determines the benchmark cluster centers of the multiple category clusters corresponding to the clean power data set, and how to determine the distance constraints of each category cluster. Figure 3 As shown, the power data backdoor detection method may include but is not limited to the following steps:
[0060] S301. Obtain a clean power data set.
[0061] In the process of defending against backdoor attacks on the power system, assuming that the defender cannot access the original training power data set, but can access a set of clean verification power data sets (or clean power data sets), the computer device can obtain the clean power data set and verify the basic performance of the power system based on the clean power data set.
[0062] S302, inputting multiple power data in the acquired clean power data set into a feature extraction network to obtain a data feature matrix corresponding to the multiple power data; the feature extraction network includes multiple hidden layers.
[0063] Since the feature extraction network includes multiple hidden layers, the computer device inputs multiple power data in the clean power data set into the feature extraction network, and the obtained data feature matrix of the multiple power data includes the deep data features of each power data in the multiple power data.
[0064] S303: Perform feature dimensionality reduction processing on the data feature matrix to obtain a low-dimensional feature matrix.
[0065] In an optional implementation, the computer device performs feature dimensionality reduction processing on the data feature matrix to obtain a low-dimensional feature matrix, which may include: using a principal component analysis method to perform feature dimensionality reduction processing on the data feature matrix to obtain a low-dimensional feature matrix.
[0066] Among them, principal component analysis (PCA), also known as principal component analysis, aims to use the idea of dimensionality reduction to transform multiple indicators into a few comprehensive indicators (i.e., principal components), where each principal component can reflect most of the information of the original variable, and the information contained is not repeated. This method reduces complex factors to several principal components while introducing multiple variables, simplifies the problem, and at the same time obtains more scientific and effective data information.
[0067] Next, we use the principal component analysis method to analyze the data feature matrix (denoted as f l ) to perform feature dimensionality reduction processing and obtain the process of low-dimensional feature matrix.
[0068] Step 1: Determine the data feature matrix f l The covariance matrix of .
[0069] Step 2: Use the covariance matrix to calculate the data feature matrix f l Perform eigenvalue decomposition and determine f l The main components in .
[0070] Step 3: Select the largest m principal components and convert the original data features f l Projected onto m principal components, thus forming a matrix P = (P1, P2, ..., P m ).
[0071] Step 4: Process the matrix P to obtain a low-dimensional feature matrix Z corresponding to multiple power data pca .
[0072] Optionally, the computer device processes the matrix P to obtain a low-dimensional feature matrix Z corresponding to the multiple power data. pca The following formula (1) can be used.
[0073] (1)
[0074] In formula (1), Z represents the data feature matrix f l The data standardization results.
[0075] In this application, the computer equipment performs dimensionality reduction processing on the deep data feature matrix of the power data and maps the high-dimensional features to the low-dimensional space, so that the k-means clustering can more effectively distinguish different categories of data while reducing the noise existing in the high-dimensional data features.
[0076] S304: Cluster the low-dimensional feature matrix to obtain multiple category clusters.
[0077] In an optional implementation, the computer device may use a K-mean clustering method to cluster multiple low-dimensional features to obtain multiple category clusters.
[0078] Each category cluster contains one or more low-dimensional features of clean power data, and the clean power data corresponding to the low-dimensional features in each category cluster have the same or similar properties. In addition, each category cluster has a cluster center, which is used to represent the average point of the category cluster.
[0079] S305 : Determine an initial cluster center of each category cluster based on each low-dimensional feature in each category cluster and the number of low-dimensional features in the category cluster.
[0080] In an optional implementation, the computer device may use the following formula (2) when determining the initial cluster center of each category cluster based on each low-dimensional feature in each category cluster and the number of low-dimensional features in the category cluster.
[0081] (2)
[0082] In formula (2), C j It represents the set of the j-th category cluster; It represents the number of data points (low-dimensional features) belonging to the j-th category cluster. i It represents the number of cells assigned to the jth category cluster (i.e., C j ) in the data points (low-dimensional features), z i From the low-dimensional feature matrix Z determined above pca ;u j It represents the initial cluster center of the j-th category cluster.
[0083] S306 , updating the initial cluster center of each category cluster by minimizing the objective function to obtain the benchmark cluster center of each category cluster.
[0084] In an optional implementation, the objective function may be as shown in the following formula (3).
[0085] (3)
[0086] In formula (3), C represents the total number of category clusters; C j represents the set of the jth category cluster; z i It represents the number of cells assigned to the jth category cluster (i.e., C j ) in the data points (low-dimensional features); u j It represents the initial cluster center of the j-th category cluster; E represents the objective function.
[0087] Optionally, the computer device determines the benchmark cluster center (denoted as ) After that, the benchmark cluster centers corresponding to all category clusters can also be determined , where C represents the total number of category clusters.
[0088] S307 : Determine the second Euclidean distance between each low-dimensional feature in each category cluster and the benchmark cluster center of the category cluster.
[0089] In an optional implementation, when the computer device determines the second Euclidean distance between each low-dimensional feature in each category cluster and the reference cluster center of the category cluster, the following formula (4) may be used.
[0090] (4)
[0091] In formula (4), z i It represents the i-th low-dimensional feature assigned to the j-th category cluster; It represents the benchmark cluster center of the j-th category cluster; d i It represents the Euclidean distance between the i-th low-dimensional feature in the j-th category cluster and the benchmark cluster center of the j-th category cluster.
[0092] S308: Determine the distance constraint of each category cluster based on the multiple second Euclidean distances corresponding to each category cluster.
[0093] In an optional embodiment, the computer device determines the distance constraint of each category cluster based on the multiple second Euclidean distances corresponding to each category cluster, which may include: determining, for each category cluster, the average value of the multiple second Euclidean distances corresponding to the category cluster; and taking the product of the average value and a preset value as the distance constraint of the category cluster.
[0094] In this implementation, when the computer device determines, for each category cluster, the average value of multiple second Euclidean distances corresponding to the category cluster, the following formula (5) may be used.
[0095] (5)
[0096] In formula (5), It represents the average value of multiple Euclidean distances corresponding to the j-th category cluster; d i It represents the Euclidean distance between the i-th low-dimensional feature in the j-th category cluster and the benchmark cluster center of the j-th category cluster; the physical meanings of other letters can be referred to the above explanation of the physical meanings of the letters in formula (4), which will not be repeated here.
[0097] In this embodiment, the preset value is, for example, 3. Here, 3 is an empirical value obtained based on multiple experiments. When the preset value is 3, the computer device can determine the distance constraint of the j-th category cluster as .
[0098] S309: Input the power data to be detected into a feature extraction network to obtain data features of the power data to be detected.
[0099] In an optional implementation, the relevant description of step S309 can refer to the description of the aforementioned step S301, which will not be repeated here.
[0100] S310. Using principal component analysis, perform dimension reduction processing on data features to obtain low-dimensional data features.
[0101] S311 : Determine a first Euclidean distance between the low-dimensional data feature and respective benchmark cluster centers of a plurality of category clusters corresponding to a predetermined clean power data set.
[0102] In an optional embodiment, the computer device may calculate the base cluster centers corresponding to all category clusters corresponding to the low-dimensional data features and the clean power data set. The first Euclidean distance between each base cluster center in .
[0103] S312, determining a detection result of the power data to be detected based on the multiple first Euclidean distances and the predetermined distance constraint of each category cluster; the detection result is clean power data, or poisoned power data.
[0104] In an optional embodiment, a computer device determines the detection result of the power data to be detected based on multiple first Euclidean distances and predetermined distance constraints for each category cluster, which may include: when it is determined that any first Euclidean distance is less than or equal to the distance constraint corresponding to the category cluster corresponding to the first Euclidean distance, determining that the power data to be detected is clean power data; when it is determined that each first Euclidean distance is greater than the distance constraint corresponding to the category cluster corresponding to the first Euclidean distance, determining that the power data to be detected is poisoned power data.
[0105] For example, assuming that among the multiple first Euclidean distances, the first Euclidean distance 1 is the Euclidean distance between the low-dimensional data features of the power data to be detected and the reference cluster center of the first category cluster in the predetermined clean power data set, the first Euclidean distance 1 is 0.18, and the distance constraint of the first category cluster is =0.21. In this case, the computer device may determine that the first Euclidean distance 1 (0.18) is less than the distance constraint (0.21) of the first category cluster. At this time, the computer device may determine that the power data to be detected is clean power data.
[0106] For another example, assume that multiple category clusters include category cluster 1, category cluster 2, and category cluster 3, wherein the distance constraint of category cluster 1 is 0.21, the distance constraint of category cluster 2 is 0.24, and the distance constraint of category cluster 3 is 0.18, and assume that multiple first Euclidean distances include first Euclidean distance 1, first Euclidean distance 2, and first Euclidean distance 3, wherein first Euclidean distance 1 is the Euclidean distance between the low-dimensional data features of the power data to be detected and the benchmark clustering center of category cluster 1, and the first Euclidean distance 1 is 0.22; the first Euclidean distance 2 is the Euclidean distance between the low-dimensional data features of the power data to be detected and the benchmark clustering center of category cluster 2, and the first Euclidean distance 2 is 0.26; the first Euclidean distance 3 is the Euclidean distance between the low-dimensional data features of the power data to be detected and the benchmark clustering center of category cluster 2, and the first Euclidean distance 2 is 0.20. In this case, the computer device can determine that the first Euclidean distance 1 (0.22) is greater than the distance constraint of category cluster 1 (0.21), the first Euclidean distance 2 (0.26) is greater than the distance constraint of category cluster 2 (0.24), and the first Euclidean distance 3 (0.20) is greater than the distance constraint of category cluster 3 (0.18). At this time, the computer device can determine that the power data to be detected is poisoned power data.
[0107] In an embodiment of the present application, a computer device can obtain a clean power data set, and determine the benchmark cluster centers of multiple category clusters corresponding to the clean power data set, and then determine the Euclidean distance between all samples in each category cluster and the benchmark cluster center of the category cluster, and determine the distance constraint of each category cluster based on multiple Euclidean distances. After that, in the process of detecting the power data to be detected, the low-dimensional data features of the power data to be detected are determined, and the Euclidean distance between the low-dimensional data features and the benchmark cluster center of each category cluster is determined. Finally, based on multiple Euclidean distances and the distance constraint of each category cluster, it is determined whether the power data to be detected is clean power data or poisoned power data. In this way, compared with the existing power data detection method, there is no need to perform complex data processing on the input data, thereby reducing the computational overhead of detecting power data, thereby realizing real-time detection of large-scale power data.
[0108] In addition, the present application utilizes a feature extraction network including multiple hidden layers to perform feature extraction on power data, and can extract deep features of the power data (or use the last hidden layer in the feature extraction network to output the deep features of the power data). Afterwards, the deep features are used as the basis for backdoor analysis. Since the deep features are the highest-order features of the input power data, they determine the decision-making process of the model, and also imply how the backdoor model correctly identifies clean samples and why the backdoor samples are incorrectly predicted as target categories. Therefore, analyzing the deep features can improve the accuracy of detecting the power data to be detected, or in other words, it can more accurately distinguish between poisoned power data and clean power data.
[0109] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0110] Based on the same inventive concept, the embodiment of the present application also provides a power data backdoor detection device for implementing the power data backdoor detection method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more power data backdoor detection device embodiments provided below can refer to the limitations of the power data backdoor detection method above, and will not be repeated here.
[0111] See also Figure 4 , Figure 4 Schematic diagram of a power data backdoor detection device provided in an embodiment of the present application. Figure 4 As shown, the power data detection device may include but is not limited to:
[0112] The feature extraction module 401 is used to input the power data to be detected into the feature extraction network to obtain the data features of the power data to be detected; the feature extraction network includes multiple hidden layers;
[0113] A feature dimension reduction module 402 is used to perform feature dimension reduction processing on data features to obtain low-dimensional data features;
[0114] A determination module 403 is used to determine a first Euclidean distance between the low-dimensional data feature and respective benchmark cluster centers of a plurality of category clusters corresponding to a predetermined clean power data set;
[0115] The determination module 403 is further used to determine the detection result of the power data to be detected based on the multiple first Euclidean distances and the predetermined distance constraints of each category cluster; the detection result is clean power data or poisoned power data.
[0116] In one embodiment, when the determination module 403 is used to determine the detection result for the power data to be detected based on multiple first Euclidean distances and the predetermined distance constraints of each category cluster, it is specifically used to: when it is determined that any first Euclidean distance is less than or equal to the distance constraint corresponding to the category cluster corresponding to the first Euclidean distance, determine that the power data to be detected is clean power data; when it is determined that each first Euclidean distance is greater than the distance constraint corresponding to the category cluster corresponding to the first Euclidean distance, determine that the power data to be detected is poisoned power data.
[0117] In one embodiment, the feature extraction module 401 is also used to input multiple power data in the acquired clean power data set into the feature extraction network to obtain a data feature matrix corresponding to the multiple power data; the feature dimension reduction module 402 is also used to perform feature dimension reduction processing on the data feature matrix to obtain a low-dimensional feature matrix; cluster the low-dimensional feature matrix to obtain multiple category clusters; the determination module 403 is also used to determine the initial clustering center of each category cluster based on each low-dimensional feature in each category cluster and the number of low-dimensional features in the category cluster; the initial clustering center of each category cluster is updated by minimizing the objective function to obtain the benchmark clustering center of each category cluster.
[0118] In one embodiment, the determination module 403 is further used to: determine the second Euclidean distance between each low-dimensional feature in each category cluster and the benchmark cluster center of the category cluster; and determine the distance constraint of each category cluster based on multiple second Euclidean distances corresponding to each category cluster.
[0119] In one embodiment, when the determination module 403 is used to determine the distance constraint of each category cluster based on the multiple second Euclidean distances corresponding to each category cluster, it is specifically used to: determine, for each category cluster, the average value of the multiple second Euclidean distances corresponding to the category cluster; and use the product of the average value and a preset value as the distance constraint of the category cluster.
[0120] In one embodiment, when the feature dimension reduction module 402 is used to perform feature dimension reduction processing on data features to obtain low-dimensional data features, it is specifically used to: use principal component analysis to perform feature dimension reduction processing on data features to obtain low-dimensional data features.
[0121] Each module in the above-mentioned power data backdoor detection device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the terminal device in the form of hardware, or can be stored in the memory in the terminal device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0122] In an exemplary embodiment, the present application provides a computer device, which may be a terminal, and its internal structure diagram may be as follows: Figure 5As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (Near Field Communication, NFC) or other technologies. When the computer program is executed by the processor, a method for detecting a backdoor in power data is implemented.
[0123] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0124] In an exemplary embodiment, the present application provides a computer device, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0125] Inputting the power data to be detected into a feature extraction network to obtain data features of the power data to be detected; the feature extraction network includes multiple hidden layers;
[0126] Perform feature dimensionality reduction on data features to obtain low-dimensional data features;
[0127] Determine the first Euclidean distance between the low-dimensional data feature and the benchmark cluster centers of the plurality of category clusters corresponding to the predetermined clean power data set;
[0128] Based on a plurality of first Euclidean distances and a predetermined distance constraint of each category cluster, a detection result of the power data to be detected is determined; the detection result is clean power data or poisoned power data.
[0129] In one embodiment, when a processor executes a computer program to determine the detection result for the power data to be detected based on multiple first Euclidean distances and predetermined distance constraints for each category cluster, the following steps are specifically implemented: when it is determined that any first Euclidean distance is less than or equal to the distance constraint corresponding to the category cluster corresponding to the first Euclidean distance, the power data to be detected is determined to be clean power data; when it is determined that each first Euclidean distance is greater than the distance constraint corresponding to the category cluster corresponding to the first Euclidean distance, the power data to be detected is determined to be poisoned power data.
[0130] In one embodiment, the processor executes the computer program to further implement the following steps: inputting multiple power data in the acquired clean power data set into the feature extraction network to obtain a data feature matrix corresponding to the multiple power data; performing feature dimensionality reduction processing on the data feature matrix to obtain a low-dimensional feature matrix; clustering the low-dimensional feature matrix to obtain multiple category clusters; determining the initial cluster center of each category cluster based on each low-dimensional feature in each category cluster and the number of low-dimensional features in the category cluster; updating the initial cluster center of each category cluster by minimizing the objective function to obtain a benchmark cluster center of each category cluster.
[0131] In one embodiment, the processor executes the computer program to further implement the following steps: determining the second Euclidean distance between each low-dimensional feature in each category cluster and the benchmark cluster center of the category cluster; and determining the distance constraint of each category cluster based on multiple second Euclidean distances corresponding to each category cluster.
[0132] In one embodiment, when a processor executes a computer program to determine the distance constraint of each category cluster based on multiple second Euclidean distances corresponding to each category cluster, the following steps are specifically implemented: for each category cluster, an average value of the multiple second Euclidean distances corresponding to the category cluster is determined; and the product of the average value and a preset value is used as the distance constraint of the category cluster.
[0133] In one embodiment, when the processor executes a computer program to perform feature dimensionality reduction processing on data features and obtain low-dimensional data features, the following steps are specifically implemented: using principal component analysis to perform feature dimensionality reduction processing on data features and obtain low-dimensional data features.
[0134] In an exemplary embodiment, the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the following steps are implemented:
[0135] Inputting the power data to be detected into a feature extraction network to obtain data features of the power data to be detected; the feature extraction network includes multiple hidden layers;
[0136] Perform feature dimensionality reduction on data features to obtain low-dimensional data features;
[0137] Determine the first Euclidean distance between the low-dimensional data feature and the benchmark cluster centers of the plurality of category clusters corresponding to the predetermined clean power data set;
[0138] Based on a plurality of first Euclidean distances and a predetermined distance constraint of each category cluster, a detection result of the power data to be detected is determined; the detection result is clean power data or poisoned power data.
[0139] In one embodiment, a computer program is executed by a processor to implement, when determining the detection result for the power data to be detected based on multiple first Euclidean distances and predetermined distance constraints for each category cluster, the following steps are specifically implemented: when it is determined that any first Euclidean distance is less than or equal to the distance constraint corresponding to the category cluster corresponding to the first Euclidean distance, the power data to be detected is determined to be clean power data; when it is determined that each first Euclidean distance is greater than the distance constraint corresponding to the category cluster corresponding to the first Euclidean distance, the power data to be detected is determined to be poisoned power data.
[0140] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: multiple power data in the acquired clean power data set are input into the feature extraction network to obtain a data feature matrix corresponding to the multiple power data; feature dimension reduction processing is performed on the data feature matrix to obtain a low-dimensional feature matrix; the low-dimensional feature matrix is clustered to obtain multiple category clusters; based on each low-dimensional feature in each category cluster and the number of low-dimensional features in the category cluster, the initial cluster center of each category cluster is determined; the initial cluster center of each category cluster is updated by minimizing the objective function to obtain the benchmark cluster center of each category cluster.
[0141] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: determining the second Euclidean distance between each low-dimensional feature in each category cluster and the benchmark cluster center of the category cluster; and determining the distance constraint of each category cluster based on multiple second Euclidean distances corresponding to each category cluster.
[0142] In one embodiment, when a computer program is executed by a processor to determine the distance constraint of each category cluster based on multiple second Euclidean distances corresponding to each category cluster, the following steps are specifically implemented: for each category cluster, the average value of the multiple second Euclidean distances corresponding to the category cluster is determined; and the product of the average value and a preset value is used as the distance constraint of the category cluster.
[0143] In one embodiment, when a computer program is executed by a processor to perform feature dimensionality reduction processing on data features and obtain low-dimensional data features, the following steps are specifically implemented: using principal component analysis to perform feature dimensionality reduction processing on data features and obtain low-dimensional data features.
[0144] In an exemplary embodiment, the present application provides a computer program product, including a computer program, which implements the following steps when executed by a processor:
[0145] Inputting the power data to be detected into a feature extraction network to obtain data features of the power data to be detected; the feature extraction network includes multiple hidden layers;
[0146] Perform feature dimensionality reduction on data features to obtain low-dimensional data features;
[0147] Determine the first Euclidean distance between the low-dimensional data feature and the benchmark cluster centers of the plurality of category clusters corresponding to the predetermined clean power data set;
[0148] Based on a plurality of first Euclidean distances and a predetermined distance constraint of each category cluster, a detection result of the power data to be detected is determined; the detection result is clean power data or poisoned power data.
[0149] In one embodiment, a computer program is executed by a processor to implement, when determining the detection result for the power data to be detected based on multiple first Euclidean distances and predetermined distance constraints for each category cluster, the following steps are specifically implemented: when it is determined that any first Euclidean distance is less than or equal to the distance constraint corresponding to the category cluster corresponding to the first Euclidean distance, the power data to be detected is determined to be clean power data; when it is determined that each first Euclidean distance is greater than the distance constraint corresponding to the category cluster corresponding to the first Euclidean distance, the power data to be detected is determined to be poisoned power data.
[0150] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: multiple power data in the acquired clean power data set are input into the feature extraction network to obtain a data feature matrix corresponding to the multiple power data; feature dimension reduction processing is performed on the data feature matrix to obtain a low-dimensional feature matrix; the low-dimensional feature matrix is clustered to obtain multiple category clusters; based on each low-dimensional feature in each category cluster and the number of low-dimensional features in the category cluster, the initial cluster center of each category cluster is determined; the initial cluster center of each category cluster is updated by minimizing the objective function to obtain the benchmark cluster center of each category cluster.
[0151] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: determining the second Euclidean distance between each low-dimensional feature in each category cluster and the benchmark cluster center of the category cluster; and determining the distance constraint of each category cluster based on multiple second Euclidean distances corresponding to each category cluster.
[0152] In one embodiment, when a computer program is executed by a processor to determine the distance constraint of each category cluster based on multiple second Euclidean distances corresponding to each category cluster, the following steps are specifically implemented: for each category cluster, the average value of the multiple second Euclidean distances corresponding to the category cluster is determined; and the product of the average value and a preset value is used as the distance constraint of the category cluster.
[0153] In one embodiment, when a computer program is executed by a processor to perform feature dimensionality reduction processing on data features and obtain low-dimensional data features, the following steps are specifically implemented: using principal component analysis to perform feature dimensionality reduction processing on data features and obtain low-dimensional data features.
[0154] It should be noted that the data involved in this application (including but not limited to power data to be tested, clean power data sets, etc.) are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0155] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0156] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0157] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be construed as limiting the scope of the present application. It should be noted that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A method for detecting a backdoor in power data, characterized in that: The method comprises: Inputting the power data to be detected into a feature extraction network to obtain data features of the power data to be detected; the feature extraction network includes multiple hidden layers; Performing feature dimensionality reduction processing on the data features to obtain low-dimensional data features; Determine a first Euclidean distance between the low-dimensional data feature and respective benchmark cluster centers of a plurality of category clusters corresponding to a predetermined clean power data set; Based on the plurality of the first Euclidean distances and the predetermined distance constraint of each of the category clusters, a detection result of the power data to be detected is determined; the detection result is clean power data or poisoned power data.
2. The method according to claim 1, characterized in that The step of determining the detection result for the power data to be detected based on the plurality of the first Euclidean distances and the predetermined distance constraint of each of the category clusters comprises: In the case where it is determined that any one of the first Euclidean distances is less than or equal to the distance constraint corresponding to the category cluster corresponding to the first Euclidean distance, determining that the power data to be detected is clean power data; In a case where it is determined that each of the first Euclidean distances is greater than the distance constraint corresponding to the category cluster corresponding to the first Euclidean distance, it is determined that the power data to be detected is poisoned power data.
3. The method according to claim 1, characterized in that The benchmark cluster centers of the multiple category clusters corresponding to the clean power data set are determined in the following way: Inputting multiple power data in the acquired clean power data set into a feature extraction network to obtain a data feature matrix corresponding to the multiple power data; Performing feature dimensionality reduction processing on the data feature matrix to obtain a low-dimensional feature matrix; Clustering the low-dimensional feature matrix to obtain multiple category clusters; Determine an initial cluster center of each of the category clusters based on each low-dimensional feature in each of the category clusters and the number of the low-dimensional features in the category cluster; The initial cluster center of each of the category clusters is updated by minimizing the objective function to obtain the benchmark cluster center of each of the category clusters.
4. The method according to claim 3, characterized in that The distance constraint of each of the category clusters is determined in the following manner: Determine a second Euclidean distance between each of the low-dimensional features in each of the category clusters and a reference cluster center of the category cluster; Based on the plurality of the second Euclidean distances corresponding to each of the category clusters, a distance constraint of each of the category clusters is determined.
5. The method according to claim 4, characterized in that The determining the distance constraint of each of the category clusters based on the plurality of the second Euclidean distances corresponding to each of the category clusters comprises: For each of the category clusters, determining an average value of a plurality of the second Euclidean distances corresponding to the category cluster; The product of the average value and a preset value is used as the distance constraint of the category cluster.
6. The method according to any one of claims 1 to 5, characterized in that: The performing feature dimensionality reduction processing on the data features to obtain low-dimensional data features includes: The principal component analysis method is used to perform feature dimensionality reduction processing on the data features to obtain low-dimensional data features.
7. A power data backdoor detection device, characterized in that: The device comprises: A feature extraction module, used for inputting the power data to be detected into a feature extraction network to obtain data features of the power data to be detected; the feature extraction network includes a plurality of hidden layers; A feature dimension reduction module is used to perform feature dimension reduction processing on the data features to obtain low-dimensional data features; A determination module, configured to determine a first Euclidean distance between the low-dimensional data feature and respective benchmark cluster centers of a plurality of category clusters corresponding to a predetermined clean power data set; The determination module is further used to determine the detection result of the power data to be detected based on the plurality of the first Euclidean distances and the predetermined distance constraints of each of the category clusters; the detection result is clean power data or poisoned power data.
8. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method according to any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Improved K-means abnormal value detection method and device
CN109978070A
Abnormal data diagnosis method and system based on two-step clustering algorithm
CN112765142A
Data processing method and device, electronic equipment and storage medium
CN115270957A
Medical treatment metric modelling based on machine learning
US20200152320A1
Generation device, generation method, and generation program
US20240303330A1
Cited By
Power data backdoor detection method and apparatus, device, storage medium, and program product
WO2026118497A1