Anomaly detection method and system for federated learning model training based on distributed storage
By extracting and analyzing the feature vectors of deep neural networks, detecting abnormal situations in the federated learning process, the problem of model parameter errors or tampering is solved, and the accuracy and stability of model training are improved.
Patent Information
- Application Number
- CN202210413821.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-14
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2042-04-14
AI Technical Summary
During the federated learning process, the model parameters shared by each end may be errored or tampered with, resulting in slower model convergence speed or reduced accuracy. Due to data privacy issues, each end cannot effectively share data, resulting in low training accuracy.
By extracting the feature vector matrix of the deep neural network, obtaining the relative position changes of the feature vector before and after fusion, calculating the feature stability and accuracy vectors, classifying and filtering out the category set with high accuracy, detecting the abnormal situation of the deep neural network, and ensuring that The accuracy of model training.
It improves the accuracy of abnormal detection, avoids the fusion of abnormal features, ensures the accuracy and stability of model training, and prevents the impact of model parameters being errored or tampered.
Smart Images

Figure CN114928547B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence, and in particular to a method and system for detecting anomalies in federated learning model training based on distributed storage. Background Art
[0002] With the development of society, neural networks are widely used in image data analysis, such as image segmentation and classification. However, the acquisition of neural networks depends on the size and annotation of the dataset. For some application scenarios, such as medical image data, biochemistry image data, materials science image data, and satellite aerial imagery, the acquisition cost of this image data is high, the data size is small, the annotation cost is high, and there are issues such as data privacy and confidentiality. As a result, this data cannot be shared between different terminals, resulting in low accuracy of the neural networks trained on each terminal.
[0003] Federated learning can be used to train a highly accurate neural network for image data analysis using data from all devices, without sharing data between them. However, during the federated learning process, each device must share its own trained network data. There is a risk that some devices may maliciously share incorrect model parameters, or that shared model parameters may be attacked or tampered with by external networks. These can introduce incorrect model parameters into the federated learning process, slowing model convergence or reducing accuracy. Summary of the Invention
[0004] In order to solve the above technical problems, the purpose of the present invention is to provide a federated learning model training anomaly detection based on distributed storage. The technical solutions adopted are as follows:
[0005] In a first aspect, an embodiment of the present invention provides a method for detecting anomalies in federated learning model training based on distributed storage, the method comprising:
[0006] Extracting feature vector matrices of a first deep neural network and a second deep neural network respectively; the first deep neural network is a deep neural network trained by each end before fusion; the second deep neural network is a deep neural network obtained by fusing the first deep neural networks of all ends through a central server;
[0007] Obtain the relative position of the same feature vector and other feature vectors in the deep neural network before and after fusion, and obtain the feature stability of the feature vector based on the change of the relative position before and after fusion;
[0008] Obtaining a difference between the same eigenvectors in the deep neural network before and after the fusion, and obtaining a trend vector of the eigenvector based on the difference and the degree of feature stability corresponding to the eigenvector;
[0009] Classifying the trend vectors to obtain a multi-category trend vector set, and selecting a category set in which the trend vector mean is greater than a trend threshold value as a correct category set;
[0010] Select any two correct category sets to obtain corresponding distribution differences; take the mean of all the distribution differences as the characteristic trend distribution difference;
[0011] Obtaining the accuracy by combining the feature accuracy distribution difference and the mean of the modulus lengths of all accuracy vectors in the correct category set;
[0012] Obtain an abnormality of the second deep neural network according to the accuracy.
[0013] Furthermore, the specific steps of extracting the eigenvector matrices of the first deep neural network and the second deep neural network respectively include:
[0014] Extracting the output feature maps of the last convolutional layer in the encoders of the first deep neural network and the second deep neural network respectively as the feature vectors;
[0015] Obtaining a set of feature vectors before and after fusion through all the feature vectors in the first deep neural network and the second deep neural network;
[0016] The eigenvector matrix is obtained according to the eigenvector set.
[0017] Furthermore, the step of acquiring the first deep neural network includes:
[0018] Train deep neural networks on all devices through federated learning;
[0019] When the accuracy of the deep neural network is greater than an accuracy threshold, the deep neural network is the first deep neural network.
[0020] Furthermore, the step of obtaining the relative position of the same feature vector and other feature vectors in the deep neural network before and after fusion, and obtaining the feature stability of the feature vector based on the change of the relative position before and after fusion includes:
[0021] Taking the difference between any two eigenvectors in the deep neural network as the relative position of the eigenvectors;
[0022] Calculating the sum of the relative positions of each eigenvector and other eigenvectors before and after fusion;
[0023] The difference between the sum of the relative positions of the same eigenvector and other eigenvectors in the deep neural network before and after fusion is used as the change in the relative position of the eigenvector before and after fusion;
[0024] The characteristic stability of the characteristic vector is obtained according to the change condition.
[0025] Furthermore, the step of obtaining the accuracy vector of the feature vector according to the difference and the feature stability corresponding to the feature vector includes:
[0026] Obtaining the mean of all eigenvectors in the first deep neural network as the expected value of the deep neural network;
[0027] Taking the difference between the expected value and each of the eigenvectors as the standard deviation value;
[0028] Obtaining a first eigenvalue of the eigenvector according to a projection size of a difference between the same eigenvector in the deep neural network before and after the fusion on the corresponding standard deviation value;
[0029] Taking the characteristic stability corresponding to each of the characteristic vectors as the second eigenvalue of the characteristic vector;
[0030] The first eigenvalue and the second eigenvalue of the eigenvector are combined to obtain a trend vector of the eigenvector.
[0031] Furthermore, the method for classifying the trend vectors is to classify the trend vectors according to mean shift clustering.
[0032] Furthermore, the method for selecting any two correct category sets to obtain corresponding distribution differences is to obtain the distribution differences of feature vectors in any two correct category sets through maximum mean differences.
[0033] Furthermore, the step of obtaining the abnormality of the second deep neural network according to the accuracy includes:
[0034] When the accuracy of all terminals is greater than the accuracy threshold, the second deep neural network is normal;
[0035] When the accuracy at either end is less than the accuracy threshold, the second deep neural network is abnormal.
[0036] Furthermore, the step of further confirming the abnormal end and obtaining the correct second deep neural network after obtaining the abnormality of the second deep neural network according to the accuracy includes:
[0037] When the accuracy of any terminal is less than the accuracy threshold, the central server shares the first deep neural network of each terminal with all terminals;
[0038] Each terminal calculates the accuracy of each of the first deep neural networks and uploads it to the central server to obtain an accuracy set;
[0039] Select the median of each accuracy set as the final accuracy;
[0040] Filter each set whose final accuracy is greater than the final accuracy threshold as the correct end;
[0041] Fusing all the correct ends to obtain a third deep neural network;
[0042] The second deep neural network is replaced with the third deep neural network as the correct second deep neural network.
[0043] In the second aspect, an embodiment of the present invention also provides a federated learning model training anomaly detection system based on distributed storage, comprising a memory, a processor, and a computer program stored in the memory and runnable on the processor. When the processor executes the computer program, it implements the steps of any one of the above-mentioned federated learning model training anomaly detection methods based on distributed storage.
[0044] The embodiments of the present invention have the following beneficial effects:
[0045] The embodiment of the present invention obtains the deep neural networks before and after fusion through federated learning, obtains the stability of each eigenvector in the deep neural network after fusion by the relative position difference of the eigenvectors in the deep neural networks before and after fusion, obtains the accuracy vector of each eigenvector in the deep neural network after fusion according to the stability and the difference of the eigenvectors in the deep neural networks before and after fusion, obtains the accuracy of the deep neural network after fusion by the accuracy vector, and detects abnormalities in the deep neural network after fusion according to the accuracy, thereby improving the accuracy of abnormality detection, avoiding the fusion of abnormal features, and ensuring the accuracy of model training. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solutions and advantages of the embodiments of the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0047] Figure 1 A flowchart of a method for anomaly detection in federated learning model training based on distributed storage is provided in one embodiment of the present invention. DETAILED DESCRIPTION
[0048] To further illustrate the technical means and effectiveness of the present invention to achieve its intended purpose, the following, in conjunction with the accompanying drawings and preferred embodiments, describes in detail the specific implementation, structure, features, and effectiveness of a federated learning model training anomaly detection method and system based on distributed storage proposed by the present invention. In the following description, different references to "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics of one or more embodiments may be combined in any suitable manner.
[0049] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
[0050] The specific scenario to which the embodiments of the present invention are applicable is to detect abnormal model parameters at all ends during the training of a federated learning model. A fused deep neural network is obtained through federated learning, and the change in the relative position of each eigenvector with other eigenvectors in the deep neural network before and after fusion is compared to obtain the characteristic stability of each eigenvector. The accuracy vector of the eigenvector is obtained by taking the difference between the eigenvector in the deep neural network before and after fusion and the characteristic stability of the eigenvector. All accuracy vectors are clustered and screened to obtain categories greater than the accuracy threshold. The mean of the distribution difference between each category and other categories is calculated, and the accuracy is obtained based on the mean and the mean of the modulus lengths of all accuracy vectors. This accuracy is used to detect abnormalities in the fused deep neural network.
[0051] The following describes in detail a method and system for detecting anomalies in federated learning model training based on distributed storage provided by the present invention with reference to the accompanying drawings.
[0052] See also Figure 1 , which shows a flow chart of a method for anomaly detection in federated learning model training based on distributed storage according to an embodiment of the present invention. The method includes:
[0053] Step S1: Extract the eigenvector matrices of the first deep neural network and the second deep neural network respectively; the first deep neural network is the deep neural network trained by each end before fusion; the second deep neural network is the deep neural network after the first deep neural networks of all ends are fused through the central server.
[0054] The specific steps of federated learning include:
[0055] 1) The dataset consisting of image data is distributed and stored on each end. The end is the cloud platform or storage node on the network that stores the image dataset. The image dataset is divided into training set and test set. The datasets of each end cannot be shared;
[0056] 2) Each terminal uses its own training set to train a deep neural network. The deep neural network structure trained by all terminals is consistent. The deep neural network used in this embodiment of the present invention is a semantic segmentation network, such as SegNet. Other embodiments may use an image classification network or an object detection network.
[0057] 3) Each terminal shares the trained model parameters with the central server, which fuses the model parameters of all terminals. In the embodiment of the present invention, the fusion is to sum and average the model parameters of all terminals to obtain new model parameters. The new model parameters are the result of the fusion of the model parameters of all terminals.
[0058] 4) The central server sends the fused model parameters to each client. After receiving the model parameters, each client continues to train the deep neural network based on them. When each client has trained to a certain level, such as after a fixed number of training cycles using the training set, it again shares the model parameters with the central server. The central server then fuses the uploaded model parameters to obtain the new fused model parameters and sends them to each client.
[0059] 5) Repeat the process of step 4 until the deep neural networks at all ends converge.
[0060] The first deep neural network is obtained by training the deep neural network through federated learning. When the accuracy of the test set in the deep neural networks of all terminals exceeds the accuracy threshold, the deep neural network at this time is the first deep neural network. The first deep neural network has initially learned the data distribution characteristics of the training sets of all terminals. Before the deep neural network converges, the parameter model of the first deep neural network at each terminal is the same, but the specific parameters in the parameter model are different, that is, the extracted features are different. Therefore, the first deep neural network of each terminal is different before the deep neural network converges.
[0061] In the embodiment of the present invention, the accuracy threshold is set to 0.5, and in other embodiments, the value may be set according to different requirements.
[0062] The method for obtaining the second deep neural network is: sharing the model parameters of the first deep neural network trained by all terminals to the central server, and using the central server to sum up all model parameters and take the average value to obtain new model parameters. The deep neural network corresponding to the new model parameters is the second deep neural network.
[0063] The features extracted from the image are the results output by each convolutional layer in the deep neural network. In one embodiment of the present invention, the output feature map of the last convolutional layer in the encoder of the deep neural network is used as the features extracted by the deep neural network on the image. Other embodiments may combine the feature maps output by any convolutional layer or all feature maps as the extracted features. The features extracted from the image by the deep neural network are multi-channel feature maps. Flattening this feature map into a one-dimensional vector is the feature vector extracted by the deep neural network. Therefore, for multiple images, the deep neural network can extract multiple corresponding feature vectors.
[0064] Since the parameter models of the deep neural networks before and after fusion are the same, the number of feature vectors extracted from the deep neural networks before and after fusion is also the same. The set of feature vectors extracted from the first deep neural network is referred to as S1, and the set of feature vectors extracted from the second deep neural network is referred to as S2. That is, the number of feature vectors in S1 and S2 is the same.
[0065] The model parameters of all terminals are fused through the central server, and the fused new model parameters are sent to each terminal. Then each terminal contains the feature vector sets S1 and S2 corresponding to the deep neural network before and after fusion.
[0066] The corresponding eigenvector matrix is obtained based on the eigenvectors in the eigenvector sets S1 and S2. That is, the eigenvector matrix of the eigenvector set S1 is M1, and the eigenvector matrix of the eigenvector set S2 is M2. Each row of the eigenvector matrix is an eigenvector.
[0067] The eigenvector matrix M1 is decomposed into a low-rank matrix A1 and a sparse noise matrix D1 through robust principal component analysis (RPCA), that is, M1 = D1 + A1. Similarly, the eigenvector matrix M2 is decomposed into a low-rank matrix A2 and a sparse noise matrix D2, that is, M2 = D2 + A2.
[0068] Because the deep neural network has not converged, the learned features are not accurate and are mixed with a lot of sharp noise and other features. These noise and other features are stored in the noise matrices D1 and D2. The low-rank matrices A1 and A2 are the effective features extracted by the deep neural network. These features can reflect all the features currently learned by the deep neural network. Among them, the features that have not yet been fully learned are included in D1 and D2.
[0069] Step S2: Obtain the relative position of the same feature vector and other feature vectors in the deep neural network before and after fusion, and obtain the feature stability of the feature vector based on the change in the relative position before and after fusion.
[0070] The eigenvector sets consisting of all row vectors of the low-rank matrix in the eigenvector matrices before and after fusion on each end are respectively referred to as SA1 and SA2. That is, the eigenvector set consisting of all row vectors of the low-rank matrix before fusion is SA1, and the eigenvector set consisting of all row vectors of the low-rank matrix after fusion is SA2. Each row in the low-rank matrices A1 and A2 represents a feature extracted by the deep neural network on different images, that is, each row is a eigenvector.
[0071] In the embodiment of the present invention, SA1 is the eigenvector set corresponding to the low-rank matrix A1, SA2 is the eigenvector set corresponding to the low-rank matrix A2, S1 is the eigenvector set corresponding to the eigenvector matrix M1, and S2 is the eigenvector set corresponding to the eigenvector matrix M2. Therefore, SA1 and S1 are both eigenvector sets, but the number of eigenvectors in the sets is different, that is, the eigenvector sets are different. Similarly, SA2 and S2 are different eigenvector sets.
[0072] In the embodiment of the present invention, the number of feature vectors in the feature vector sets S1 and S2 is the same, and the number of feature vectors in the feature vector sets SA1 and SA2 is the same.
[0073] The method of obtaining the relative position is: take the nth image and the mth image in the feature vector set corresponding to the low-rank matrix as an example. If the feature vector extracted by the first deep neural network on the nth image is v1 n , the feature vector extracted on the mth image is v1 m , that is, v1 n is the nth eigenvector in the eigenvector set SA1 corresponding to the low-rank matrix A1, v1 m is the mth eigenvector in the eigenvector set SA1 corresponding to the low-rank matrix A1, then v1 n Compared with v1 m The relative position is Δv1 mn :
[0074] Δv1 mn =v1 m -v1 n
[0075] Among them, Δv1 mn is the relative position of the mth eigenvector and the nth eigenvector in the eigenvector set SA1 corresponding to the low rank matrix A1.
[0076] Similarly, if the feature vector extracted by the second deep neural network on the nth image is v2 n , the feature vector extracted on the mth image is v2 m , that is, v2 n is the nth eigenvector in the eigenvector set SA2 corresponding to the low-rank matrix A2, v2m is the mth eigenvector in the eigenvector set SA2 corresponding to the low-rank matrix A2, then v2 n With v2 m The relative position is Δv1 mn :
[0077] Δv2 mn =v2 m -v2 n
[0078] Among them, Δv2 mn is the relative position of the mth eigenvector and the nth eigenvector in the eigenvector set SA2 corresponding to the low rank matrix A2.
[0079] The relative position of each eigenvector to other eigenvectors is obtained by the relative position acquisition method.
[0080] The method for obtaining the characteristic stability of the eigenvector is to obtain the characteristic stability An of the eigenvector by analyzing the changes in the relative positions of the same eigenvector and other eigenvectors in the deep neural network before and after fusion:
[0081]
[0082] Among them, A n is the characteristic stability of the nth eigenvector, ‖Δv2 mn -Δv1 mn ‖2 is the change in the relative position of the nth and mth eigenvectors in the deep neural network before and after fusion, γ is the feature stability parameter, N is the number of eigenvectors in the eigenvector set SA1, and m is the mth eigenvector in the eigenvector set SA1. Since the number of eigenvectors in the eigenvector sets SA1 and SA2 is the same, m is also the mth eigenvector in the eigenvector set SA2.
[0083] In the embodiment of the present invention, the characteristic stability parameter γ is set to 10, and in other embodiments, the value can be set according to requirements.
[0084] A n The larger the value, the smaller the change in the relative position of the nth eigenvector extracted by the fused deep neural network relative to other eigenvectors compared to the nth eigenvector extracted by the deep neural network before fusion, that is, the more stable the nth eigenvector. The characteristic stability degree is the change in the relative position of the eigenvectors. The larger the characteristic stability degree, the more stable it is, indicating that the deep neural network before and after fusion does not introduce abnormal parameters that cause significant changes in the nth eigenvector.
[0085] The feature stability degree corresponding to each feature vector is obtained by the feature stability acquisition method. If the deep neural network fusion process is completely correct, that is, the model parameters in the first deep neural network of all ends are trained parameters, the model parameters are very stable at this time, and the change in the same position before and after fusion is close to zero, that is, {A1, A2, ..., A n ,…,A N} are concentrated together and are close to 1; if the deep neural network fusion process is completely wrong, that is, the model parameters in the first deep neural network of all ends are random numbers, which include untrained parameters and trained parameters that have been tampered with by attacks. At this time, the model parameters are very unstable random numbers, and the changes in the same position before and after fusion are large, that is, {A1, A2, …, A n ,…,A N} are concentrated together and are close to 0; if {A1,A2,…,A n ,…,A N When} is a discrete distribution, an abnormal parameter is introduced in the deep neural network fusion process, that is, all uploaded parameters contain both correct parameters and incorrect parameters, and the abnormal parameter is a random number uploaded by one end.
[0086] Step S3: Obtain the difference between the same eigenvectors in the deep neural network before and after fusion, and obtain the accuracy vector of the eigenvector based on the difference and the degree of feature stability corresponding to the eigenvector.
[0087] The fused deep neural network should have higher feature extraction capability and the extracted feature vector should be close to the expected value.
[0088] The method for obtaining the trend vector is as follows: taking the nth eigenvector as an example, obtain the nth eigenvector v1 in the deep neural network before fusion n And the nth feature vector v2 in the fused deep neural network n , the mean of all vectors in the eigenvector set SA1 As the expected value of the deep neural network, the difference between the expected value and the nth eigenvector in the deep neural network before fusion is obtained as the standard deviation value, and the first eigenvalue of the nth eigenvector is obtained according to the difference between the standard deviation value and the nth eigenvector in the deep neural network before and after fusion.
[0089]
[0090] in, is the first eigenvalue of the nth eigenvector, for The unit vector of is the expected value of the deep neural network. Represents a vector (v2 n -v1 n )exist The larger the first eigenvalue, the closer the eigenvector in the fused deep neural network is to the expected value than the eigenvector in the deep neural network before fusion. That is, the features extracted after the deep neural network fusion are more accurate and closer to the expected value.
[0091] The characteristic stability of the nth eigenvector is used as the second eigenvalue of the nth eigenvector
[0092]
[0093] Combine the first eigenvalue of the nth eigenvector and the second eigenvalue of the nth eigenvector to obtain the trend vector of the nth eigenvector
[0094]
[0095] Step S4: classify the trend vectors to obtain a multi-category trend vector set, and select a category set whose trend vector mean is greater than the trend threshold in the trend vector set as the correct category set.
[0096] The accuracy vector corresponding to each feature vector in the feature vector set SA1 is obtained by the accuracy vector acquisition method in step S3. All accuracy vectors are clustered according to mean shift clustering to obtain multiple categories of accuracy vector sets. The accuracy vectors in each category of accuracy vector sets have high similarity, and each category of accuracy vector sets represents the accuracy state of a feature vector.
[0097] The correct category set is obtained by calculating the mean of all the trend vectors in each category of trend vector sets, setting a trend threshold, and selecting the category set corresponding to all means greater than the trend threshold as the correct category set. The eigenvectors corresponding to the trend vectors in this correct category set are highly stable and close to the expected value.
[0098] Step S5: Select any two correct category sets to obtain corresponding distribution differences; take the mean of all distribution differences as the feature accuracy distribution difference.
[0099] The method for obtaining the distribution difference of feature accuracy is as follows: select any two correct category sets in step S4 and obtain the data distribution difference of the two correct category sets using the maximum mean difference algorithm. The larger the result value of the algorithm, the greater the data distribution difference of the two correct category sets. The maximum mean difference algorithm maximizes the expected distribution of the two data in the high-dimensional space by projecting the data of the two categories using the same mapping relationship into the high-dimensional space. This maximum value is the maximum mean difference of the two data distributions, that is, the distribution difference.
[0100] The distribution differences of all correct category sets are obtained, and the mean of all distribution differences is used as the feature convergence distribution difference ρ. This feature convergence distribution difference is the distribution difference of feature vectors in different convergence states. A smaller value of this feature convergence distribution difference indicates a more consistent distribution of feature vectors in different convergence states. It also indicates that the features extracted by the fused deep neural network tend to the expected value more stably than the features extracted by the deep neural network before fusion, and that these features have the same distribution pattern. There is no situation where some feature vectors all tend to one convergence state, while others all tend to another convergence state.
[0101] Step S6: The accuracy is obtained by combining the feature accuracy distribution difference and the mean of the module lengths of all the accuracy vectors in the correct category set.
[0102] The accuracy is obtained by obtaining the average value of the modulus lengths of all the accuracy vectors in all the correct category sets in step S4 as the feature accuracy. The greater the feature accuracy, the more accurate the features extracted by the second deep neural network. The accuracy R of the second deep neural network is obtained based on the feature accuracy and the difference in the feature accuracy distribution in step S5:
[0103]
[0104] Where F is the degree of feature accuracy, and exp() is an exponential function. A larger accuracy R indicates a smaller difference in the distribution of feature accuracy extracted by the deep neural network before and after fusion, and a higher degree of feature accuracy.
[0105] Step S7: Obtain the abnormality of the second deep neural network according to the accuracy.
[0106] An accuracy threshold is established, and the accuracy threshold has different values according to different embodiments.
[0107] When the accuracy of all terminals is greater than or equal to the accuracy threshold, steps S1 to S7 are repeated until the deep neural networks of all terminals converge.
[0108] When any one or more of the accuracy levels of all terminals is less than the accuracy threshold, it indicates that abnormal model parameters have been introduced into the deep neural network after fusion by the central server. At this time, all terminals no longer train the second deep neural network through their respective training sets and issue a second deep neural network abnormality signal.
[0109] Step S8: After obtaining the abnormality of the second deep neural network according to the accuracy, further confirm the abnormal end and obtain the correct second deep neural network.
[0110] When an abnormal signal of the second deep neural network is detected, the central server shares the first deep neural network of all terminals with all terminals. At this time, each terminal contains the first deep neural network of its own terminal and other terminals. Each terminal calculates the accuracy of all first deep neural networks through its own test set. At this time, each terminal contains the accuracy of the first deep neural network of any terminal. Each terminal uploads all its own accuracy to the central server. At this time, the central server contains multiple groups of accuracy sets, each group is the accuracy set of all terminals for that terminal, and the median of all accuracy rates in each group is selected as the final accuracy rate. The set corresponding to the final accuracy rate greater than the final accuracy rate threshold, that is, the corresponding terminal, is selected as the correct terminal. The model parameters of all correct terminals are fused to obtain the third deep neural network, and the third deep neural network is used to replace the second deep neural network in steps S1 to S7. Steps S1 to S7 are repeated until the deep neural networks of all terminals converge.
[0111] In the embodiment of the present invention, the final accuracy threshold is set to 0.4. In other embodiments, the value can be adjusted according to needs.
[0112] During the federated learning process, if the final accuracy of a certain end is less than the final accuracy threshold for three or more consecutive times, it indicates that the data set of this end is abnormal. In this case, the model parameters of this end will be removed in subsequent training, that is, it will no longer participate in fusion. The remaining ends will participate in federated learning normally until the deep neural networks of the remaining ends converge.
[0113] To sum up, the embodiment of the present invention obtains the deep neural network before and after fusion through federated learning, obtains the stability of each eigenvector in the deep neural network after fusion by the relative position difference of the eigenvectors in the deep neural network before and after fusion, obtains the trend vector of each eigenvector in the deep neural network after fusion according to the stability and the difference of the eigenvectors in the deep neural network before and after fusion, obtains the accuracy of the deep neural network after fusion by the trend vector, detects the abnormality of the deep neural network after fusion according to the size of the accuracy, and if there is an abnormality, obtains the specific abnormal end through the final accuracy rate, and obtains the correct second deep neural network, thereby improving the accuracy of abnormality detection and ensuring the accuracy of model training.
[0114] An embodiment of the present invention further provides a distributed storage-based federated learning model training anomaly detection system, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the distributed storage-based federated learning model training anomaly detection method are implemented. The distributed storage-based federated learning model training anomaly detection method has been described in detail in the above embodiment and will not be repeated here.
[0115] It should be noted that the order in which the embodiments of the present invention are described above is for illustrative purposes only and does not represent the superiority or inferiority of the embodiments. The above description is of specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps described in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0116] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on the differences from other embodiments.
[0117] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for anomaly detection in federated learning model training based on distributed storage, characterized in that: The method comprises: Extracting feature vector matrices of a first deep neural network and a second deep neural network respectively; the first deep neural network is a deep neural network trained by each end before fusion; the second deep neural network is a deep neural network obtained by fusion of the first deep neural networks of all ends through a central server; Obtaining the relative position of the same feature vector and other feature vectors in the deep neural network before and after fusion, and obtaining the feature stability of the feature vector according to the change of the relative position before and after fusion; Obtaining a difference between the same feature vectors in the deep neural network before and after the fusion, and obtaining a trend vector of the feature vector according to the difference and the feature stability corresponding to the feature vector; Classifying the accuracy vectors to obtain a plurality of accuracy vector sets, and selecting a category set whose average accuracy vector value is greater than an accuracy threshold in the accuracy vector set as a correct category set; Select any two of the correct category sets to obtain corresponding distribution differences; take the mean of all the distribution differences as the characteristic trend distribution difference; The accuracy is obtained by combining the characteristic accuracy distribution difference and the mean of the modulus lengths of all the accuracy vectors in the correct category set; Obtaining an abnormality of the second deep neural network according to the accuracy; The step of obtaining the accuracy vector of the feature vector according to the difference and the feature stability corresponding to the feature vector comprises: Obtaining the mean of all feature vectors in the first deep neural network as the expected value of the deep neural network; Taking the difference between the expected value and each of the eigenvectors as the standard deviation value; Obtaining a first eigenvalue of the eigenvector according to a projection size of a difference value of the same eigenvector in the deep neural network before and after the fusion on the corresponding standard deviation value; Taking the characteristic stability degree corresponding to each of the characteristic vectors as the second eigenvalue of the characteristic vector; Acquire a trend vector of the eigenvector by combining the first eigenvalue and the second eigenvalue of the eigenvector; The calculation formula of the first eigenvalue includes: in, is the first eigenvalue of the nth eigenvector, for The unit vector of is the expected value of the deep neural network, v1 n represents the nth feature vector in the deep neural network before fusion, v2 n represents the nth eigenvector in the fused deep neural network, Represents a vector (v2 n -v1 n )exist The projection size on ; The step of obtaining the relative position of the same feature vector and other feature vectors in the deep neural network before and after the fusion, and obtaining the feature stability of the feature vector according to the change of the relative position before and after the fusion includes: Taking the difference between any two feature vectors in the deep neural network as the relative position of the feature vector; Calculate the sum of the relative positions of each feature vector and other feature vectors before and after fusion; The difference between the sum of the relative positions of the same feature vector and other feature vectors in the deep neural network before and after fusion is used as the change in the relative position of the feature vector before and after fusion; The characteristic stability of the characteristic vector is obtained according to the change situation, and the corresponding calculation formula includes: Among them, A n is the characteristic stability of the nth eigenvector, ||Δv2 mn -Δv1 mn ||2 is the change in the relative position of the nth eigenvector and the mth eigenvector in the deep neural network before and after fusion, γ is the feature stability parameter, N is the number of eigenvectors in the eigenvector set SA1, and m is the mth eigenvector in the eigenvector set SA1.
2. According to the method for detecting anomalies in federated learning model training based on distributed storage according to claim 1, it is characterized in that: The specific steps of respectively extracting the feature vector matrices of the first deep neural network and the second deep neural network include: Extracting the output feature maps of the last convolutional layer in the encoders of the first deep neural network and the second deep neural network respectively as the feature vectors; Obtain a set of feature vectors before and after fusion through all the feature vectors in the first deep neural network and the second deep neural network; The eigenvector matrix is obtained according to the eigenvector set.
3. According to the method for anomaly detection in federated learning model training based on distributed storage according to claim 1, it is characterized in that: The step of acquiring the first deep neural network comprises: Train deep neural networks on all terminals through federated learning; When the accuracy of the deep neural network is greater than an accuracy threshold, the deep neural network is the first deep neural network.
4. According to a method for detecting anomalies in federated learning model training based on distributed storage according to claim 1, it is characterized in that: The method for classifying the accuracy vectors is to classify the accuracy vectors according to mean shift clustering.
5. The method for detecting anomalies in federated learning model training based on distributed storage according to claim 1, characterized in that: The method for selecting any two of the correct category sets to obtain the corresponding distribution difference is to obtain the distribution difference of the feature vectors in any two of the correct category sets through the maximum mean difference.
6. The method for detecting anomalies in federated learning model training based on distributed storage according to claim 1, characterized in that: The step of obtaining the abnormality of the second deep neural network according to the accuracy comprises: When the accuracy of all terminals is greater than the accuracy threshold, the second deep neural network is normal; When the accuracy at either end is less than the accuracy threshold, the second deep neural network is abnormal.
7. The method for detecting anomalies in federated learning model training based on distributed storage according to claim 6, characterized in that: The step of further confirming the abnormal end and obtaining the correct second deep neural network after obtaining the abnormal situation of the second deep neural network according to the accuracy comprises: When the accuracy of any terminal is less than the accuracy threshold, the central server shares the first deep neural network of each terminal with all terminals; Each terminal calculates the accuracy of each of the first deep neural networks and uploads it to the central server to obtain an accuracy set; Select the median of each accuracy set as the final accuracy; Filter each set whose final accuracy is greater than the final accuracy threshold as the correct end; Fusing all the correct ends to obtain a third deep neural network; The second deep neural network is replaced by the third deep neural network as the correct second deep neural network.
8. A distributed storage-based federated learning model training anomaly detection system, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Target detection method and device based on a deep neural network
CN109919223A
Multi-wave seismic oil and gas reservoir prediction method based on deep neural network
CN112083498A
