Data classification method, system and related device based on improved federated learning

By using an improved federated learning algorithm, the target client combines global and local model parameters to train a data classification model, which solves the problem of personalized information loss in traditional federated learning and improves the accuracy of data classification.

CN116503642BActive Publication Date: 2026-04-17HARBIN INST OF TECH SHENZHEN GRADUATE SCHOOL
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HARBIN INST OF TECH SHENZHEN GRADUATE SCHOOL
Filing Date
2023-03-15
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

In existing technologies, when training data classification models based on traditional federated learning techniques, all clients share the exact same model parameters, causing each client to lose the personalized information of its local model, which affects the accuracy of data classification.

Method used

Using an improved federated learning algorithm, the target client iteratively trains the data classification model based on the parameters of the global feature extractor and classifier model, as well as the parameters of the local classifier model. It retains the personalized information of the local classifier model parameters and calculates the global model parameters through weighted aggregation by the server.

Benefits of technology

By preserving the local model information of each client during federated learning training, the accuracy of the data classification model in classifying its own data is improved, thereby enhancing the overall accuracy of data classification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116503642B_ABST
    Figure CN116503642B_ABST
Patent Text Reader

Abstract

This invention discloses a data classification method, system, and related equipment based on improved federated learning. The method includes: a target client iteratively training its corresponding data classification model according to a preset improved federated learning algorithm to obtain a corresponding trained data classification model; during each iteration of the preset improved federated learning algorithm, the target client adjusts the model parameters of the data classification model to be trained based on the global feature extractor model parameters, the global classifier model parameters, and the local classifier model parameters; the global feature extractor model parameters and the global classifier model parameters are obtained by the target client from the server, and the local classifier model parameters are obtained by the target client from locally stored data; the target client obtains the data to be classified and classifies it using the corresponding trained data classification model to obtain the target category corresponding to the data to be classified. This invention helps improve the accuracy of data classification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data classification technology, and in particular to a data classification method, system and related equipment based on improved federated learning. Background Technology

[0002] With the development of science and technology, data classification technology is being applied more and more widely. For example, when processing image data, it can be classified first to improve the efficiency of subsequent processing. Specifically, corresponding data classification models can be trained to classify data, thereby improving the efficiency of data classification.

[0003] In existing technologies, data classification models trained using traditional federated learning techniques employ the same global model for local training. The parameters of these local models are then uploaded to a server to aggregate and update the global model's parameters. In other words, all clients share identical model parameters. The problem with this existing technology is that sharing the same model parameters during training causes each client to lose the unique information of its local model. This negatively impacts the accuracy of each client's trained data classification model in classifying the data it needs to identify, hindering the improvement of overall data classification accuracy.

[0004] Therefore, existing technologies still need improvement and development. Summary of the Invention

[0005] The main objective of this invention is to provide a data classification method, system, and related equipment based on improved federated learning. This invention aims to address the problem in existing schemes that train data classification models using traditional federated learning techniques, where all clients share identical model parameters during training, causing each client to lose personalized information from its local model and hindering the improvement of data classification accuracy.

[0006] To achieve the above objectives, a first aspect of the present invention provides a data classification method based on improved federated learning, wherein the improved federated learning-based data classification method includes:

[0007] The target client iteratively trains the data classification model corresponding to the target client according to the preset improved federated learning algorithm to obtain the trained data classification model corresponding to the target client. When the target client performs one round of iteration according to the preset improved federated learning algorithm, it adjusts the model parameters of the data classification model to be trained based on the global feature extractor model parameters, the global classifier model parameters, and the local classifier model parameters. The global feature extractor model parameters and the global classifier model parameters are obtained by the target client from the server, and the local classifier model parameters are obtained by the target client based on the data stored locally.

[0008] The target client obtains the data to be classified, classifies the data using the pre-trained data classification model corresponding to the target client, and obtains the target category corresponding to the data to be classified.

[0009] Optionally, the above data classification model is an image classification model, and the above data to be classified is an image to be classified.

[0010] Optionally, the target client mentioned above is selected and determined by the server mentioned above.

[0011] Optionally, when the target client performs the t-th iteration based on the preset improved federated learning algorithm, it adjusts the model parameters according to the following steps:

[0012] The target client obtains the global feature extractor model parameters and global classifier model parameters for the t-th round issued by the server. The global feature extractor model parameters and global classifier model parameters for the t-th round are calculated by the server based on the global feature extractor model update parameters and local classifier model update parameters for all target clients in the (t-1)-th round of iteration.

[0013] The target client obtains the local classifier model update parameters for round t-1 from the locally stored data and uses them as the local classifier model parameters for round t.

[0014] Based on the training data in the target client, the parameters of the global feature extractor model in round t, the parameters of the global classifier model in round t, and the parameters of the local classifier model in round t, the model parameters of the data classification model to be trained are iteratively updated in round t to obtain the updated parameters of the global feature extractor model in round t and the updated parameters of the local classifier model in round t corresponding to the data classification model to be trained.

[0015] Optionally, the model parameters of the data classification model to be trained are iteratively updated in the t-th round based on the training data in the target client, the parameters of the global feature extractor model in the t-th round, the parameters of the global classifier model in the t-th round, and the parameters of the local classifier model in the t-th round, to obtain the updated parameters of the global feature extractor model in the t-th round and the updated parameters of the local classifier model in the t-th round corresponding to the data classification model to be trained, including:

