Federal learning training method and system based on generative adversarial network
By introducing generative adversarial networks and self-attention mechanisms in federated learning, the problem of uneven data distribution is solved, the robustness and generalization capabilities of the model are improved, and data privacy is protected.
Patent Information
- Application Number
- CN202411385423.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-02-18
AI Technical Summary
The problem of uneven distribution of federal learning training data in the prior art leads to insufficient generalization ability of the model under different data distributions.
Using a federated learning training method based on a generative adversarial network, a self-attention mechanism is introduced by constructing and training a generative adversarial network, and a self-attention jump layer channel excitation module and a self-encoding discriminator module are designed to form federated learning based on a generative adversarial network. Model, realizes the diversification of data distribution and the robustness of the model.
By generating diverse data instances by generating adversarial networks, the long training time, accuracy loss and privacy leakage of traditional federated learning methods when data distribution is uneven, improve the robustness and generalization capabilities of the model, and protect the Data privacy.
Smart Images

Figure CN119476412A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of federated learning algorithms, and specifically relates to a federated learning training method and system based on a generative adversarial network. Background Art
[0002] With the rapid development of big data and artificial intelligence technologies, data collection, training, and analysis have become increasingly important. Traditional centralized machine learning methods require all data to be collected on a centralized server for training, which not only involves data transmission and storage costs, but also may lead to the risk of data leakage and abuse. Therefore, how to efficiently use data for model training while protecting data privacy has become an urgent problem to be solved.
[0003] The main research areas of federated learning algorithms are as follows:
[0004] 1. Federated Averaging Algorithm
[0005] Federated averaging (FedAvg) is a basic federated learning algorithm proposed by Google in 2016. The algorithm uses gradient descent to iteratively update model parameters. In the FedAvg algorithm, each client (e.g., a mobile phone or other device) first trains the model locally with its own data, and then sends the local model parameters to the central server. The central server collects the model parameter updates of all clients, calculates the average of the model parameters, and distributes the updated model parameters back to each client. This process is performed in multiple rounds until convergence is reached.
[0006] 2. Federated Heterogeneous Algorithm
[0007] The Federated proximal algorithm (Fedprox) is an improved federated learning algorithm used to solve the problems of non-independent and identically distributed (non-IID) data and device heterogeneity in federated learning. These problems can lead to a decline in training quality, especially when the training data is unevenly distributed. The Fedprox algorithm solves this problem by adding a proximal term to the optimization objective, which makes the model pay more attention to local model weights that are close to the global model weights when updating. This can alleviate the negative impact of non-independent and identically distributed data and device heterogeneity and improve model performance. The Fedprox algorithm introduces proximal terms and inexact solutions to limit model deviations caused by data heterogeneity. Each client no longer needs to train the same number of rounds, but only needs to obtain an inexact solution, which effectively alleviates the computing pressure on some devices.
[0008] 3. Federation Splitting Algorithm
[0009] The FedSplit algorithm is a data segmentation strategy under the federated learning framework, which aims to divide the original data set unevenly among multiple participants (or nodes) to optimize the training efficiency and performance of the model. The core idea of the FedSplit algorithm is to divide the data into different subsets according to the characteristics of the data, the computing power of the participants, and the task requirements, and assign these subsets to different participants for training.
[0010] 4. Federated Conditional Generative Adversarial Network Algorithm
[0011] Federated Conditional Generation (FedCG) is a conditional generation model training method under the framework of federated learning. The FedCG algorithm combines the advantages of federated learning and conditional generation models, aiming to use the data of multiple participants (or nodes) for efficient and accurate model training while protecting data privacy. The core idea of the FedCG algorithm is to use conditional generation models to learn and generate data under the framework of federated learning. The algorithm aims to use the data of multiple participants to collaboratively train a global conditional generation model while protecting the data privacy of each participant. A conditional generation model is a model that can generate corresponding data based on given conditions, such as generating images based on text descriptions or generating corresponding data samples based on labels. The FedCG algorithm combines the distributed characteristics of federated learning and the powerful generation ability of conditional generation models to achieve improved generalization performance of the model while protecting data privacy. In FedCG, each participant holds its own dataset and trains a conditional generation model locally. Summary of the invention
[0012] The technical problem to be solved by the present invention is to provide a federated learning training method and system based on a generative adversarial network, which solves the problem of uneven distribution of federated learning training data in the prior art.
[0013] The present invention adopts the following technical solutions to solve the above technical problems:
[0014] The federated learning training method based on the generative adversarial network includes the following steps:
[0015] Step 1: Build and train a generative adversarial network: The generative network is used to generate new data that is similar to the real data distribution, and the discriminative network is used to determine whether a given data instance is real or generated by the generative network. Through dynamic game training between the generative network and the discriminative network, the generative network generates new data that is similar to the real data.
[0016] Step 2: Introduce the self-attention mechanism: Introduce the self-attention mechanism in the generative adversarial network to capture the long-distance dependencies in the data;
[0017] Step 3: Design a self-attention skip channel excitation module and a self-encoding discriminator module, wherein the self-attention skip channel excitation module adjusts the parameters of the generation network through an automatic learning mechanism; the self-encoding discriminator module is used to optimize the performance of the discriminant network so that it can distinguish between real data and generated data;
[0018] Step 4: Construct a federated learning model based on a generative adversarial network. By combining the self-attention skip-layer channel excitation module and the self-encoding discriminator module, a federated learning model based on a generative adversarial network is formed.
[0019] Step 5: Federated learning: The central server combines the generative adversarial network with federated learning to share global model parameters among multiple clients. Each client uses its own dataset to train a local model, and then uploads the local model parameters to the central server for aggregation, and cyclically updates the global model parameters.
[0020] The specific process of generating adversarial networks is as follows:
[0021] Step 1.1: Data preparation: collect and preprocess the original data X suitable for GAN training, and initialize the parameters of the generator G and the discriminator D.
[0022] Step 1.2, the generator G generates synthetic data G(z), G receives random noise z as input, passes through a series of network layers, adds a learning enhancement module, and generates synthetic data G(z);
[0023] Step 1.3, the discriminator D determines the authenticity of the data. D receives the original data X and the synthetic data G(z) generated by the generator G as input, extracts features through a series of network layers, and determines whether the input data is real or synthetic. D outputs a probability value, indicating the possibility that the input data is real data;
[0024] Step 1.4: The training process is carried out in the order of normal propagation, loss calculation, and back propagation.
[0025] Step 1.5: Iterate training and repeat steps 1.2 to 1.4 until G can generate synthetic data that is close to the real data.
[0026] In step 1.4, in forward propagation, random noise z is input into G to generate G(z), and then G(z) and X are input into D together for identification; loss calculation, for D, the loss of real data being correctly classified and synthetic data being incorrectly classified is calculated, and for G, the loss of synthetic data generated by it being misclassified as real data by D is calculated; back propagation, according to the loss function, the parameters of G and D are updated through the optimization algorithm.
[0027] The specific process of training a local model is as follows:
[0028] Step a: Data preparation: Use the synthetic data generated by the generative adversarial network as the training set to preprocess the data;
[0029] Step b: model initialization, initializing the parameters of the local model;
[0030] Step c: training process: first, input the synthetic data into the local model, calculate the output of the model through forward propagation, then calculate the loss, and perform back propagation based on the loss, and finally, update the parameters of the local model to optimize the model performance;
[0031] Step d: Repeat the training process of step c until the model reaches the set target on the validation set.
[0032] In step 5, the specific process of federated learning is as follows:
[0033] Step 5.1: Upload model parameters. Each client uploads the trained local model parameters to the central server.
[0034] Step 5.2: Aggregate model parameters: The central server receives model parameters from each client, aggregates the model parameters using an aggregation algorithm, and generates global model parameters.
[0035] Step 5.3: Send global model parameters. The central server sends the aggregated global model parameters to each client.
[0036] Step 5.4, select the communication method. According to the system design and requirements, select synchronous or asynchronous communication method. In synchronous communication, all clients complete the upload before aggregation and distribution. In asynchronous communication, clients are allowed to upload and receive model parameters at any time.
[0037] The specific implementation process of the self-attention skip-layer channel excitation module is as follows:
[0038] The low-dimensional feature vector is input to the pooling layer, and the feature map is downsampled to 4×4 size through the pooling layer, and then downsampled to 1×1 size through a 1×1 convolution kernel;
[0039] Then use the activation function LeakyRelu() for nonlinear operation;
[0040] Finally, use a 1×1 convolution kernel to transform the low-dimensional x low With high dimension x high The dimension of the input feature map remains consistent;
[0041] After using the Sigmoid() function, a self-attention mechanism is added to enable the module to establish global dependencies and extract features from the input image;
[0042] The output of the final feature is multiplied by x along the channel dimension high , and get high Output Y of the same size.
[0043] The self-attention skip-layer channel excitation module is expressed by the following formula:
[0044] S=E(X low ,{w i})X high
[0045] Among them, x low and x high Represent low-dimensional and high-dimensional feature maps respectively, as the input feature map of SLEA, S is the output feature map of SLEA; E is the feature map of x low The function w that performs the operation loi are model parameters.
[0046] The specific implementation process of the self-encoding discriminator module is as follows:
[0047] The attention module models the dependencies across a large range of multi-level image regions, establishes global dependencies, expands the receptive field of the image, and allows the discriminator to determine the structure of the global image;
[0048] The decoder and the discriminator jointly optimize and train the reconstruction loss on real samples, which can be formally expressed as:
[0049]
[0050] Among them, f is the intermediate feature map of the discriminator D, the function Y contains the convolution processing of f and the decoder, and the function T represents the convolution from the real image I real The cropping and extraction of sample x in D encode(x) represents the value of the encoder on the discriminator, F represents the operation on the feature map, and R represents the final reconstruction result;
[0051] The discriminator D is used as an encoder to extract features from the real image and input them into the decoder. The decoder reconstructs the image based on the features, so that the discriminator D can learn accurate global and local features. Among them, the discriminator D only performs decoding operations on the feature map f1 (16×16) and the feature map f2 (16×16).
[0052] The decoder consists of 4 convolutional layers to reconstruct high-resolution images. The decoder first randomly crops 1 / 6 of the height and width of f1, and then crops the real image of the same part to obtain I part ;
[0053] Resize the real image to the desired size to obtain I;
[0054] The decoder then obtains I′ from the pruned f1 by downsampling part , and then downsample from f2 to get I′;
[0055] Finally, I′ part ,I part Matched with I′ and I, input into the discriminator and trained together with the decoder.
[0056] A federated learning system based on a generative adversarial network includes a central server and several clients; wherein the central server includes a federated learning module, receives local models from clients, aggregates them into a global model, and sends the optimal parameters of the global model to the clients;
[0057] The client includes a self-attention skip-layer channel excitation module and a self-encoding discriminator module. The self-attention skip-layer channel excitation module adjusts the parameters of the generation network through an automatic learning mechanism; the self-encoding discriminator module optimizes the performance of the discriminant network and distinguishes between real data and generated data.
[0058] Compared with the prior art, the present invention has the following beneficial effects:
[0059] 1. Combining generative adversarial networks with federated learning overcomes the problems of long training time, accuracy loss, and privacy leakage in traditional federated learning methods when processing large amounts of data.
[0060] 2. The introduction of self-attention mechanism and the design of SLEA and SCD modules improve the robustness and feature extraction ability of the model, making the generated data instances more realistic.
[0061] 3. While protecting data privacy, it realizes efficient training models and provides strong support for the development of big data and artificial intelligence.
[0062] 4. This solution can be widely used in distributed medical image analysis, distributed anomaly detection, privacy-preserving image generation and other fields. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] Figure 1 Generate an adversarial network flow chart for the present invention.
[0064] Figure 2 This is the system architecture of the present invention.
[0065] Figure 3 It is a structural diagram of the SLEA of the present invention.
[0066] Figure 4 It is a structural diagram of the SCD of the present invention. DETAILED DESCRIPTION
[0067] The structure and working process of the present invention will be further described below in conjunction with the accompanying drawings.
[0068] The combination of federated learning and generative adversarial networks can solve the problem of uneven data distribution. In practical applications, data distribution may differ between different devices or organizations, which may result in the trained model not being able to adapt to all data distributions. The diverse samples generated by GAN can simulate different data distributions, allowing the federated learning model to be trained on a wider range of data distributions, which not only improves the generalization ability of the model, but also makes the model more robust and more resistant to noise and outliers. This GAN-based federated learning algorithm not only improves the prediction accuracy and robustness of the model, but also reduces the dependence on data labels, providing strong support for the promotion of federated learning in practical applications. With the continuous advancement of technology, the combination of GAN and federated learning will bring more impressive results in the future.
[0069] The present invention combines federated learning with generative adversarial networks, adds two modules, Skip Layer channelwise Excitation with self-Attention (SLEA) and Self-supervised Discriminator (SCD), to the generative adversarial network, and proposes a federated learning algorithm based on SLEA and SCD (FEDSAC). The FEDSAC algorithm aims to improve the efficiency and accuracy of data processing and learning to meet the urgent need for efficient and accurate learning in modern big data environments. In order to verify the effectiveness of the FEDSAC algorithm, the present invention has carried out detailed experiments on five image datasets: FMNIST, Digit5, Cifare10, Office-Caltech10 and DomainNet. The experimental results show that compared with the original algorithm, the FEDSAC algorithm has achieved significant improvement in prediction accuracy. Whether on a large handwritten digit recognition dataset such as FMNIST or a small handwritten digit recognition dataset such as Digit5, the algorithm of the present invention has shown superior performance. In addition, the FEDSAC algorithm also showed excellent prediction capabilities on complex color image datasets such as Cifare10. And on Office-Caltech10 and DomainNet, two datasets involving cross-domain learning, the algorithm of the present invention also showed excellent performance, proving its stability and effectiveness in different scenarios. In addition to the improvement in prediction accuracy, the FEDSAC algorithm has also achieved significant optimization in running time. By optimizing the algorithm structure and reducing redundant calculations, the algorithm of the present invention can complete the training process in a shorter time, thereby improving learning efficiency. This is of great significance for the processing of large-scale data sets and the completion of real-time learning tasks.
[0070] The federated learning training method based on the generative adversarial network includes the following steps:
[0071] Step 1: Build and train a generative adversarial network: The generative network is used to generate new data that is similar to the real data distribution, and the discriminative network is used to determine whether a given data instance is real or generated by the generative network. Through dynamic game training between the generative network and the discriminative network, the generative network generates new data that is similar to the real data.
[0072] Step 2: Introduce the self-attention mechanism: Introduce the self-attention mechanism in the generative adversarial network to capture the long-distance dependencies in the data;
[0073] Step 3: Design a self-attention skip channel excitation module and a self-encoding discriminator module, wherein the self-attention skip channel excitation module adjusts the parameters of the generation network through an automatic learning mechanism; the self-encoding discriminator module is used to optimize the performance of the discriminant network so that it can distinguish between real data and generated data;
[0074] Step 4: Construct a federated learning model based on a generative adversarial network. By combining the self-attention skip-layer channel excitation module and the self-encoding discriminator module, a federated learning model based on a generative adversarial network is formed.
[0075] Step 5: Federated learning: The central server combines the generative adversarial network with federated learning to share global model parameters among multiple clients. Each client uses its own dataset to train a local model, and then uploads the local model parameters to the central server for aggregation, and cyclically updates the global model parameters.
[0076] Specific embodiments, such as Figures 1 to 4 As shown,
[0077] The efficient federated learning training method based on generative adversarial networks can be divided into: building a generative adversarial network, introducing a self-attention mechanism, designing SLEA and SCD, combining federated learning, and proposing a FEDSAC algorithm.
[0078] 1. Build a generative adversarial network: The generative network is responsible for generating new data that is similar to the real data distribution, and the discriminative network is responsible for judging whether a given data instance is real or generated by the generative network.
[0079] The specific process of generating adversarial networks is as follows:
[0080] Step 1.1: Data preparation: collect and preprocess the original data X suitable for GAN training, and initialize the parameters of the generator G and the discriminator D.
[0081] Step 1.2, the generator G generates synthetic data G(z). G receives random noise z as input, passes through a series of network layers, adds a learning enhancement module, and generates synthetic data G(z).
[0082] Step 1.3, the discriminator D determines the authenticity of the data. D receives the original data X and the synthetic data G(z) generated by the generator G as input, extracts features through a series of network layers, and determines whether the input data is real or synthetic. D outputs a probability value, indicating the possibility that the input data is real data.
[0083] Step 1.4, training process, training is carried out in the order of normal propagation, loss calculation, and back propagation; in forward propagation, random noise z is input into G to generate G(z), and then G(z) and X are input into D together for identification; in loss calculation, for D, the loss of real data being correctly classified and synthetic data being misclassified is calculated, and for G, the loss of synthetic data generated by it being misclassified as real data by D is calculated; in back propagation, according to the loss function, the parameters of G and D are updated through the optimization algorithm.
[0084] Step 1.5: Iterate training and repeat steps 1.2 to 1.4 until G can generate synthetic data that is close to the real data.
[0085] Through the dynamic game between the generative network and the discriminative network during the training process, the generative network can generate new data instances that are very similar to the real data, such as Figure 1 shown.
[0086] The generator takes the noise data as input, obtains the feature map after training, and outputs the feature map to the discriminator. If the quality of the input feature meets the quality requirements of the real sample, the output is 1. The output is a "true" or "false" label. If it is true, it means that the image generated by the generator has fooled the discriminator. Otherwise, the internal parameters of the generator are adjusted according to this loss. This training process is also the same as the previous supervised learning training method. The discriminator parameters here cannot be changed, only the internal parameters of the generator can be changed, because this is the process of training the generator, not training the discriminator; and the label is: "True", the purpose is to make the image generated by the generator look more realistic.
[0087] 2. Introduce self-attention mechanism: Introduce self-attention mechanism in generative adversarial network to improve the robustness and feature extraction ability of the model. The self-attention mechanism can capture long-distance dependencies in the data and help generate more realistic data instances.
[0088] 3. Design the self-attention skip channel excitation module SLEA and the self-encoding discriminator module SCD: The SLEA module adjusts the parameters of the generation network through an automatic learning mechanism to improve the quality of the generated data. The SCD module is used to optimize the performance of the discriminant network so that it can more accurately distinguish between real data and generated data, such as Figure 2 , 3 shown.
[0089] The server of the system model distributes the randomly initialized model structure and parameters to the clients. Each client uses local data to train the model and uploads the trained model parameters to the server. The dashed box is the global model aggregated by the server. After the server aggregates the model parameters of each client, it updates the global model and sends it to each client for training again. This process repeats until the model converges or the training is terminated.
[0090] First, the feature map is input into the module, and the feature map is downsampled to 4×4 size after passing through the pooling layer, and then downsampled to 1×1 size through a 1×1 convolution kernel, and then the activation function LeakyRelu() is used for nonlinear operation, and finally the low-dimensional x is convolved with a 1×1 convolution kernel. low With high dimension x high The dimension of the input feature map remains the same; after using the Sigmoid() function, a self-attention mechanism is added to this module. The self-attention mechanism enables the module to establish global dependencies, expand the receptive field of the image, and extract features from the input image in more detail. Finally, the output of the feature is multiplied by x along the dimension of the channel. high , and get high The output Y has the same size. The SLEA in the generator structure enables the network to inherit the advantages of ResBlock's fast gradient flow while not requiring a lot of computation. The formal definition of the SLEA module is:
[0091] S=E(X low ,{w i})X high (1)
[0092] Among them, x low and x high Represent low-dimensional and high-dimensional feature maps respectively, as the input feature map of SLEA, S is the output feature map of SLEA; E is the feature map of x low The function w that performs the operation loi are model parameters.
[0093] The specific implementation process of the self-encoding discriminator module is as follows:
[0094] The attention module is a supplement to the convolution. It can help the convolution model the dependency relationship across a large range of multi-level image regions, establish global dependencies, expand the receptive field of the image, and also enable the discriminator to better judge the structure of the global image. The decoder and the discriminator optimize and train the reconstruction loss on real samples, which can be formally expressed as:
[0095]
[0096] Where f is the intermediate feature map of the discriminator D, the function Y contains the convolution processing of f and the decoder, the function T represents the cropping and extraction processing of the sample x from the real image Ireal, Dencode(x) represents the value of the encoder on the discriminator, F represents the operation on the feature map, and R represents the final reconstruction result.
[0097] 4. Combined with federated learning: Combine generative adversarial networks with federated learning, and use the distributed characteristics of federated learning to share model parameters among multiple participants while protecting data privacy.
[0098] The specific process of training a local model is as follows:
[0099] Step a: Data preparation: Use the synthetic data generated by the generative adversarial network as the training set to preprocess the data;
[0100] Step b: model initialization, initializing the parameters of the local model;
[0101] Step c: training process: first, input the synthetic data into the local model, calculate the output of the model through forward propagation, then calculate the loss, and perform back propagation based on the loss, and finally, update the parameters of the local model to optimize the model performance;
[0102] Step d: Repeat the training process of step c until the model reaches the set target on the validation set.
[0103] The specific process of federated learning is as follows:
[0104] Step 5.1: Upload model parameters. Each client uploads the trained local model parameters to the central server.
[0105] Step 5.2: Aggregate model parameters: The central server receives model parameters from each client, aggregates the model parameters using an aggregation algorithm, and generates global model parameters.
[0106] Step 5.3: Send global model parameters. The central server sends the aggregated global model parameters to each client.
[0107] Step 5.4, select the communication method. According to the system design and requirements, select synchronous or asynchronous communication method. In synchronous communication, all clients complete the upload before aggregation and distribution. In asynchronous communication, clients are allowed to upload and receive model parameters at any time.
[0108] Each participant trains a local model using their own dataset and then uploads the model parameters to the central server for aggregation to update the global model, e.g. Figure 4 shown.
[0109] The square box and arrow represent the same residual downsampling structure, and the dotted box represents the same decoder structure. The present invention regards the discriminator D as an encoder and uses a small decoder to assist in training. The encoder extracts features from the real image, which are input into the decoder and required to reconstruct the image based on the features. This forces D to learn accurate global and local features. The discriminator D only performs decoding operations on the feature map f1 (16×16) and the feature map f2 (16×16). The decoder consists of 4 convolutional layers, which are used to reconstruct high-resolution images to reduce the amount of calculation. The decoder first randomly crops 1 / 6 of the height and width of f1, and then crops the real image of the same part to obtain I part The real image is resized to the desired size to obtain I. The decoder then obtains I′ from the cropped f1 by downsampling part , and then downsample from f2 to get I′. Finally, I′ part ,I part Matched with I′ and I, the input is fed into the discriminator and trained together with the decoder to minimize the loss.
[0110] 5. Propose a federated learning algorithm FEDSAC based on SLEA and SCD: By combining the SLEA and SCD modules, a federated learning method based on generative adversarial networks is implemented. While protecting data privacy, the training efficiency and performance of the model are improved.
[0111] The above description is only a specific implementation mode of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or substitutions within the technical scope disclosed by the present invention, and these modifications or substitutions should be included in the protection scope of the present invention.
[0112] A federated learning system based on a generative adversarial network includes a central server and several clients; wherein the central server includes a federated learning module, receives local models from clients, aggregates them into a global model, and sends the optimal parameters of the global model to the clients;
[0113] The client includes a self-attention skip-layer channel excitation module and a self-encoding discriminator module. The self-attention skip-layer channel excitation module adjusts the parameters of the generation network through an automatic learning mechanism; the self-encoding discriminator module optimizes the performance of the discriminant network and distinguishes between real data and generated data.
[0114] If the above functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program code.
[0115] It should be understood that the present solution is not limited to the above-mentioned specific implementation methods, and the devices and structures not described in detail should be understood to be implemented in a common manner in the art; any technician familiar with the art can use the above-disclosed methods and technical contents to make many possible changes and modifications to the technical solution of the present solution without departing from the scope of the technical solution of the present solution, or modify it into an equivalent embodiment with equivalent changes, which does not affect the essential content of the present solution. Therefore, any simple modification, equivalent change and modification made to the above embodiments based on the technical essence of the present solution without departing from the content of the technical solution of the present solution still falls within the scope of protection of the technical solution of the present solution.
Claims
1. A federated learning training method based on a generative adversarial network, characterized by: The steps include: Step 1: Build and train a generative adversarial network: The generative network is used to generate new data that is similar to the real data distribution, and the discriminative network is used to determine whether a given data instance is real or generated by the generative network. Through dynamic game training between the generative network and the discriminative network, the generative network generates new data that is similar to the real data. Step 2: Introduce the self-attention mechanism: Introduce the self-attention mechanism in the generative adversarial network to capture the long-distance dependencies in the data; Step 3: Design a self-attention skip channel excitation module and a self-encoding discriminator module, wherein the self-attention skip channel excitation module adjusts the parameters of the generation network through an automatic learning mechanism; the self-encoding discriminator module is used to optimize the performance of the discriminant network so that it can distinguish between real data and generated data; Step 4: Construct a federated learning model based on a generative adversarial network. By combining the self-attention skip-layer channel excitation module and the self-encoding discriminator module, a federated learning model based on a generative adversarial network is formed. Step 5: Federated learning: The central server combines the generative adversarial network with federated learning to share global model parameters among multiple clients. Each client uses its own dataset to train a local model, and then uploads the local model parameters to the central server for aggregation, and cyclically updates the global model parameters.
2. The federated learning training method based on generative adversarial network according to claim 1, characterized in that: The specific process of generating adversarial networks is as follows: Step 1.1: Data preparation: collect and preprocess the original data X suitable for GAN training, and initialize the parameters of the generator G and the discriminator D. Step 1.2, the generator G generates synthetic data G(z), G receives random noise z as input, passes through a series of network layers, adds a learning enhancement module, and generates synthetic data G(z); Step 1.3, the discriminator D determines the authenticity of the data. D receives the original data X and the synthetic data G(z) generated by the generator G as input, extracts features through a series of network layers, and determines whether the input data is real or synthetic. D outputs a probability value, indicating the possibility that the input data is real data; Step 1.4: The training process is carried out in the order of normal propagation, loss calculation, and back propagation. Step 1.5: Iterate training and repeat steps 1.2 to 1.4 until G can generate synthetic data that is close to the real data.
3. The method for training federated learning based on generative adversarial networks according to claim 2, characterized in that: In step 1.4, in forward propagation, random noise z is input into G to generate G(z), and then G(z) and X are input into D together for identification; loss calculation, for D, the loss of real data being correctly classified and synthetic data being incorrectly classified is calculated, and for G, the loss of synthetic data generated by it being misclassified as real data by D is calculated; back propagation, according to the loss function, the parameters of G and D are updated through the optimization algorithm.
4. The method for training federated learning based on a generative adversarial network according to claim 3, characterized in that: The specific process of training a local model is as follows: Step a: Data preparation: Use the synthetic data generated by the generative adversarial network as the training set to preprocess the data; Step b: model initialization, initializing the parameters of the local model; Step c: training process: first, input the synthetic data into the local model, calculate the output of the model through forward propagation, then calculate the loss, and perform back propagation based on the loss, and finally, update the parameters of the local model to optimize the model performance; Step d: Repeat the training process of step c until the model reaches the set target on the validation set.
5. The method for training federated learning based on generative adversarial networks according to claim 1, characterized in that: In step 5, the specific process of federated learning is as follows: Step 5.1: Upload model parameters. Each client uploads the trained local model parameters to the central server. Step 5.2: Aggregate model parameters: The central server receives model parameters from each client, aggregates the model parameters using an aggregation algorithm, and generates global model parameters. Step 5.3: Send global model parameters. The central server sends the aggregated global model parameters to each client. Step 5.4, select the communication method. According to the system design and requirements, select synchronous or asynchronous communication method. In synchronous communication, all clients complete the upload before aggregation and distribution. In asynchronous communication, clients are allowed to upload and receive model parameters at any time.
6. The method for federated learning training based on generative adversarial networks according to claim 1, characterized in that: The specific implementation process of the self-attention skip-layer channel excitation module is as follows: The low-dimensional feature vector is input to the pooling layer, and the feature map is downsampled to 4×4 size through the pooling layer, and then downsampled to 1×1 size through a 1×1 convolution kernel; Then use the activation function LeakyRelu() for nonlinear operation; Finally, use a 1×1 convolution kernel to transform the low-dimensional x low With high dimension x gigh The dimension of the input feature map remains consistent; After using the Sigmoid() function, a self-attention mechanism is added to enable the module to establish global dependencies and extract features from the input image; The output of the final feature is multiplied by x along the channel dimension high , and get high Output Y of the same size.
7. The method for training federated learning based on generative adversarial networks according to claim 6, characterized in that: The self-attention skip-layer channel excitation module is expressed by the following formula: S=E(X low ,{w i })X high Among them, x low and x high Represent low-dimensional and high-dimensional feature maps respectively, as the input feature map of SLEA, S is the output feature map of SLEA; E is the feature map of x low The function w that performs the operation loi are model parameters.
8. The method for federated learning training based on generative adversarial networks according to claim 1, characterized in that: The specific implementation process of the self-encoding discriminator module is as follows: The attention module models the dependencies across a large range of multi-level image regions, establishes global dependencies, expands the receptive field of the image, and allows the discriminator to determine the structure of the global image; The decoder and the discriminator jointly optimize and train the reconstruction loss on real samples, which can be formally expressed as: Among them, f is the intermediate feature map of the discriminator D, the function Y contains the convolution processing of f and the decoder, and the function T represents the convolution from the real image I real The cropping and extraction of sample x in D encode(x) represents the value of the encoder on the discriminator, F represents the operation on the feature map, and R represents the final reconstruction result; The discriminator D is used as an encoder to extract features from the real image and input them into the decoder. The decoder reconstructs the image based on the features, so that the discriminator D can learn accurate global and local features. Among them, the discriminator D only performs decoding operations on the feature map f1 (16×16) and the feature map f2 (16×16).
9. The method for federated learning training based on generative adversarial networks according to claim 8, characterized in that: The decoder consists of 4 convolutional layers to reconstruct high-resolution images. The decoder first randomly crops 1 / 6 of the height and width of f1, and then crops the real image of the same part to obtain I part ; Resize the real image to the desired size to obtain I; The decoder then obtains I′ from the pruned f1 by downsampling part , and then downsample from f2 to get I′; Finally, I′ part ,I part Matched with I′ and I, input into the discriminator and trained together with the decoder.
10. A federated learning system based on generative adversarial networks, characterized by: It includes a central server and several clients; the central server includes a federated learning module, which receives the local models of the clients, aggregates them into a global model, and sends the optimal parameters of the global model to the clients; The client includes a self-attention skip-layer channel excitation module and a self-encoding discriminator module. The self-attention skip-layer channel excitation module adjusts the parameters of the generation network through an automatic learning mechanism; the self-encoding discriminator module optimizes the performance of the discriminant network and distinguishes between real data and generated data.
Citation Information
Cited By
Industrial equipment fault diagnosis method in data heterogeneous environment based on adversarial federated learning
CN121092933A
An industrial equipment fault diagnosis method in a data heterogeneous environment based on adversarial federated learning
CN121092933B