Personalized federal learning method and system
By introducing the scSE attention mechanism into the GAN model, the problem of heterogeneous data processing in personalized federated learning is solved, the performance and efficiency of the model are improved, and better image generation effect is achieved.
Patent Information
- Application Number
- CN202411385509.2
- 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
In personalized federated learning, traditional GAN models have difficulty in effectively processing heterogeneous data, resulting in poor performance of generated images in authenticity, clarity, and diversity.
A scSE attention mechanism is introduced, and it is added to the GAN generator and discriminator. The feature map is processed through the cSE module, sSE module and scSE module to enhance the model's attention to data and feature representation ability.
By emphasizing key features and suppressing useless features, the performance and efficiency of the model are improved, the authenticity and diversity of generated data are improved, and the generalization ability and adaptability of the model are enhanced.
Smart Images

Figure CN119476414A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the fields of artificial intelligence, deep learning and federated learning, and specifically relates to a personalized federated learning method and system. Background Art
[0002] Federated learning, as a cutting-edge distributed machine learning architecture, enables multiple data holders to jointly train models without directly sharing the original data.
[0003] As an outstanding generative model, Generative Adversarial Network (GAN) has achieved remarkable achievements in fields such as image and text generation.
[0004] However, in the context of personalized federated learning, traditional GAN models have encountered challenges in the face of the heterogeneity of participant data. Although the self-attention mechanism has been successfully applied to GAN, significantly improving its performance and efficiency, and improving the authenticity, clarity and diversity of generated images, in the scenario of personalized federated learning, this enhanced GAN model still needs to face the problems brought by heterogeneous data.
[0005] Since personalized federated learning involves multiple participants with different datasets, which may differ significantly in distribution and characteristics, GANs that rely solely on self-attention mechanisms are unable to cope with heterogeneous data.
[0006] In addition, although the self-attention mechanism has shown great potential in GAN, its versatility and applicability in other deep learning models still need to be improved.
[0007] In order to fully realize the potential of the self-attention mechanism in federated learning, it is necessary to conduct in-depth research and solve the problem of heterogeneous data, and explore how to apply the mechanism more effectively to other deep learning models. This requires the development of more advanced data preprocessing and feature alignment techniques, as well as the design of more flexible and universal model architectures. Through these efforts, it is expected that the challenges in personalized federated learning will be overcome and the application of the self-attention mechanism in a wider range of deep learning fields will be promoted. Summary of the invention
[0008] The technical problem to be solved by the present invention is to provide a personalized federated learning method and system, which solves the problem of heterogeneous data in personalized federated learning in the prior art.
[0009] The present invention adopts the following technical solutions to solve the above technical problems:
[0010] A personalized federated learning method introduces the scSE attention mechanism and adds the scSE attention mechanism to the generator and discriminator of GAN. The specific steps include:
[0011] Step 1: Build a personalized federated learning model including cSE module, sSE module and scSE module;
[0012] Step 2: The cSE module processes the input feature map to obtain more detailed global features of the feature map;
[0013] Step 3: The sSE module processes the input feature map to obtain more detailed local feature information in the feature map;
[0014] Step 4: Add the two results obtained in step 2 and step 3 along the channel dimension. The scSE module processes the feature map and outputs the final feature map data.
[0015] In step 1, the specific steps for building a personalized federated learning model are as follows:
[0016] Step 1.1, GAN training, the original data X is passed to the generator G, G generates synthetic data G(z); the synthetic data and the original data are passed to the self-encoding discriminator D, the self-encoding discriminator D identifies the quality of the synthetic data and outputs the synthetic data according to the discrimination result;
[0017] Step 1.2: Train the local model on the client, use the synthetic data generated by GAN for training, and obtain the local model;
[0018] Step 1.3: The client communicates with the central server, and all trained local model parameters are uploaded to the central server, which aggregates them and sends them to each client.
[0019] The discriminant process of the self-encoding discriminator D is as follows:
[0020] If the quality of the synthesized data is better than the original data, the synthesized data is output; otherwise, back propagation is used to allow D to regenerate new synthesized data.
[0021] The specific process of the cSE module processing the feature map is as follows:
[0022] Step 2.1: Compress the dimension of the feature map from C×H×W to C×1×1 through a global average pooling layer to obtain the global information of each channel, and use two 1×1 convolutional layers to reduce and increase the dimension of the feature information;
[0023] Step 2.2, normalize the vector through the sigmoid function to obtain the weight of each channel;
[0024] Step 2.3: Apply the obtained weights to the corresponding channels of the original feature map, and obtain a feature map calibrated with channel information through channel excitation.
[0025] The process of sSE module processing feature map is as follows:
[0026] First, the feature map is processed by a convolutional layer with a 1×1 convolution kernel and an output channel of 1, generating a weight matrix of 1×H×W dimensions;
[0027] Then, the Sigmoid function is applied to this weight matrix for normalization;
[0028] Finally, the normalized weight matrix is multiplied by the original feature map in the spatial dimension to obtain the feature map result with enhanced spatial information.
[0029] In the weighted calculation, the attention weights obtained previously are weighted to the features of each channel, and each feature in the feature map is multiplied by the corresponding weight to obtain the final output of the sSE module.
[0030] The specific process of scSE module processing feature map is as follows:
[0031] The two results of the feature map after being processed by the cSE module and the sSE module are added along the channel dimension to obtain a feature map dimension that is consistent with the original feature map.
[0032] A personalized federated learning system includes a central server and several clients, wherein the client processes local data through a generator and a discriminator in turn for personalization, generates synthetic data, trains a local model, and uploads it to the central server;
[0033] The central server builds a federated learning model, aggregates and trains the local models uploaded by all clients into a global model, and sends the optimal parameters of the global model to the clients.
[0034] The local model includes a generator module and an autoencoder discriminator module; wherein the generator module is used to generate synthetic data from original data; the autoencoder discriminator module is used to identify the quality of the synthetic data and output new synthetic data according to the identification result.
[0035] On the client side, the scSE attention mechanism is introduced and added to the generator and discriminator of GAN to obtain important features of the data in the channel and spatial dimensions and enhance these features; by adaptively adjusting the network parameters, the generative adversarial network structure is optimized, the client local model is constructed, and the local model is uploaded to the central server;
[0036] On the central server side, a personalized federated learning model is built, local models uploaded by clients are received, local models are aggregated and trained, an optimized global model is obtained, and the optimized global model parameters are sent to each client.
[0037] Compared with the prior art, the present invention has the following beneficial effects:
[0038] 1. The scSE attention mechanism can improve the performance and efficiency of the model by emphasizing key features and suppressing useless features, making the model more focused on important areas and channels.
[0039] 2. This mechanism enhances the representation ability of features and improves the generalization ability of the model. Its flexibility allows it to be easily integrated into various deep learning models, while the efficient calculation method ensures the high performance of the model while maintaining computational efficiency.
[0040] 3. The scSE attention mechanism provides an effective optimization method for deep learning models and federated learning algorithms, which helps to improve the performance of models on various tasks, adapt to the differences in distribution and characteristics of data sets, and solve the problem of heterogeneous data. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 This is the structural diagram of the scSE attention mechanism.
[0042] Figure 2 The figure is a flow chart of the method for personalized federated learning of the present invention.
[0043] Figure 3 This is a system architecture diagram of personalized federated learning in the present invention. DETAILED DESCRIPTION
[0044] The structure and working process of the present invention will be further described below in conjunction with the accompanying drawings.
[0045] The present invention proposes a personalized federated learning method based on the scSE attention mechanism to solve the problem of heterogeneous data in personalized federated learning.
[0046] By introducing the scSE (Selective Channel and Spatial Squeeze-and-Excitation) attention mechanism, the present invention can adaptively focus on key features in the data, improve the training efficiency and data generation quality of GAN in personalized federated learning. The scSE attention mechanism can also improve the performance and efficiency of the model by emphasizing key features and suppressing useless features, making the model more focused on important areas and channels. In addition, the mechanism enhances the representation ability of features and improves the generalization ability of the model. Its flexibility allows it to be easily integrated into various deep learning models, and the efficient calculation method ensures the high performance of the model while maintaining computational efficiency. Therefore, the scSE attention mechanism provides an effective optimization method for deep learning models and federated learning algorithms, which helps to improve the performance of the model on multiple tasks, adapt to the differences in distribution and characteristics of data sets, and solve the problem of heterogeneous data.
[0047] A personalized federated learning method introduces the scSE attention mechanism and adds the scSE attention mechanism to the generator and discriminator of GAN. The specific steps include:
[0048] Step 1: Build a personalized federated learning model including cSE module, sSE module and scSE module;
[0049] Step 2: The cSE module processes the input feature map to obtain more detailed global features of the feature map; the cSE module changes the 1 / 16 dimension in the SE module to 1 / 2 in the compression stage. This change helps the model better capture the global information of the feature channel and further improve the representation ability of the model. The cSE module also contains two main operations: squeeze and excitation. In the squeeze operation, the cSE module uses global average pooling to compress the spatial features of each channel and generate a descriptor that can represent the global information of the channel. In the excitation operation, the cSE module learns the dependencies between channel descriptors through the fully connected layer and generates a weight for each channel. These weights play a key role in the subsequent feature recalibration process. They are used to emphasize important feature channels while suppressing those channels that contribute less to the task. In this way, the cSE module helps the model focus more on key features, thereby improving the performance of the model.
[0050] Step 3: The sSE module processes the input feature map to obtain more detailed local feature information in the feature map; in the channel dimension, the sSE module uses a channel compression strategy. Specifically, it uses the global average pooling layer to average the feature values at all spatial positions of each channel to obtain a feature value representing the global information of the channel. This compression method helps the model capture the dependencies between channels and thus improve the feature expression ability. Next, the sSE module further performs spatial excitation processing on the compressed channel information. This step is implemented through the fully connected layer and the Sigmoid activation function. The fully connected layer is responsible for learning the dependencies between channels and outputting a set of weight values. These weight values are normalized by the Sigmoid activation function to obtain the weight of each channel for the subsequent spatial excitation step. In the spatial excitation step, the sSE module multiplies the obtained channel weight with the original feature map. In this way, the model can dynamically adjust the contribution of each channel in the spatial position according to the importance of the channel. In this way, the sSE module achieves a refined processing of spatial information, enabling the model to focus on the key areas in the image more accurately.
[0051] Step 4: Add the two results obtained in step 2 and step 3 along the channel dimension. The scSE module processes the feature map and outputs the final feature map data.
[0052] Specific embodiments, such as Figures 1 to 3 As shown,
[0053] The personalized federated learning method based on the FEDSCAC algorithm can be divided into: introducing the scSE attention mechanism, optimizing the generative adversarial network structure, and designing a personalized federated learning algorithm.
[0054] Introducing the scSE attention mechanism: The scSE attention mechanism combines channel attention and spatial attention, and can focus on the important features of the data in both the channel and spatial dimensions. By selectively enhancing these features, the robustness and generalization ability of GAN in personalized federated learning are improved, such as Figure 1 As shown, the light-colored cuboids represent convolution operations and activation functions, and the dark-colored cuboids represent embedded SLEA modules. The present invention first inputs the feature map and then performs a deconvolution operation to increase the dimension of the matrix; then performs batch normalization to speed up the convergence speed; after processing through the relu() layer, it is input into the SLEA module to speed up the training speed. The above operation is repeated 4 times, and the deconvolution operation is performed again, and the final feature map is output after using the Tanh() activation function.
[0055] Optimize the structure of the generative adversarial network: add the scSE attention mechanism to the generator and discriminator of GAN, and adaptively adjust the network parameters to enable GAN to better adapt to heterogeneous data and improve the authenticity and diversity of generated data, such as Figure 2 As shown, the feature maps are processed by the cSE module and the sSE module respectively to obtain the corresponding results and Subsequently, the two results are added along the channel dimension to correct the information, and the dimension of the final feature map is consistent with the original feature map. This process effectively integrates the feature information extracted by different modules and helps improve the performance of the model.
[0056] Design a personalized federated learning algorithm: The present invention designs a personalized federated learning FedSCAC algorithm, and the algorithm steps are shown in Table 1.
[0057] In the FEDSCAC algorithm process, V represents a set of learned filter kernels, V c refers to the parameters of the Cth filter, Represents a 2D spatial kernel, and * represents a convolution operation. c The calculation formula indicates that each layer of the input feature map X passes through a 2D convolution kernel, and finally obtains C output feature maps δ. In the Scale weighted calculation, the attention weights obtained above need to be weighted to the features of each channel, and each feature in the feature map δ is multiplied by the corresponding weight to obtain the final output F of the SE module. sc The algorithm allows each data holder to train locally with their own dataset and upload the model parameters to a central server for aggregation. In this way, all participants can jointly improve model performance while protecting data privacy.
[0058] Table 1 FEDSCAC algorithm
[0059]
[0060]
[0061] A personalized federated learning system includes a central server and several clients, wherein the client processes local data through a generator and a discriminator in turn for personalization, generates synthetic data, trains a local model, and uploads it to the central server;
[0062] The central server builds a federated learning model, aggregates and trains the local models uploaded by all clients into a global model, and sends the optimal parameters of the global model to the clients.
[0063] The local model includes a generator module and an autoencoder discriminator module; wherein the generator module is used to generate synthetic data from original data; the autoencoder discriminator module is used to identify the quality of the synthetic data and output new synthetic data according to the identification result.
[0064] On the client side, the scSE attention mechanism is introduced and added to the generator and discriminator of GAN to obtain important features of the data in the channel and spatial dimensions and enhance these features; by adaptively adjusting the network parameters, the generative adversarial network structure is optimized, the client local model is constructed, and the local model is uploaded to the central server;
[0065] On the central server side, a personalized federated learning model is built, local models uploaded by clients are received, local models are aggregated and trained, an optimized global model is obtained, and the optimized global model parameters are sent to each client.
[0066] A computer storage medium stores computer readable instructions, which, when executed by a processor, call all or part of the steps of the method.
[0067] The above is a preferred implementation of the present application, which can be promoted and applied in the fields of distributed medical image analysis, distributed anomaly detection, privacy-protected image generation, etc.; it should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made, and these improvements and modifications are also regarded as the scope of protection of the present application.
[0068] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing related hardware through a computer program. The program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods.
[0069] 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.
Claims
1. A personalized federated learning method, characterized by: The scSE attention mechanism is introduced and added to the generator and discriminator of GAN. The specific steps include: Step 1: Build a personalized federated learning model including cSE module, sSE module and scSE module; Step 2: The cSE module processes the input feature map to obtain more detailed global features of the feature map; Step 3: The sSE module processes the input feature map to obtain more detailed local feature information in the feature map; Step 4: Add the two results obtained in step 2 and step 3 along the channel dimension. The scSE module processes the feature map and outputs the final feature map data.
2. The personalized federated learning method according to claim 1, characterized in that: In step 1, the specific steps for building a personalized federated learning model are as follows: Step 1.1, GAN training, the original data X is passed to the generator G, G generates synthetic data G(z); the synthetic data and the original data are passed to the self-encoding discriminator D, the self-encoding discriminator D identifies the quality of the synthetic data and outputs the synthetic data according to the discrimination result; Step 1.2: Train the local model on the client, use the synthetic data generated by GAN for training, and obtain the local model; Step 1.3: The client communicates with the central server, and all trained local model parameters are uploaded to the central server, which aggregates them and sends them to each client.
3. The personalized federated learning method according to claim 2, characterized in that: The discriminant process of the self-encoding discriminator D is as follows: If the quality of the synthesized data is better than the original data, the synthesized data is output; otherwise, back propagation is used to allow D to regenerate new synthesized data.
4. The personalized federated learning method according to claim 1, characterized in that: The specific process of the cSE module processing the feature map is as follows: Step 2.1: Compress the dimension of the feature map from C×H×W to C×1×1 through a global average pooling layer to obtain the global information of each channel, and use two 1×1 convolutional layers to reduce and increase the dimension of the feature information; Step 2.2, normalize the vector through the sigmoid function to obtain the weight of each channel; Step 2.3: Apply the obtained weights to the corresponding channels of the original feature map, and obtain a feature map calibrated with channel information through channel excitation.
5. The personalized federated learning method according to claim 1, characterized in that: The process of sSE module processing feature map is as follows: First, the feature map is processed by a convolutional layer with a 1×1 convolution kernel and an output channel of 1, generating a weight matrix of 1×H×W dimensions; Then, the Sigmoid function is applied to this weight matrix for normalization; Finally, the normalized weight matrix is multiplied by the original feature map in the spatial dimension to obtain the feature map result with enhanced spatial information.
6. The personalized federated learning method according to claim 5, characterized in that: In the weighted calculation, the attention weights obtained previously are weighted to the features of each channel, and each feature in the feature map is multiplied by the corresponding weight to obtain the final output of the sSE module.
7. The personalized federated learning method according to claim 1, characterized in that: The specific process of scSE module processing feature map is as follows: The two results of the feature map after being processed by the cSE module and the sSE module are added along the channel dimension to obtain a feature map dimension that is consistent with the original feature map.
8. Personalized federated learning system, characterized by: It includes a central server and several clients, wherein the client processes local data through a generator and a discriminator in turn for personalization, generates synthetic data, trains a local model, and uploads it to the central server; The central server builds a federated learning model, aggregates and trains the local models uploaded by all clients into a global model, and sends the optimal parameters of the global model to the clients.
9. The personalized federated learning system according to claim 8, characterized in that: The local model includes a generator module and an autoencoder discriminator module; wherein the generator module is used to generate synthetic data from original data; the autoencoder discriminator module is used to identify the quality of the synthetic data and output new synthetic data according to the identification result.
10. The personalized federated learning system according to claim 8, characterized in that: On the client side, the scSE attention mechanism is introduced and added to the generator and discriminator of GAN to obtain the important features of the data in the channel and spatial dimensions and enhance these features; By adaptively adjusting network parameters, optimizing the generative adversarial network structure, building a client local model, and uploading the local model to the central server; On the central server side, a personalized federated learning model is built, local models uploaded by clients are received, local models are aggregated and trained, an optimized global model is obtained, and the optimized global model parameters are sent to each client.
Citation Information
Cited By
Method and system for big data acquisition and annotation
CN120707987A