[0016] The target client updates the model parameters of the global feature extractor in its corresponding data classification model to be trained with the global feature extractor model parameters of the t-th round mentioned above;

[0017] The parameters of the global feature extractor model in the t-th round of the data classification model to be trained are fixed. The first loss value corresponding to the training data is calculated based on the training data in the target client, the parameters of the local classifier model in the t-th round, and the fixed parameters of the global feature extractor model in the t-th round. The parameters of the local classifier model in the t-th round are adjusted based on the first loss value to obtain the update parameters of the local classifier model in the t-th round.

[0018] The parameters of the global classifier model in the t-th round of the data classification model to be trained are fixed. The second loss value corresponding to the training data is calculated based on the training data in the target client, the parameters of the global feature extractor model in the t-th round, and the fixed parameters of the global classifier model in the t-th round. The parameters of the global feature extractor model in the t-th round are then adjusted based on the second loss value to obtain the updated parameters of the global feature extractor model in the t-th round.

[0019] Optionally, the parameters of each model in the above-mentioned data classification model to be trained are updated using gradient descent.

[0020] Optionally, after performing a t-th iteration update on the model parameters of the data classification model to be trained based on the training data in the target client, the t-th round global feature extractor model parameters, the t-th round global classifier model parameters, and the t-th round local classifier model parameters to obtain the t-th round global feature extractor model update parameters and the t-th round local classifier model update parameters corresponding to the data classification model to be trained, the method further includes:

[0021] The aforementioned target client sends the aforementioned round t global feature extractor model update parameters and the aforementioned round t local classifier model update parameters to the aforementioned server, thereby triggering the aforementioned server to perform weighted aggregation calculation based on the number of samples in the training data of each of the aforementioned target clients and the corresponding round t global feature extractor model update parameters to obtain the round t+1 global feature extractor model parameters, and to perform weighted aggregation calculation based on the number of samples in the training data of each of the aforementioned target clients and the corresponding round t local classifier model update parameters to obtain the round t+1 global classifier model parameters.

[0022] A second aspect of the present invention provides a data classification system based on improved federated learning, wherein the data classification system based on improved federated learning includes:

[0023] The model training module is used to control the target client to perform iterative training of the data classification model to be trained for the target client according to a preset improved federated learning algorithm, so as to obtain the trained data classification model corresponding to the target client. When the target client performs one round of iteration according to the preset improved federated learning algorithm, it adjusts the model parameters of the data classification model to be trained based on the global feature extractor model parameters, the global classifier model parameters, and the local classifier model parameters. The global feature extractor model parameters and the global classifier model parameters are obtained by the target client from the server, and the local classifier model parameters are obtained by the target client based on the data stored locally.

[0024] The data classification module is used to control the target client to acquire the data to be classified, classify the data to be classified using the trained data classification model corresponding to the target client, and obtain the target category corresponding to the data to be classified.

[0025] A third aspect of the present invention provides a smart terminal, the smart terminal including a memory, a processor, and a data classification program based on improved federated learning stored in the memory and executable on the processor, wherein the data classification program based on improved federated learning implements the steps of any of the above-mentioned data classification methods based on improved federated learning when executed by the processor.

[0026] A fourth aspect of the present invention provides a computer-readable storage medium storing a data classification program based on improved federated learning, wherein the data classification program based on improved federated learning, when executed by a processor, implements the steps of any of the above-mentioned data classification methods based on improved federated learning.

[0027] As can be seen from the above, in the present invention, the target client iteratively trains the data classification model corresponding to the target client according to a preset improved federated learning algorithm to obtain the trained data classification model corresponding to the target client. Specifically, when the target client performs one iteration of the preset improved federated learning algorithm, it adjusts the model parameters of the data classification model to be trained based on the global feature extractor model parameters, the global classifier model parameters, and the local classifier model parameters. The global feature extractor model parameters and the global classifier model parameters are obtained by the target client from the server, and the local classifier model parameters are obtained by the target client based on locally stored data. The target client obtains the data to be classified, classifies the data to be classified using the trained data classification model corresponding to the target client, and obtains the target category corresponding to the data to be classified.

[0028] Compared to existing technologies, the present invention uses global feature extractor model parameters and global classifier model parameters as shared model parameters among target clients during iterative training. Simultaneously, each client retains its own personalized information using local classifier model parameters stored locally. This ensures that the local model information for each target client is preserved during federated learning training, allowing the trained data classification model to fully consider the characteristics of the data on that target client. This improves the accuracy of each client's trained data classification model in classifying the data it needs to identify, thereby enhancing the overall data classification accuracy. Attached Figure Description

[0029] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0030] Figure 1 This is a flowchart illustrating a data classification method based on improved federated learning provided in an embodiment of the present invention;

[0031] Figure 2 This is a schematic diagram of a process for calculating the loss value during training, provided by an embodiment of the present invention;

[0032] Figure 3 This is a schematic diagram of the structure of a data classification system based on improved federated learning provided in an embodiment of the present invention;

[0033] Figure 4 This is a block diagram illustrating the internal structure of a smart terminal provided in an embodiment of the present invention. Detailed Implementation

[0034] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of the invention. However, those skilled in the art will understand that the invention can be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods are omitted so as not to obscure the description of the invention with unnecessary detail.

[0035] It should be understood that, when used in this specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.

[0036] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.

[0037] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.

[0038] With the development of science and technology, data classification technology is being applied more and more widely. For example, when processing image data, it can be classified first to improve the efficiency of subsequent processing. Specifically, corresponding data classification models can be trained to classify data, thereby improving the efficiency of data classification.

