Asynchronous federal image classification method and system based on client selection and aggregation weight adjustment
By selecting clients based on the cumulative distribution of historical image data and adjusting the aggregation weight in asynchronous federated learning, the problem of data heterogeneity and local update obsolescence is solved, and the prediction accuracy of asynchronous federated image classification is significantly improved.
Patent Information
- Application Number
- CN202410901899.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-05
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2044-07-05
AI Technical Summary
In asynchronous federated learning, due to the heterogeneity of client data and the obsolescence of local updates, the effectiveness of the global model decreases. Existing methods cannot effectively utilize long-term data distribution information and outdated information, which affects the prediction performance of image classification tasks.
By selecting clients based on the cumulative distribution of historical image data, and adjusting the aggregation weight based on the similarity between the local model and the global model and the similarity between local models, the federated learning algorithm is used to train the image classification model and improve the prediction performance of the global model.
It effectively alleviates the negative effects of data heterogeneity and obsolescence, improves the prediction accuracy of the global model, and significantly improves the performance of asynchronous federated image classification.
Smart Images

Figure CN118628837A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image classification, and in particular to an asynchronous federated image classification method and system based on client selection and aggregation weight adjustment. Background Art
[0002] Federated learning is a mainstream distributed learning with privacy protection features. Its main feature is that the central server sends the global model to the client and the central server concentrates the client's original data. The basic idea is that the central server aggregates the local update model uploaded by the client to achieve the update of the global model. Asynchronous federated learning means that all clients update the local model independently and in parallel. There is no need to wait for other clients during the interaction with the central server, and the central server does not need to specify the set of clients participating in the update in advance. Asynchronous federated learning has the advantages of high utilization of local user computing resources, little impact on client status, and less overall training time.
[0003] For scenarios with prominent heterogeneity of client computing resources, although asynchronous federated learning has advantages such as high computing efficiency and robust aggregation, the utility of the global model is affected by two factors: client data heterogeneity and local update obsolescence. Data heterogeneity refers to the fact that the data is non-independent and identically distributed, that is, the image category labels owned by different clients are uneven, which will cause the global model performance to be biased towards the categories with a larger number during aggregation. Local update obsolescence refers to the fact that the local update model uploaded by the client is outdated information relative to the current global model of the central server, resulting in outdated information damaging the utility of the global model during aggregation.
[0004] Existing methods for solving the impact of client data heterogeneity in asynchronous federated learning mainly select specific clients to participate in global model updates based on current data distribution information or update frequency, and methods for solving the impact of local update outdatedness mainly reversely adjust the client's aggregation weight based on outdatedness. However, the client selection method based on current data distribution information or update frequency can only guarantee the rationality of client selection at the current moment, but not the long-term rationality; the aggregation weight adjustment based on outdatedness simply suppresses the negative impact of outdated information and fails to utilize the positive impact of outdated information. Therefore, how to use long-term data distribution information to select clients and fully explore the valuable information of outdated updates to further improve the prediction performance of asynchronous federated learning global models in image classification tasks is of great value. Summary of the invention
[0005] To this end, the present invention provides an asynchronous federated image classification method and system based on client selection and aggregation weight adjustment, which solves the problem of poor global model utility in the asynchronous federated image classification process caused by the existing method of using current data distribution information and simply suppressing the influence of outdated information in asynchronous federated learning.
[0006] According to the design scheme provided by the present invention, on the one hand, an asynchronous federated image classification method based on client selection and aggregation weight adjustment is provided, comprising:
[0007] The image classification model is trained using a federated learning algorithm to obtain an image classification target model. The federated learning algorithm selects a target client based on the cumulative distribution of historical image data and adjusts the aggregation weight according to the similarity between the local model and the global model and the similarity between local models. The data distribution is the proportion of each type of image data in the corresponding image data, and the cumulative distribution of historical image data is obtained by adding the user's local image data distribution to the historical global image data distribution.
[0008] The image to be identified is input into the image classification target model, and the image classification target model is used to obtain the type of the image to be identified and output it.
[0009] As an asynchronous federated image classification method based on client selection and aggregation weight adjustment of the present invention, further, the image classification model is trained using a federated learning algorithm, including:
[0010] The central server initializes model parameters and a global image category label list, and broadcasts the initialized model parameters to all clients participating in the federated learning training, wherein all the clients participating in the federated learning training constitute a first client set, and the global image category label list is used to record the cumulative distribution of client image data that have participated in the global model update;
[0011] Each client counts the local image data category label list and sends it to the central server;
[0012] Each client receives the global model parameters and uses them as local model parameters, randomly extracts minimum batch data from local image data, trains the local model using the minimum batch data, and uploads the trained local model increment and the corresponding client to the cache queue of the central server;
[0013] The central server selects a specified number of clients from the cache queue according to the first-in-first-out principle, forms the selected clients into a second client set, selects target clients from the second client set based on the cumulative distribution of historical image data, updates the global image category label list, and forms the target clients into a third client set;
[0014] The central server adjusts the local update aggregation weight in the third client set based on the similarity between the local model and the global model and the similarity between the local models, and updates the current global model according to the aggregation weight and the target client in the third client set;
[0015] The central server sends the updated global model parameters to all clients in the second client set to iteratively execute the federated learning training process until the preset iteration conditions are met and the image classification target model is obtained.
[0016] As an asynchronous federated image classification method based on client selection and aggregation weight adjustment of the present invention, further, the central server selects a specified number of clients from the cache queue according to the first-in-first-out principle, including:
[0017] Set the required target client number K;
[0018] Based on the required number of target clients K and the preset magnification factor C af , select K*C from the cache queue according to the first-in-first-out principle af clients and form a second client set.
[0019] As the asynchronous federated image classification method based on client selection and aggregation weight adjustment of the present invention, further, client selection is performed based on the cumulative distribution of historical image data, including:
[0020] Construct a client selection optimization model under a specified client set based on the historical cumulative distribution and the uniform distribution under a specified length;
[0021] The client selection optimization model is solved and the client set with the maximum cumulative distribution information entropy is selected.
[0022] As an asynchronous federated image classification method based on client selection and aggregation weight adjustment of the present invention, further, the client selection optimization model is expressed as:
[0023]
[0024]
[0025] in, Represents the target client set, is a uniform distribution of specified length, is the historical cumulative distribution of client image data, K is the required number of target clients, Specifies a client collection.
[0026] As an asynchronous federated image classification method based on client selection and aggregation weight adjustment of the present invention, further, adjusting the local update aggregation weight based on the similarity between the local model and the global model and the similarity between the local models includes:
[0027] The similarity between the local model and the global model and the similarity between local models are calculated using cosine similarity, where the similarity between the local model and the global model is the similarity between the local model increment of each target client and the global model, and the similarity between local models is the similarity between the local model increment of each target client and the local model increment of other target clients;
[0028] The similarity between the local model and the global model, as well as the similarity between local models, are aggregated based on the weight factor.
[0029] As an asynchronous federated image classification method based on client selection and aggregation weight adjustment of the present invention, further, the process of updating the current global model according to the aggregation weight and the target client in the third client set is expressed as:
[0030] Among them, w t is the current global model at the tth global model update, u i Set as target client The target client in C ds For weight adjustment based on staleness, is the normalized weight of the target client aggregate weight, It is the local model increment of the target client, and the outdatedness is the outdatedness of the local model increment uploaded by the target client when the current global model is updated.
[0031] On the other hand, the present invention also provides an asynchronous federated image classification system based on client selection and aggregation weight adjustment, comprising: a model training module and an image classification module, wherein:
[0032] A model training module is used to train the image classification model using a federated learning algorithm to obtain an image classification target model. The federated learning algorithm selects a target client based on the cumulative distribution of historical image data and adjusts the aggregation weight according to the similarity between the local model and the global model and the similarity between local models. The data distribution is the proportion of each type of image data in the corresponding image data, and the cumulative distribution of historical image data is obtained by adding the user's local image data distribution to the historical global image data distribution.
[0033] The image classification module is used to input the image to be identified into the image classification target model, and use the image classification target model to obtain the type of the image to be identified and output it.
[0034] Beneficial effects of the present invention:
[0035] The present invention selects clients based on the historical accumulated data distribution, which can effectively reduce the impact of data heterogeneity on the global model, and adjusts the aggregation weight based on the similarity between the client's local update model and the central server's global model, and the similarity between local update models. It can mine valuable information of local outdated update models, improve the effectiveness of the global model, and improve the prediction performance of the global model in the asynchronous federated image classification process. It can be applied to supervised data analysis scenarios including but not limited to image classification, and can effectively alleviate the negative impact of data heterogeneity and obsolescence, significantly improve the prediction accuracy of the global model, and has good application prospects in the field of asynchronous federated image classification. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 This is a schematic diagram of the asynchronous federated image classification process based on client selection and aggregation weight adjustment in the embodiment;
[0037] Figure 2 FIG. 2 is a schematic diagram of the federated training process in the embodiment. DETAILED DESCRIPTION
[0038] In order to make the purpose, technical solutions and advantages of the present invention clearer and more understandable, the present invention is further described in detail below in conjunction with the accompanying drawings and technical solutions.
[0039] In view of the problems such as poor global model effectiveness in the existing asynchronous federated image classification process, the embodiments of the present invention refer to Figure 1 As shown, an asynchronous federated image classification method based on client selection and aggregation weight adjustment is provided, including:
[0040] S101. Train the image classification model using a federated learning algorithm to obtain an image classification target model, wherein the federated learning algorithm selects a target client based on the cumulative distribution of historical image data and adjusts the aggregation weight according to the similarity between the local model and the global model and the similarity between local models, wherein the data distribution is the proportion of each type of image data in the corresponding image data, and the cumulative distribution of historical image data is obtained by adding the user's local image data distribution to the historical global image data distribution;
[0041] S102: Input the image to be identified into the image classification target model, use the image classification target model to obtain the type of the image to be identified and output it.
[0042] During the federated training process, client selection based on the cumulative distribution information entropy of the data can effectively alleviate the impact of data heterogeneity. The similarity aggregation weight adjustment between the client's local update model and the global model, and between the local update models of different clients can alleviate the impact of obsolescence and improve the prediction accuracy of the global model for image classification.
[0043] Specifically, the federated learning algorithm is used to train the image classification model, which can be designed to include the following content:
[0044] The central server initializes model parameters and a global image category label list, and broadcasts the initialized model parameters to all clients participating in the federated learning training, wherein all the clients participating in the federated learning training constitute a first client set, and the global image category label list is used to record the cumulative distribution of client image data that have participated in the global model update;
[0045] Each client counts the local image data category label list and sends it to the central server;
[0046] Each client receives the global model parameters and uses them as local model parameters, randomly extracts minimum batch data from local image data, trains the local model using the minimum batch data, and uploads the trained local model increment and the corresponding client to the cache queue of the central server;
[0047] The central server selects a specified number of clients from the cache queue according to the first-in-first-out principle, forms the selected clients into a second client set, selects target clients from the second client set based on the cumulative distribution of historical image data, updates the global image category label list, and forms the target clients into a third client set;
[0048] The central server adjusts the local update aggregation weight in the third client set based on the similarity between the local model and the global model and the similarity between the local models, and updates the current global model according to the aggregation weight and the target client in the third client set;
[0049] The central server sends the updated global model parameters to all clients in the second client set to iteratively execute the federated learning training process until the preset iteration conditions are met and the image classification target model is obtained.
[0050] See also Figure 2 As shown in the figure, the process of federated training of image classification models can be summarized as follows:
[0051] Step 1: Model initialization. Central server Initialize model parameters w 0 , and w 0 Broadcast to all participating clients, the set of all participating clients is recorded as
[0052] Step 2: Distribution Initialization. Central Server Initialize the global image label list It is used to record the cumulative distribution of client image data that has participated in the global model update, where n cIndicates the number of image category labels.
[0053] Central Server Maintain a global list of image labels Any element p in this list i Indicates the proportion of the i-th category label in the total sample size of all data that have participated in the global model update, satisfying
[0054] Step 3: Client data distribution statistics. Each client Calculate the category label list for its local image data And send it to the central server in Indicates that the j-th image is on client u i The proportion of data that meets
[0055] Central Server Collect the distribution of client image labels at the beginning of training Used to update the global image label list in step 2 after learning begins The advantage of collecting the client image label distribution before training starts is that it can avoid repeated collection of client distribution during each global aggregation after training starts, and also avoid exposing the private information of the number of images of each category in the client data.
[0056] Step 4: Client local training. Each client Randomly extract a minimum batch of size b from the local data to hold the latest global model Update. Re-mark The update formula is:
[0057]
[0058] in Indicates that client u is updated at the tth global model update i Holds the global model version, and E represents the number of local updates. After the local update is completed, the client will Upload to the central server
[0059] Step 5: Client selection. Central server Take out K*C from the cache queue according to the first-in-first-out principle af Local updates uploaded by clients, of which C af ≥1 indicates the amplification factor, which is used to increase the information entropy of the cumulative distribution of the selected client data. The client set taken out is recorded as Its size is K*C af Solve the following optimization problem and select the user set that maximizes the cumulative distribution information entropy
[0060]
[0061] in The update formula is Indicates that The average distribution of user data in is added to the historical distribution The historical cumulative distribution after Indicates length n c Uniform distribution. Select the user set After that, update the global image label list
[0062] Central Server Based on historical cumulative distribution The benefit of selecting a client is to minimize the negative impact of data heterogeneity on the effectiveness of the global model. Specifically, it includes:
[0063] 1) Expand the scope of client selection. Central server Select K*C from the cache queue af clients, of which C af It is the amplification factor, and its purpose is to select clients that make the label distribution information entropy larger.
[0064] 2) Client selection. Central server according to Principle, select K clients. For a given length of distribution, the information entropy of uniform distribution is the largest. Therefore, this principle ensures that when adding a client set Finally, the information entropy of the cumulative distribution of all clients that have participated in the global update is maximized.
[0065] 3) Tag distribution update. Select a specific client set Then, using the client image label distribution collected in step 3 Update the global image label list in
[0066] Step 6: Aggregation weight adjustment. Central server Adjust the selected client set The aggregation weight is adjusted based on the similarity between the client's local update model and the global model, and between different clients' local update models.
[0067] Specifically include:
[0068] 1) The similarity between the local update model and the global model. The calculation formula is:
[0069]
[0070] 2) The similarity between the local update and other client local update models. The calculation formula is:
[0071] 3) Comprehensive weight. Client u i The weight is
[0072] Based on global model information mining, the valuable information in the outdated local update model is used to improve the effectiveness of the global model. The calculation formula is: Ability to use the global model to mine valuable information in the local update model.
[0073] For Clients The calculation formula is: The importance of information can be determined by using the similarity between client-side local update models.
[0074] Based on the weight factor, the global similarity and local similarity are integrated to ensure the rationality of the aggregation weight setting.
[0075] Step 7: Global model update. Central server Based on user collection and aggregation weight Update the current global model w as follows t :
[0076]
[0077] in for The normalized weight of Based on obsolescence The weight adjustment, Indicates that at the current tth global model update, client u i Staleness of uploaded local updates.
[0078] Central Server For client u i Weight Adjust to obtain polymerization in Taking into account the impact of outdatedness, the normalized weights The impact of the number of clients is taken into account. When updating the global model, both the impact of out-of-dateness and the number of clients are considered to improve the utility of the global model.
[0079] Step 8: Global model feedback. Central server The updated global model w t+1 Send to user collection Repeat steps 4 to 7 until the preset stop condition is reached.
[0080] In the above federated training process, the client selection based on the historical accumulated data distribution is used to reduce the impact of data heterogeneity on the global model. The aggregation weight adjustment based on the similarity between the client local update model and the central server global model and the similarity between local update models is used to mine the valuable information of the local outdated update model and improve the effectiveness of the global model. This makes the trained target model applicable to supervised data analysis scenarios including but not limited to image classification, which can effectively alleviate the negative impact of data heterogeneity and obsolescence and significantly improve the prediction accuracy of the global model.
[0081] Furthermore, based on the above method, an embodiment of the present invention also provides an asynchronous federated image classification system based on client selection and aggregation weight adjustment, comprising: a model training module and an image classification module, wherein:
[0082] A model training module is used to train the image classification model using a federated learning algorithm to obtain an image classification target model. The federated learning algorithm selects a target client based on the cumulative distribution of historical image data and adjusts the aggregation weight according to the similarity between the local model and the global model and the similarity between local models. The data distribution is the proportion of each type of image data in the corresponding image data, and the cumulative distribution of historical image data is obtained by adding the user's local image data distribution to the historical global image data distribution.
[0083] The image classification module is used to input the image to be identified into the image classification target model, and use the image classification target model to obtain the type of the image to be identified and output it.
[0084] Unless otherwise specifically stated, the relative steps, numerical expressions and values of the components and steps set forth in these embodiments do not limit the scope of the present invention.
[0085] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0086] The units and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. A person of ordinary skill in the art may use different methods to implement the described functions for each specific application, but such implementation is not considered to be beyond the scope of the present invention.
[0087] Those skilled in the art will appreciate that all or part of the steps in the above method can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium, such as a read-only memory, a disk or an optical disk. Optionally, all or part of the steps in the above embodiment can also be implemented using one or more integrated circuits, and accordingly, each module / unit in the above embodiment can be implemented in the form of hardware or in the form of software function modules. The present invention is not limited to any specific form of combination of hardware and software.
[0088] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. An asynchronous federated image classification method based on client selection and aggregation weight adjustment, It is characterized in that Include: The image classification model is trained using a federated learning algorithm to obtain an image classification target model. The federated learning algorithm selects a target client based on the cumulative distribution of historical image data and adjusts the aggregation weight according to the similarity between the local model and the global model and the similarity between local models. The data distribution is the proportion of each type of image data in the corresponding image data, and the cumulative distribution of historical image data is obtained by adding the user's local image data distribution to the historical global image data distribution. The image to be identified is input into the image classification target model, and the image classification target model is used to obtain the type of the image to be identified and output it.
2. According to claim 1, the asynchronous federated image classification method based on client selection and aggregation weight adjustment, It is characterized in that Use the federated learning algorithm to train the image classification model, including: The central server initializes model parameters and a global image category label list, and broadcasts the initialized model parameters to all clients participating in the federated learning training, wherein all the clients participating in the federated learning training constitute a first client set, and the global image category label list is used to record the cumulative distribution of client image data that have participated in the global model update; Each client counts the local image data category label list and sends it to the central server; Each client receives the global model parameters and uses them as local model parameters, randomly extracts minimum batch data from local image data, trains the local model using the minimum batch data, and uploads the trained local model increment and the corresponding client to the cache queue of the central server; The central server selects a specified number of clients from the cache queue according to the first-in-first-out principle, forms the selected clients into a second client set, selects target clients from the second client set based on the cumulative distribution of historical image data, updates the global image category label list, and forms the target clients into a third client set; The central server adjusts the local update aggregation weight in the third client set based on the similarity between the local model and the global model and the similarity between the local models, and updates the current global model according to the aggregation weight and the target client in the third client set; The central server sends the updated global model parameters to all clients in the second client set to iteratively execute the federated learning training process until the preset iteration conditions are met and the image classification target model is obtained.
3. According to claim 2, the asynchronous federated image classification method based on client selection and aggregation weight adjustment, It is characterized in that The central server selects a specified number of clients from the cache queue according to the first-in-first-out principle, including: Set the required target client number K; Based on the required number of target clients K and the preset magnification factor C af , select K*C from the cache queue according to the first-in-first-out principle af clients and form a second client set.
4. The asynchronous federated image classification method based on client selection and aggregation weight adjustment according to claim 1 or 2, It is characterized in that Client selection based on the cumulative distribution of historical image data, including: Construct a client selection optimization model under a specified client set based on the historical cumulative distribution and the uniform distribution under a specified length; The client selection optimization model is solved and the client set with the maximum cumulative distribution information entropy is selected.
5. According to claim 4, the asynchronous federated image classification method based on client selection and aggregation weight adjustment, It is characterized in that The client selects the optimization model as: in, Represents the target client set, is a uniform distribution of specified length, is the historical cumulative distribution of client image data, K is the required number of target clients, Specifies a client collection.
6. The asynchronous federated image classification method based on client selection and aggregation weight adjustment according to claim 1 or 2, It is characterized in that Adjust the local update aggregation weight based on the similarity between the local model and the global model and the similarity between local models, including: The similarity between the local model and the global model and the similarity between local models are calculated using cosine similarity, where the similarity between the local model and the global model is the similarity between the local model increment of each target client and the global model, and the similarity between local models is the similarity between the local model increment of each target client and the local model increment of other target clients; The similarity between the local model and the global model, as well as the similarity between local models, are aggregated based on the weight factor.
7. The asynchronous federated image classification method based on client selection and aggregation weight adjustment according to claim 2, It is characterized in that The process of updating the current global model according to the aggregation weight and the target client in the third client set is expressed as: Among them, w t is the current global model at the tth global model update, u i Set as target client The target client in C ds For weight adjustment based on staleness, is the normalized weight of the target client aggregate weight, is the local model increment of the target client, and the outdatedness is the outdatedness of the local model increment uploaded by the target client when the current global model is updated.
8. An asynchronous federated image classification system based on client selection and aggregation weight adjustment, It is characterized in that Contains: model training module and image classification module, among which, A model training module is used to train the image classification model using a federated learning algorithm to obtain an image classification target model. The federated learning algorithm selects a target client based on the cumulative distribution of historical image data and adjusts the aggregation weight according to the similarity between the local model and the global model and the similarity between local models. The data distribution is the proportion of each type of image data in the corresponding image data, and the cumulative distribution of historical image data is obtained by adding the user's local image data distribution to the historical global image data distribution. The image classification module is used to input the image to be identified into the image classification target model, and use the image classification target model to obtain the type of the image to be identified and output it.
9. An electronic device, It is characterized in that include: at least one processor, and a memory coupled to the at least one processor; The memory stores a computer program, and the computer program can be executed by the at least one processor to implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed, the method according to any one of claims 1 to 7 can be implemented.
Citation Information
Patent Citations
Federal learning-based parking flow prediction model training method
CN114372046A
Asynchronous federal learning method and system
CN115879568A
Federal learning image classification method and system for heterogeneous image data
CN116310501A
Federal learning label flipping attack-oriented client selection defense method and system
CN117439804A
Classification model training method and system based on federated learning client selection
CN117557870A
Cited By
Traceable federal incremental learning method based on grouping feature aggregation
CN120087503A
A traceable federated incremental learning method based on group feature aggregation
CN120087503B
Electric hand drill maintenance data tracing management system
CN120910626A
A hand drill maintenance data trace management system
CN120910626B
Electric hand drill maintenance data collaborative modeling system based on federal learning
CN120974953A