[0039] Traditional data classification models typically undergo centralized training, requiring the collection of data from various sources to a central computing center or server. The model is then trained on this collected data. However, this centralized approach risks privacy breaches due to the potential for data collection from multiple sources.

[0040] To address the privacy risks associated with centralized training of data sets, federated learning techniques can be used for model training. Federated learning allows data classification models to be trained without collecting the original data from each party, but only by collecting the model parameters from each party.

[0041] In existing technologies, federated learning algorithms can train machine learning models without sharing source data. For example, FedAvg can be used. Each round of federated learning training in FedAvg can be divided into four steps: the server selects some clients and distributes the global model to them; the clients initialize their local models (i.e., replace the local model parameters with the global model parameters); the clients perform several local model updates on their local data; the server collects the local models updated by the clients and performs weighted aggregation of these model parameters to generate the global model for the next round.

[0042] When the local data of each participant in federated learning is independent and identically distributed (i.i.d.), the model trained by the FedAvg algorithm can achieve performance comparable to that of a centrally trained model. However, when the local data of each participant is not independent and identically distributed, the performance of the model trained by the FedAvg algorithm drops significantly, failing to achieve the same effect as a centrally trained model. Specifically, in the second step of the FedAvg algorithm, the client needs to replace the local model parameters with global model parameters. This approach loses the personalized information of the local model when the data is not independent and identically distributed. To retain more personalized information of the local model in federated learning and improve the performance of the model trained by federated learning when the data is not independent and identically distributed, the FedAvg algorithm needs to be improved.

[0043] In existing technologies, data classification models trained using traditional federated learning techniques employ the same global model for local training. The parameters of these local models are then uploaded to a server to aggregate and update the global model's parameters. In other words, all clients share identical model parameters. The problem with this existing technology is that sharing the same model parameters during training causes each client to lose the unique information of its local model. This negatively impacts the accuracy of each client's trained data classification model in classifying the data it needs to identify, hindering the improvement of overall data classification accuracy.

[0044] In one application scenario, all neural network layers of a federated learning model can be divided into shared layers and personalized layers. In each round, the shared layers of the client model are uploaded to the server for federated learning, while the personalized layers remain locally for local training. This method based on partial layer sharing can preserve local personalized information and improve the performance of the federated learning model. However, this approach preserves the personalized information of the local model by allowing some layers to be updated only locally, but it also results in the shared model uploaded to the server lacking information from the personalized layers.

[0045] To simultaneously preserve the personalized information of the local model and ensure the effective sharing of information across all layers, this invention proposes a personalized federated learning technique using a dual classifier to further improve the performance of the federated learning model.

[0046] Specifically, taking image classification as an example, the data classification model described above can be specifically referred to as an image classification model. An image classification model is a neural network model used to classify images, typically consisting of several convolutional layers, pooling layers, and linear layers. A well-trained image classification model can classify images. Its input is an image, and its output is the category to which the image belongs.

[0047] Traditional image classification models typically employ a centralized training approach, requiring each participant to upload their local data to a server for processing. However, for sensitive data, such as personal image data, users may not wish to send it to a central server for processing. Federated learning, a distributed model training framework, can serve as a solution to privacy issues during image classification model training. Federated learning allows each client to upload only its local model to the server, without needing to upload its local data, thus protecting data privacy. In traditional federated learning, all clients use the same global model for local training, then upload the parameters of their local models to the server for aggregation, updating the parameters of the global model. However, in practical applications, image classification data is often non-independent and identically distributed (i.i.d.). This is because image data from different users, devices, and environments typically have different data distributions and characteristics. When the data from each participant is non-independent and identically distributed, the differences in data distribution between them can be significant. In this case, algorithms like FedAvg, which train only a single global model, cannot capture the personalized information of each client, resulting in a final model that may not achieve optimal test accuracy on each client's data.

[0048] For example, in one application scenario, it's necessary to combine photo album data from multiple mobile phones to train an image classification model. Because each user has different usage habits, the images on different users' phones will exhibit different distributions. Some users may have taken more photos of plant types, while others may have taken more photos of animals. Traditional federated learning ultimately results in only one model, which is averaged and therefore cannot guarantee that the model can classify the photos in each user's album well.

[0049] Therefore, this invention improves upon the existing FedAvg algorithm by proposing a personalized federated learning scheme using a dual classifier. This addresses the performance degradation of image classification models trained through federated learning due to the non-independent and identically distributed nature of the participant data, thereby improving the classification accuracy of the federated learning model. Specifically, compared to FedAvg, this invention retains the parameters of a portion of the model's layers locally, preventing them from being replaced. These layers preserve more personalized information. Because of this layer, each client ultimately receives a different, customized model, enabling better classification on local data.

[0050] To address at least one of the aforementioned problems, in this invention, the target client iteratively trains its corresponding data classification model using a preset improved federated learning algorithm to obtain a trained data classification model. During each iteration of the improved federated learning algorithm, the target client adjusts the model parameters of the data classification model based on global feature extractor model parameters, global classifier model parameters, and local classifier model parameters. The global feature extractor model parameters and global classifier model parameters are obtained by the target client from the server, while the local classifier model parameters are obtained by the target client from locally stored data. The target client then acquires the data to be classified, classifies the data using its trained data classification model, and obtains the target category corresponding to the data.

[0051] Compared to existing technologies, the present invention uses global feature extractor model parameters and global classifier model parameters as shared model parameters among target clients during iterative training. Simultaneously, each client retains its own personalized information using local classifier model parameters stored locally. This ensures that the local model information for each target client is preserved during federated learning training, allowing the trained data classification model to fully consider the characteristics of the data on that target client. This improves the accuracy of each client's trained data classification model in classifying the data it needs to identify, thereby enhancing the overall data classification accuracy.

[0052] like Figure 1 As shown, this embodiment of the invention provides a data classification method based on improved federated learning. Specifically, the method includes the following steps:

[0053] In step S100, the target client iteratively trains the data classification model corresponding to the target client according to the preset improved federated learning algorithm to obtain the trained data classification model corresponding to the target client. When the target client performs one round of iteration according to the preset improved federated learning algorithm, it adjusts the model parameters of the data classification model to be trained based on the global feature extractor model parameters, the global classifier model parameters, and the local classifier model parameters. The global feature extractor model parameters and the global classifier model parameters are obtained by the target client from the server, and the local classifier model parameters are obtained by the target client based on the locally stored data.

[0054] The target client mentioned above is the client that needs to train the model. During the model training process, the target client iteratively trains the model according to a preset improved federated learning algorithm. Throughout the entire training process, the client only communicates with the server about model parameters and does not exchange training data. Each round of federated training in the improved federated learning algorithm has four phases: Model distribution phase, where the server selects some clients to participate in this round of federated learning and distributes the global model (including the global feature extractor and classifier) ​​to them; Local initialization phase, where the client initializes its local model using the received global model to obtain the initial model for this round of local updates. Specifically, for methods like FedAvg, this step involves the client replacing its entire local model with the received global model, meaning the old local model is completely discarded. In this embodiment, the client only replaces the feature extractor of the local model with the feature extractor of the global model; the local classifier is retained, and the classifier in the global model serves as the client's second classifier to guide local update training; Local update phase, using a dual-classifier training strategy (i.e., using the local classifier model parameters to retain its own personalized information, while the global classifier model parameters are shared with other clients) for iterative training; Aggregation phase, where the client uploads the local feature extractor and local classifier to the server for aggregation to obtain the global model for the next round.

[0055] The global feature extractor model parameters mentioned above are the global model parameters corresponding to the feature extractor of the data classification model. The global classifier model parameters mentioned above are the global model parameters corresponding to the classifier of the data classification model. These global model parameters are model parameters that can be shared by all target clients (or clients). The local classifier model parameters mentioned above are the local model parameters corresponding to the classifier of the data classification model. Their values ​​are stored in the local data of the corresponding target client and are not shared with other target clients. They are used to save the local personalized information of the corresponding target client. It should be noted that the feature extractor mentioned above includes the feature extraction layer of the data classification model, while the classifier is the last layer of the data classification model (i.e., the layer used for classification).

[0056] In this embodiment, the data classification model is an image classification model, and the data to be classified is an image. The data classification method in this embodiment can classify image data, and the corresponding data classification model is an image classification model. In one application scenario, the data classification method in this embodiment can also be used to classify other types of data, such as text data and voice data. In this case, the corresponding data classification model is a text classification model or a voice classification model, and no specific limitation is made here.

[0057] It should be noted that the training and testing process of the data classification model in this embodiment is based on image classification datasets (such as CIFAR10 and CIFAR100). The image classification model is trained based on this dataset, and it is ensured that the data does not leave the local device or local client during the training process (i.e., local data is not shared), so as to obtain better training results and privacy protection.

[0058] In this embodiment, the target client is selected and determined by the server. Each target client has a corresponding data classification model to be trained. It should be noted that the data classification models on different target clients have identical structures, but during training, each target client retains local classifier model parameters reflecting its own personalized information. Therefore, the ultimately trained data classification models obtained on different target clients are not the same (same structure but different parameters). After training, a data classification model tailored to the data characteristics of that target client can be obtained. A server can communicate with multiple clients and interact with model parameters. During training, the server selects the client to be trained as the target client from a preset pool of clients based on actual needs.

[0059] In this embodiment, when the target client performs the t-th iteration according to the preset improved federated learning algorithm, it adjusts the model parameters according to the following steps:

[0060] The target client obtains the global feature extractor model parameters and global classifier model parameters for the t-th round issued by the server. The global feature extractor model parameters and global classifier model parameters for the t-th round are calculated by the server based on the global feature extractor model update parameters and local classifier model update parameters for all target clients in the (t-1)-th round of iteration.

[0061] The target client obtains the local classifier model update parameters for round t-1 from the locally stored data and uses them as the local classifier model parameters for round t.

[0062] Based on the training data in the target client, the parameters of the global feature extractor model in round t, the parameters of the global classifier model in round t, and the parameters of the local classifier model in round t, the model parameters of the data classification model to be trained are iteratively updated in round t to obtain the updated parameters of the global feature extractor model in round t and the updated parameters of the local classifier model in round t corresponding to the data classification model to be trained.

[0063] Where t is an integer representing the number of iteration rounds. It should be noted that each target client performs multiple rounds of iterative training on its designated data classification model until a preset training stopping condition is met, thus obtaining a trained data classification model. The number of iterations for each target client is determined based on actual needs and is not specifically limited here. Specifically, the aforementioned preset training stopping condition can also be set according to actual needs. For example, it can be set to the number of iterations reaching a preset iteration threshold, or the model calculating a loss value (which could be the first loss value, the second loss value, or the average of both) being less than a preset loss threshold. Other conditions can also be set, which are not specifically limited here.

[0064] Furthermore, the model parameters of the data classification model to be trained are iteratively updated in round t based on the training data in the target client, the parameters of the global feature extractor model in round t, the parameters of the global classifier model in round t, and the parameters of the local classifier model in round t, to obtain the updated parameters of the global feature extractor model in round t and the updated parameters of the local classifier model in round t corresponding to the data classification model to be trained, including:

[0065] The target client updates the model parameters of the global feature extractor in its corresponding data classification model to be trained with the global feature extractor model parameters of the t-th round mentioned above;

[0066] The parameters of the global feature extractor model in the t-th round of the data classification model to be trained are fixed. The first loss value corresponding to the training data is calculated based on the training data in the target client, the parameters of the local classifier model in the t-th round, and the fixed parameters of the global feature extractor model in the t-th round. The parameters of the local classifier model in the t-th round are adjusted based on the first loss value to obtain the update parameters of the local classifier model in the t-th round.

[0067] The parameters of the global classifier model in the t-th round of the data classification model to be trained are fixed. The second loss value corresponding to the training data is calculated based on the training data in the target client, the parameters of the global feature extractor model in the t-th round, and the fixed parameters of the global classifier model in the t-th round. The parameters of the global feature extractor model in the t-th round are then adjusted based on the second loss value to obtain the updated parameters of the global feature extractor model in the t-th round.

[0068] In this context, fixing the corresponding model parameters means that these parameters will not be updated during the current processing. In this embodiment, the model parameters in the data classification model to be trained are updated using gradient descent. Specifically, the predicted values ​​are first obtained through forward propagation, and the loss value is calculated based on the predicted values ​​and the true labeled values. Then, the gradient of the model parameters is calculated through backpropagation (the fixed parameters are not calculated), and the model parameters are updated using gradient descent based on the calculated gradient.

[0069] Furthermore, after performing a t-th iteration update on the model parameters of the data classification model to be trained based on the training data in the target client, the parameters of the global feature extractor model in the t-th round, the parameters of the global classifier model in the t-th round, and the parameters of the local classifier model in the t-th round, to obtain the updated parameters of the global feature extractor model in the t-th round and the updated parameters of the local classifier model in the t-th round corresponding to the data classification model to be trained, the method further includes:

[0070] The aforementioned target client sends the aforementioned round t global feature extractor model update parameters and the aforementioned round t local classifier model update parameters to the aforementioned server, thereby triggering the aforementioned server to perform weighted aggregation calculation based on the number of samples in the training data of each of the aforementioned target clients and the corresponding round t global feature extractor model update parameters to obtain the round t+1 global feature extractor model parameters, and to perform weighted aggregation calculation based on the number of samples in the training data of each of the aforementioned target clients and the corresponding round t local classifier model update parameters to obtain the round t+1 global classifier model parameters.

[0071] In step S200, the target client obtains the data to be classified, classifies the data to be classified using the trained data classification model corresponding to the target client, and obtains the target category corresponding to the data to be classified.

[0072] After the model training is completed, the corresponding trained data classification model is obtained on each target client. The data to be classified (e.g., images) is input into the data classification model (e.g., image classification model) to obtain the corresponding classification (i.e., target category).

[0073] In this embodiment, the training process of the above data classification model is further explained based on a specific application scenario. Specifically, during the t-th round of federated training, the target client selected by the server receives the entire global model sent from the server, including the parameters of the global feature extractor model in the t-th round. and the parameters of the global classifier model in round t It should be noted that when t equals 1, i.e. when the first round of training is performed, the preset initial model parameters in the server can be used as the parameters of the global feature extractor model and the global classifier model in the first round.

[0074] Before starting local training, the target client first initializes the local model (i.e., the model to be trained in the target client). Specifically, this involves setting the model parameters of the feature extractor in the local model. Replace with the latest global feature extractor model parameters for round t. It should be noted that the model parameters of the feature extractor of the local model before replacement... The value is the global feature extractor model update parameter obtained during round t-1, after the replacement. At this point, each target client stores three parts of model parameters: the model parameters corresponding to the feature extractor are replaced by the latest global feature extractor, and the specific model parameters corresponding to the feature extractor in the target client are... The model parameters of the local classifier in the target client are retained locally, specifically the results obtained after the previous round of local training. That is, the target client obtains the local classifier model update parameters for the (t-1)th round from the locally stored data. And used as parameters for the local classifier model in round t. In the target client, the global classifier (also known as the shared classifier) ​​is the classifier in the latest global model, and its model parameters are the global classifier model parameters obtained from the server in the t-th round. Based on the initialized model parameters, the local model (i.e., the model on the target client) is updated and iterated on the local data (i.e., the training data on the target client). In this embodiment, let ξ be the data of a certain sampled mini-batch on the client, and let L(θ,Φ;ξ) be the loss function. The client will perform the following operations to update the local feature extractor parameters. and local classifier parameters Update them separately.

[0075] First, the target client updates the client model parameters. Specifically, it first updates the local classifier model parameters to obtain the local classifier model update parameters for round t. As shown in formula (1), before forward propagation, the local feature extractor parameters are... The target client input sampling data ξ will be fixed, and then fed into the local feature extractor and local classifier to obtain the predicted value. The loss function is then calculated. To obtain the first loss value, backpropagation is then used to update the local classifier parameters. That is, to obtain the updated parameters of the local classifier model in the t-th round:

[0076]

[0077] In this context, formula (1) represents the update of local classifier parameters during the client-side model parameter update process. The update of , the left side of the equation represents the parameters of the local classifier model obtained after the update, or it can represent the updated parameters of the local classifier model in the t-th round, the right side of the equation Let represent the parameters of the local classifier model in round t, and the right side of the equation... The value is actually equal to The right side of the equation The parameters of the global feature extractor model in the t-th round are fixed, and their values ​​are specifically equal to...

[0078] In this embodiment, the training data from the target client is input into the first loss value corresponding to the training data calculated using the parameters of the local classifier model in round t and the fixed parameters of the global feature extractor model in round t, thereby adjusting the model parameters. Representative to Calculate the gradient, where ξ represents the data from this mini-batch (i.e., the training data). η c L represents the learning rate used when updating the local classifier. It can be set and adjusted according to actual needs. i This represents the loss calculation function. Then, the local feature extractor parameters are updated. Before the update, their values ​​are the same as the global feature extractor model parameters in round t. Therefore, this can also be regarded as an update of the global feature extractor model parameters in round t, thus obtaining the updated parameters of the global feature extractor model in round t.

[0079] As shown in formula (2) below, the classifier parameters are shared before forward propagation. The data will be fixed. The client inputs sampled data ξ, which is then fed into the local feature extractor and the shared classifier to obtain predicted values. The loss function is then calculated. Then, backpropagation is used to update the local feature extractor parameters. That is, to obtain the updated parameters of the global feature extractor model in the t-th round:

[0080]

[0081] In this equation (2), the model parameters of the feature extractor are updated during the update of the client model parameters. However, the model parameters of the feature extractor are the globally shared global feature extractor model parameters of round t, so it can also be regarded as an update of the global feature extractor model parameters of round t. The left side of the equation (2) is the updated model parameters of the feature extractor, that is, the updated parameters of the global feature extractor model of round t. The right side of the equation is... This represents the parameters of the global feature extractor model in the t-th round before the client update, and the right side of the equation... The value is actually equal to Representative to Find the gradient, η e This represents the learning rate used when updating the local feature extractor. It should be noted that the loss function L used in this embodiment... i This is the cross-entropy loss function.

[0082] As shown above, when updating the local classifier parameters, the local feature extractor parameters remain unchanged. Therefore, the local feature extractor only needs to undergo one forward propagation. When updating the local feature extractor, the output obtained from updating the local classifier can be directly input into the global classifier (i.e., implementing the forward propagation process of the neural network) without repeated computation. Specifically, the local feature extractor is updated only once, and the forward propagation is performed only once. Assume the input data X is first input into the feature extractor to obtain B, B is input into the local classifier, and then the predicted value is obtained. Backpropagation is then performed to update the local classifier. Then, the intermediate result B can be directly input into the global classifier for prediction, and then the feature extractor is updated. In this process, the calculation from X to B is only performed once, effectively improving the model training efficiency.

[0083] In this embodiment, the local classifier is first trained and updated based on the global feature extractor and the local classifier; then, it is trained and updated again based on the global feature extractor and the global classifier. This utilizes the model parameter data corresponding to both the local and global classifiers, improving training accuracy. Two different classifiers are used in the model training and update process, preserving the model's local personalized information. Because the parameters of the local classifier are never replaced by the global model during training, it retains much client-related personalized information, while the global classifier contains shared information from other clients. Compared to FedAvg, this embodiment preserves personalized information while ensuring that shared information is not lost.

[0084] Furthermore, after the client-side update is completed, the server-side update is performed. Each target client, after updating its local model parameters, will then update the global feature extractor model parameters obtained from the t-th iteration and the local classifier model parameters obtained from the t-th iteration. The data is uploaded to the server, which triggers the server to perform weighted aggregation calculations based on the number of samples in the training data of each of the aforementioned target clients and the update parameters of the global feature extractor model in round t corresponding to each of the aforementioned target clients to obtain the parameters of the global feature extractor model in round t+1. The server also performs weighted aggregation calculations based on the number of samples in the training data of each of the aforementioned target clients and the update parameters of the local classifier model in round t corresponding to each of the aforementioned target clients to obtain the parameters of the global classifier model in round t+1.

[0085] Specifically, assume that in the t-th round of federated training, there are K target clients participating, with a total of n local samples and each client having n local samples. k After receiving the model parameters uploaded by the client, the server will calculate the new round of global model parameters (θ) by weighted averaging and aggregating the parameters uploaded to the server according to the number of samples in the local training data of each client, based on the following formulas (3) and (4). t+1 ,Φ t+1 ):

[0086]

[0087]

[0088] in, This represents the parameters of the global feature extractor model in round t+1. This represents the global classifier model parameters in round t+1. After the server completes the calculation of the global model in one round, it will select a subset of target clients to distribute the model parameters and execute the next round of federated training.

[0089] Figure 2 This is a schematic diagram of a flowchart for calculating the loss value during training, provided by an embodiment of the present invention. This represents the predicted value obtained after the input data is fed into the neural network, and the forward propagation passes through the global feature extractor and the global classifier. This represents the predicted value obtained after the input data is fed into the neural network, and the forward propagation passes through the global feature extractor and the local classifier. For example... Figure 2 As shown, during the iterative training process, the target client inputs the training data ξ into the data classification model to be trained, and then updates the parameters of the local global feature extractor according to the parameters of the local global feature extractor. and parameters of the local classifier The first predicted category is obtained through calculation. according to The first loss value is calculated based on the labeled class value y corresponding to the training data ξ. Similarly, the loss value is calculated based on the updated parameters of the local global feature extractor. and parameters of the global classifier Calculate to obtain the second prediction category according to The second loss value is obtained by calculating the labeled category value y corresponding to the training data ξ; the model parameters can be adjusted accordingly based on the first and second loss values, and the process is repeated until the training stops.

[0090] As can be seen from the above, in this embodiment, during iterative training, the global feature extractor model parameters and the global classifier model parameters are used as shared model parameters among the various target clients. Simultaneously, each client also uses its own locally stored classifier model parameters to retain its personalized information. This ensures that the local model information corresponding to each target client is preserved during federated learning training of the data classification models on each target client. This allows the data classification models for each target client to fully consider the characteristics of the data on that target client after training, thereby improving the classification accuracy of the data classification models trained by each client for the data they need to identify, and ultimately improving the overall data classification accuracy.

[0091] The data classification method based on improved federated learning proposed in this embodiment outperforms the FedAvg algorithm when the participant data is not independently and identically distributed. Even when the data is independently and identically distributed, the model trained using this method achieves performance equal to or even surpasses that trained by the FedAvg algorithm. Regarding communication efficiency, compared to the FedAvg algorithm, this embodiment only adds a forward and backward propagation process to the classification layer, and the classifier layer consists of only one neural network layer, thus avoiding significant additional computational overhead. In terms of scalability, the solution proposed in this embodiment can be applied to the FedAvg algorithm and some improved versions of FedAvg (such as FedProx), enhancing the performance of the original algorithm.

[0092] like Figure 3 As shown, corresponding to the above-described data classification method based on improved federated learning, this embodiment of the invention also provides a data classification system based on improved federated learning, which includes:

[0093] The model training module 310 is used to control the target client to perform iterative training of the data classification model to be trained corresponding to the target client according to a preset improved federated learning algorithm, so as to obtain the trained data classification model corresponding to the target client. When the target client performs one round of iteration according to the preset improved federated learning algorithm, it adjusts the model parameters of the data classification model to be trained based on the global feature extractor model parameters, the global classifier model parameters, and the local classifier model parameters. The global feature extractor model parameters and the global classifier model parameters are obtained by the target client from the server, and the local classifier model parameters are obtained by the target client based on the data stored locally.

[0094] The data classification module 320 is used to control the target client to acquire the data to be classified, classify the data to be classified using the trained data classification model corresponding to the target client, and obtain the target category corresponding to the data to be classified.

[0095] Specifically, in this embodiment, the specific functions of the data classification system based on improved federated learning and its modules can be referred to the corresponding descriptions in the data classification method based on improved federated learning, and will not be repeated here.

[0096] It should be noted that the division of the modules in the above-mentioned data classification system based on improved federated learning is not unique and is not intended as a specific limitation.

[0097] Based on the above embodiments, the present invention also provides a smart terminal, the principle block diagram of which can be as follows: Figure 4 As shown. The aforementioned intelligent terminal includes a processor and a memory. The memory of the intelligent terminal includes a data classification program based on improved federated learning, and the memory provides an environment for the operation of the data classification program based on improved federated learning. When the data classification program based on improved federated learning is executed by the processor, it implements the steps of any of the aforementioned data classification methods based on improved federated learning. It should be noted that the aforementioned intelligent terminal may also include other functional modules or units, which are not specifically limited here.

[0098] Those skilled in the art will understand that Figure 4 The block diagram shown is merely a partial structural diagram related to the present invention and does not constitute a limitation on the smart terminal to which the present invention is applied. Specifically, the smart terminal may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.

[0099] This invention also provides a computer-readable storage medium storing a data classification program based on improved federated learning. When executed by a processor, the data classification program based on improved federated learning implements the steps of any of the data classification methods based on improved federated learning provided in this invention.

[0100] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0101] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the above system can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this invention. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0102] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0103] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0104] In the embodiments provided by this invention, it should be understood that the disclosed systems / smart terminals and methods can be implemented in other ways. For example, the system / smart terminal embodiments described above are merely illustrative. For instance, the division of modules or units described above is merely a logical functional division, and in actual implementation, it can be divided in other ways. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.

[0105] If the integrated modules / units described above are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable storage medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction.

[0106] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not mean that the essence of the corresponding technical solutions deviates from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.

Claims

1. A data classification method based on improved federated learning, characterized in that, The method includes: The target client iteratively trains the data classification model corresponding to the target client according to a preset improved federated learning algorithm to obtain the trained data classification model corresponding to the target client. When the target client performs one round of iteration according to the preset improved federated learning algorithm, it adjusts the model parameters of the data classification model to be trained based on the global feature extractor model parameters, the global classifier model parameters, and the local classifier model parameters. The global feature extractor model parameters and the global classifier model parameters are obtained by the target client from the server, and the local classifier model parameters are obtained by the target client based on the locally stored data. The target client acquires the data to be classified, classifies the data to be classified using the trained data classification model corresponding to the target client, and obtains the target category corresponding to the data to be classified. The target client performs the first iteration according to a preset improved federated learning algorithm The model parameter adjustment is performed according to the following steps in each iteration The target client obtains the first [item] sent by the server. Round global feature extractor model parameters and the first Round global classifier model parameters, wherein the first... Round global feature extractor model parameters and the first The parameters of the global classifier model are determined by the server based on the first... -1 round of iterations, all target clients corresponding to the first... -1 round of global feature extractor model update parameters and the first ... -1 round of local classifier model update parameters are obtained through calculation; The target client retrieves the data from locally stored data. -1 round of local classifier model parameter updates and as the first round Rotate local classifier model parameters; The target client updates the model parameters of the global feature extractor in its corresponding data classification model to be trained to the parameters of the first... Round global feature extractor model parameters; The global feature extractor corresponding to the fixed data classification model to be trained is the first... The parameters of the global feature extractor model are determined based on the training data in the target client and the parameters of the first... The parameters of the local classifier model and the fixed first round The global feature extractor model parameters are used to calculate the first loss value corresponding to the training data, and the first loss value is used to adjust the parameters of the training data. The parameters of the local classifier model are adjusted to obtain the first... Update parameters of the local classifier model; The global classifier in the data classification model to be trained is fixed. Round global classifier model parameters, based on the training data in the target client, the first The global feature extractor model parameters and the fixed first round The second loss value corresponding to the training data is calculated based on the parameters of the global classifier model, and the second loss value is used to adjust the training data. The parameters of the global feature extractor model are adjusted to obtain the first... The global feature extractor model updates its parameters.

2. The data classification method based on improved federated learning according to claim 1, characterized in that, The data classification model is an image classification model, and the data to be classified is an image to be classified.

3. The data classification method based on improved federated learning according to claim 1, characterized in that, The target client is selected and determined by the server.

4. The data classification method based on improved federated learning according to claim 1, characterized in that, The parameters of each model in the data classification model to be trained are updated using gradient descent.

5. The data classification method based on improved federated learning according to claim 1, characterized in that, According to the training data in the target client, the first Round global feature extractor model parameters, the first Round global classifier model parameters and the first The local classifier model parameters are used to perform the first round of local classifier model parameter adjustments on the model parameters of the data classification model to be trained. Rounds of iterative updates are performed to obtain the first iteration corresponding to the data classification model to be trained. Round global feature extractor model update parameters and the first After updating the parameters of the local classifier model, the method further includes: The target client sends the first... Round global feature extractor model update parameters and the first The local classifier model updates its parameters in turn to trigger the server to update the parameters based on the number of samples in the training data of each target client and the number of samples corresponding to each target client. The global feature extractor model updates its parameters and performs weighted aggregation calculations to obtain the first... +1 round global feature extractor model parameters, based on the number of samples in the training data of each target client and the corresponding first round of each target client. The local classifier model updates its parameters and performs weighted aggregation calculations to obtain the first... +1 rounds of global classifier model parameters.

6. A data classification system based on improved federated learning, characterized in that, The system includes: The model training module is used to control the target client to perform iterative training on the data classification model to be trained corresponding to the target client according to a preset improved federated learning algorithm, so as to obtain the trained data classification model corresponding to the target client. When the target client performs one round of iteration according to the preset improved federated learning algorithm, it adjusts the model parameters of the data classification model to be trained based on the global feature extractor model parameters, the global classifier model parameters, and the local classifier model parameters. The global feature extractor model parameters and the global classifier model parameters are obtained by the target client from the server, and the local classifier model parameters are obtained by the target client based on the data stored locally. The data classification module is used to control the target client to acquire data to be classified, classify the data to be classified using the trained data classification model corresponding to the target client, and obtain the target category corresponding to the data to be classified. The target client performs the first step according to the preset improved federated learning algorithm. During each iteration, the model parameters are adjusted according to the following steps: The target client obtains the first [item] sent by the server. Round global feature extractor model parameters and the first Round global classifier model parameters, wherein the first... Round global feature extractor model parameters and the first The parameters of the global classifier model are determined by the server based on the first... -1 round of iterations, all target clients corresponding to the first... -1 round of global feature extractor model parameter update and the first round -1 round of local classifier model update parameters are obtained through calculation; The target client retrieves the data from locally stored data. -1 round of local classifier model parameter updates and as the first round Rotate local classifier model parameters; The target client updates the model parameters of the global feature extractor in its corresponding data classification model to be trained to the parameters of the first... Round global feature extractor model parameters; The global feature extractor corresponding to the fixed data classification model to be trained is the first... The parameters of the global feature extractor model are determined based on the training data in the target client and the parameters of the first... The parameters of the local classifier model and the fixed first round The global feature extractor model parameters are used to calculate the first loss value corresponding to the training data, and the first loss value is used to adjust the parameters of the training data. The parameters of the local classifier model are adjusted to obtain the first... Update parameters of the local classifier model; The global classifier in the data classification model to be trained is fixed. Round global classifier model parameters, based on the training data in the target client, the first The global feature extractor model parameters and the fixed first round The second loss value corresponding to the training data is calculated based on the parameters of the global classifier model, and the second loss value is used to adjust the training data. The parameters of the global feature extractor model are adjusted to obtain the first... The global feature extractor model updates its parameters.

7. A smart terminal, characterized in that, The smart terminal includes a memory, a processor, and a data classification program based on improved federated learning stored in the memory and executable on the processor. When the data classification program based on improved federated learning is executed by the processor, it implements the steps of the data classification method based on improved federated learning as described in any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a data classification program based on improved federated learning, which, when executed by a processor, implements the steps of the data classification method based on improved federated learning as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Federal learning privacy protection method and system based on adversarial training

    CN113609521A

  • Federal learning classification model training method based on depth deterministic strategy gradient

    CN115062710A