Personalized federal learning method and system based on adaptive hierarchical parameter recombination
By introducing an adaptive hierarchical parameter recombination method in federated learning, the problem of low generalization of global models caused by data heterogeneity is solved, which significantly improves the generalization and stability of the model, and enhances the recognition accuracy and model credibility of retinal disease classification tasks.
Patent Information
- Application Number
- CN202411825723.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-04-22
AI Technical Summary
When the existing federated learning-based methods process non-independent and homogeneous client data, the generalization of the global model is low and unable to achieve global optimality. In the field of medical image processing, the accuracy of the model is closely related to patient health, and the low generalization leads to low credibility of the model.
A personalized federated learning method based on adaptive hierarchical parameter recombination is proposed. By dynamically determining whether the local model of the target client needs to be recombined hierarchical parameter, and recombined when needed to adapt to data heterogeneity and improve the generalization ability and stability of the model.
It significantly improves the generalization and stability of the federated learning model, improves the recognition accuracy of the model in the classification task of retinal diseases, enhances the credibility of the model, and promotes the early detection and diagnosis of retinal diseases.
Smart Images

Figure CN119862971A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of medical image processing, and in particular relates to a personalized federated learning method and system based on adaptive hierarchical parameter reorganization. Background Art
[0002] There are currently huge challenges in eye care, including unequal coverage and quality of prevention, treatment, and rehabilitation services. Early detection and diagnosis of eye lesions will help prevent visual impairment. On the other hand, with the growing development of federated learning, it has been widely used in the medical field. Specifically, because federated learning can achieve cross-client global model training by only collecting local gradients of the client without directly accessing user data, it reduces data privacy risks in collaborative training. The introduction of federated learning allows the medical field to achieve cross-institutional collaboration while protecting patient privacy.
[0003] However, due to data heterogeneity between clients, especially in the case of non-independent and identically distributed data, existing methods based on federated averaging face significant challenges in inference performance. Differences in data distribution between different clients lead to different optimization directions for local models. By simply aggregating user gradients and ignoring these differences, the global model may be dominated by the local optimal solutions of certain clients, making it impossible to achieve the global optimum, and ultimately forming a global model with low generalization (ability to adapt to different data), which may even perform worse on most clients. In the medical field, especially in the field of retinal disease medicine, the accuracy of the model is a crucial performance indicator. Since the model accuracy has a strong positive correlation with the health of the patient, the low model credibility is a very serious problem to be solved. Improving the generalization of the federated learning model and thus improving the model accuracy is of great significance in the field of medical image processing.
[0004] In order to solve the above problems and improve the generalization and stability of federated learning models in the field of medical image processing, the present invention proposes a personalized federated learning method and system based on adaptive hierarchical parameter reorganization to improve the accuracy of the model in identifying retinal disease categories in retinal disease classification tasks, further improve the credibility of federated learning models in the medical field, and promote the early detection and diagnosis of retinal diseases. Summary of the invention
[0005] The purpose of the present invention is to provide a personalized federated learning method and system based on adaptive hierarchical parameter reorganization to effectively address the problem of low generalization of the global model caused by data heterogeneity, and while ensuring the improvement of model performance, the stability of the model can be maintained, thereby promoting the early detection and diagnosis of retinal diseases and more accurately identifying the disease categories in patients' retinal images.
[0006] In order to solve the above problems, an embodiment of the present invention provides a personalized federated learning method based on adaptive hierarchical parameter reorganization, including:
[0007] S1 obtains retinal disease dataset and performs preprocessing;
[0008] S2 initializes the global model of the server and the local model of the client;
[0009] S3 selects the target client participating in the training through the server and obtains the local model uploaded by the target client;
[0010] S4 obtains a global model by aggregating the local models uploaded by the target client through the server;
[0011] S5 dynamically determines whether it is necessary to reorganize the hierarchical parameters of the local model of the target client based on the adaptive detection algorithm of the performance index, and enters step S6 when the hierarchical parameters need to be reorganized, and enters step S7 when the hierarchical parameters do not need to be reorganized;
[0012] S6 reorganizes the hierarchical parameters of the local model of the target client based on the hierarchical parameter reorganization algorithm of the personalized decision when reorganization is needed;
[0013] S7 updates the local model weight of each target client according to the reorganized hierarchical parameters through the server, and sends the local model to the corresponding target client;
[0014] S8 updates the local model according to the reorganized hierarchical parameters through the target client, and completes the local model local training and local model update according to the preprocessed training data set;
[0015] S9 repeats the above steps S3 to S8 until the global model of the server converges.
[0016] In addition, step S1 includes:
[0017] S11. Obtain the retinal disease dataset required for training;
[0018] S12. Resize the retinal image data in the retinal disease dataset using the transforms.Resize method, crop it using the transforms.CenterCrop method, and finally convert it into a PyTorch tensor using the transforms.ToTensor method;
[0019] S13. Normalize the retinal image data using the transforms.Normalize method;
[0020] S14. Divide the retinal disease dataset into multiple subsets and assign them to each client.
[0021] In addition, step S2 includes:
[0022] S21. Select a global model structure and initialize model parameters of the global model;
[0023] S22. Define the global model network layer, which includes convolution layer, residual block layer, normalization layer, activation layer, pooling layer, and fully connected layer;
[0024] S23. Initialize the global model weights;
[0025] S24. Send the initialized global model to the client, and initialize the respective local models through the client.
[0026] In addition, step S3 includes:
[0027] S31. Determine the number of clients K selected by the server to participate in the training based on the input hyperparameters;
[0028] S32. The server randomly selects K clients that need to participate in training from all clients as target clients for activation;
[0029] S33. The target clients upload their respective local models to the server.
[0030] In addition, step S4 includes:
[0031] The server aggregates the local models uploaded by the target client and combines them with the weight information to obtain the global model.
[0032] In addition, step S5 includes:
[0033] S51. Obtain the round P corresponding to the check node and the performance index value acc of the first F rounds respectively;
[0034] S52. When the acc of the previous round i is less than the acc of the current round i+1, set β to 1; when the acc of the previous round i is greater than or equal to the acc of the current round i+1, set β to -1, which is specifically the following formula:
[0035]
[0036] S53. Calculate the β values between each two rounds of round P and the first F rounds in order, and add up the obtained β values to obtain the reverse sum accs, which is calculated specifically according to the following formula:
[0037]
[0038] S54. The judgment function isFedAlr is set according to the reverse order and accs. When accs is greater than or equal to 0, the overall trend is rising, and it is judged that the local model of the target client needs to be reorganized in terms of hierarchical parameters. Otherwise, it is not necessary. The specific calculation is based on the following formula:
[0039]
[0040] S55. Dynamically calculate the next round P' of recombination detection, specifically according to the following formula:
[0041] P'=P-isFedAlr×rnd
[0042] Where rnd is a random integer selected from 1-3;
[0043] S56. If the judgment result is that reorganization is needed, continue to execute step S6, otherwise jump directly to step S7.
[0044] In addition, step S6 includes:
[0045] S61. Obtain the initialized local model weight list;
[0046] S62. Obtain a layer name list of the local model corresponding to the target client;
[0047] S63. Traverse the layers of all clients and compare the inter-layer input and output similarities between different clients in the same layer according to the similarity comparison formula;
[0048] S64. Pairing the layers of the two clients with the highest similarity, and storing the pairing result in a dictionary, the pairing result including the best “layer-index” pair of one of the two clients with the highest similarity for the other client;
[0049] S65. Combine all dictionaries into a new list in client order, where the new list is used to store client-layer similarities;
[0050] S66. According to the guidance of the “layer-index” to the dictionary list, a reorganized local model weight list is obtained.
[0051] In addition, step S7 includes:
[0052] The reorganized local model weight list is sent to the server, and the server updates the weights according to the reorganized local model weight list, and sends the local model with updated weights to the corresponding target client.
[0053] In addition, step S8 includes:
[0054] S81. The client loads the personalized local model according to the local model after the weight update;
[0055] S82. The client trains a new local model using the preprocessed training data set stored locally;
[0056] S83. The client uploads a new local model to the server again.
[0057] The present invention also provides a system for training a server and client model of personalized federated learning based on adaptive hierarchical parameter reorganization, including: a processing module, a server module, and a client module;
[0058] The processing module is used to obtain a training data set and perform preprocessing;
[0059] The server module is used to initialize the global model and send it to the client module;
[0060] The server module is also used to select a target client participating in the training and obtain a local model uploaded by the target client; aggregate the local models uploaded by the target client in the client module;
[0061] The processing module is also used to dynamically determine whether it is necessary to reorganize the hierarchical parameters of the local model of the target client based on the adaptive detection algorithm of the performance index; when reorganization is required, the hierarchical parameter reorganization algorithm based on the personalized decision-making is used to reorganize the hierarchical parameters of the local model of the target client; and the server module is used to update the weight of the local model of each target client according to the reorganized hierarchical parameters and send the local model to the corresponding target client;
[0062] The client module is also used to update the local model according to the reorganized layer parameters through the target client, and complete the local model local training and local model update according to the preprocessed training data set;
[0063] The processing module is also used to repeat the above steps until the global model of the server module converges.
[0064] The present invention focuses on the field of retinal disease image classification in the field of medical image processing. Compared with the prior art, by introducing a hierarchical parameter reorganization method based on personalized decision-making, the generalization ability and stability of the federated learning model can be significantly improved. By dynamically reorganizing the local model parameters of the client, it is possible to effectively cope with the challenges brought by data heterogeneity and avoid the problem of low global model reasoning performance caused by simple aggregation in traditional methods. In addition, the use of an adaptive algorithm based on performance indicators can ensure that the frequency of model reorganization is reasonable, which helps to maintain the stability of the model while ensuring the improvement of model performance. The present invention not only promotes cross-institutional and cross-departmental data collaboration and sharing, realizes more efficient data utilization, and promotes the in-depth development of digital transformation, but also improves the model effect, better handles retinal disease image classification tasks in the field of medical image processing, improves the credibility and application value of the federated learning model, and achieves high-precision effects in identifying retinal disease classification. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] Figure 1 A flowchart of a method for training a server and client model of personalized federated learning based on adaptive hierarchical parameter reorganization according to an embodiment of the present invention;
[0066] Figure 2 A schematic diagram of training a personalized federated learning model based on hierarchical comparison decision according to an embodiment of the present invention;
[0067] Figure 3 The figure is a schematic diagram of a process of federated learning with adaptive parameter reorganization based on performance indicators according to an embodiment of the present invention. DETAILED DESCRIPTION
[0068] To make the purpose, technical scheme and advantages of the embodiments of the present invention clearer, the embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings. However, it will be appreciated by those skilled in the art that in the embodiments of the present invention, many technical details are proposed in order to enable the reader to better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical scheme claimed in the present application can be implemented. The division of the following embodiments is for the convenience of description, and should not constitute any limitation on the specific implementation of the present invention. The various embodiments can be combined and referenced with each other without contradiction.
[0069] One embodiment of the present invention relates to a method for training a server and client model of personalized federated learning based on adaptive hierarchical parameter reorganization, including: obtaining a training data set and preprocessing; initializing a global model of the server and a local model of the client; selecting a target client participating in the training through the server and obtaining a local model uploaded by the target client; obtaining a global model by aggregating the local models uploaded by the target client through the server; dynamically judging whether it is necessary to reorganize the hierarchical parameters of the local model of the target client based on an adaptive detection algorithm based on performance indicators; reorganizing the hierarchical parameters of the local model of the target client based on a hierarchical parameter reorganization algorithm based on personalized decision when reorganization is required; updating the local model weights of each target client according to the reorganized hierarchical parameters through the server and sending the local model to the corresponding target client; updating the local model according to the reorganized hierarchical parameters through the target client, completing the local training and local model update of the local model according to the preprocessed training data set; repeating the above steps until the global model of the server converges. By introducing a hierarchical parameter reorganization method based on personalized decision, the generalization ability and stability of the federated learning model can be significantly improved. By dynamically reorganizing the local model parameters on the client side, we can effectively cope with the challenges brought by data heterogeneity and avoid the problem of low global model reasoning performance caused by simple aggregation in traditional methods. In addition, the use of adaptive algorithms based on performance indicators can ensure that the frequency of model reorganization is reasonable, which helps to maintain the stability of the model while ensuring the improvement of model performance.
[0070] In this embodiment, the specific steps are as follows: Figure 1 As shown, in step S1, a retinal disease data set is obtained and preprocessed. In one embodiment, step S1 includes:
[0071] S11. Obtain a retinal disease dataset. In this embodiment, the Retinal Disease Classification dataset is used. The Retinal Disease Classification dataset is a retinal fundus multi-disease image dataset (RFMiD), which contains fundus images taken with three different fundus cameras and annotated for various conditions through the consensus of two senior retinal experts. The dataset includes 3200 color retinal fundus images, contributed by Samiksha Pachade et al., with original images of 2144*1424 pixels and a total of 46 categories;
[0072] S12. The retinal image data in the retinal disease dataset is resized from 2144*1424 pixels to 256*256 pixels by the transforms.Resize method, then cropped to 224*224 pixels by the transforms.CenterCrop method, and finally converted into a PyTorch tensor by the transforms.ToTensor method;
[0073] S13. Normalize the image data using the transforms.Normalize method, where the mean and standard deviation used are (0.5, 0.5, 0.5) and (0.5, 0.5, 0.5) respectively;
[0074] S14. Divide the data set into multiple subsets for distribution to each client. The data set can be divided into two methods: independent and identically distributed (IID) and non-IID.
[0075] In step S2, the global model of the server and the local model of the client are initialized. Specifically, it includes:
[0076] S21. Select the model required for training. In this embodiment, the ResNet20 model is selected as the global model required for training. The ResNet20 model is a deep residual network composed of 20 residual modules, each of which contains two convolutional layers and a skip connection. This structure is designed to solve the gradient vanishing and gradient exploding problems in deep neural networks, thereby improving the training efficiency and accuracy of the network; initialize the parameters of the current global model and set the initial number of input channels to 16;
[0077] S22. Define each network layer of the global model, including convolutional layer, residual block layer, normalization layer, activation layer, pooling layer, and fully connected layer;
[0078] S23. Initialize the global model weights;
[0079] S24. Send the initialized global model to the client, and initialize the respective local models through the client.
[0080] In step S3, the server selects the target client participating in the training and obtains the local model uploaded by the target client. Specifically, it includes:
[0081] S31. Determine the number of clients K selected by the server to participate in the training according to the input hyperparameters, where K is greater than or equal to 1 and less than or equal to the total number of clients;
[0082] S32. The server randomly selects K clients that need to participate in training from all clients as target clients for activation;
[0083] S33. The target clients upload their respective local models to the server.
[0084] In step S4, the server aggregates the local models uploaded by the target client to obtain a global model. Specifically, the existing Fedavg weighted average algorithm can be used to aggregate the local models.
[0085] In step S5, the adaptive detection algorithm based on the performance index dynamically determines whether it is necessary to reorganize the hierarchical parameters of the local model of the target client. Specifically, it includes:
[0086] S51. Obtain the round P corresponding to the check node and the performance index value acc of the first F rounds respectively;
[0087] S52. When the acc of the previous round i is less than the acc of the current round i+1, set β to 1; when the acc of the previous round i is greater than or equal to the acc of the current round i+1, set β to -1, which is specifically the following formula:
[0088]
[0089] S53. Calculate the β values between each two rounds of round P and the first F rounds in order, and add up the obtained β values to obtain the reverse sum accs, which is calculated specifically according to the following formula:
[0090]
[0091] S54. The judgment function isFedAlr is set according to the reverse order and accs. When accs is greater than or equal to 0, the overall trend is rising, and it is judged that the local model of the target client needs to be reorganized in terms of hierarchical parameters. Otherwise, it is not necessary. The specific calculation is based on the following formula:
[0092]
[0093] S55. Dynamically calculate the next round P' of recombination detection, specifically according to the following formula:
[0094] P'=P-isFedAlr×rnd
[0095] Where rnd is a random integer selected from 1-3;
[0096] S56. If the judgment result is that reorganization is needed, continue to execute step S6, otherwise jump directly to step S7.
[0097] In one example, the implementation process of step S5 is as follows: Figure 2As shown, the global model Net-Glob loads the local model weight W_local of each client to obtain the local model Local Model of each client. The local model weight is used by the Check module to determine whether the model level reorganization FedALR method needs to be executed, and the client weight is aggregated to obtain the local model weight list W_locals, and then the weighted average aggregation Aggregation is performed to obtain the global model weight W_glob. The performance indicator test accuracy Testacc, one of the parameters used for the Check module detection, is tested on the test data set test_dataset. In addition, the node round Point EP, the previous round Forward EP and the random number rnd need to be checked. Specifically, before updating the client local model weight, the hyperparameters P and F are loaded, and the acc of the previous F rounds is called for calculation. The β values corresponding to the F rounds are obtained by using the reverse order idea, and then the reverse order sum of β is calculated, and then the value of the isFedAlr flag is determined to draw a conclusion on whether the current round needs to be reorganized, and the random number rnd is introduced to dynamically calculate the next round that needs to be reorganized. Adopting an adaptive algorithm based on performance indicators to ensure that the frequency of model reorganization is reasonable helps to maintain the stability of the model while ensuring the improvement of model performance.
[0098] In step S6, when reorganization is needed, the local model of the target client is reorganized based on the hierarchical parameter reorganization algorithm of the personalized decision. Specifically, it includes:
[0099] S61. Get the initialized local model weight list W locals [W1,W2,...,W K ], where W represents the weight of each local model;
[0100] S62. Get the layer name list L of the local model corresponding to the target client names [L1,L2,...,L n ], where L represents the layer name of each local model, and the range of n is related to the number of layers of the local model corresponding to the target client;
[0101] S63. Traverse the layers of all clients and compare the inter-layer input and output similarity dis between different clients in the same layer according to the similarity comparison formula; the specific formula is as follows:
[0102]
[0103] in, represents the nth layer of the ith user, represents the input of the jth user at the n-1th layer; CKA represents the existing similarity calculation algorithm:
[0104] S64. Pair the layers of the two clients with the highest similarity, and store the pairing result in a dictionary. The pairing result includes the best “layer-index” pair of one client for the other client among the two clients with the highest similarity. The specific calculation is based on the following formula:
[0105]
[0106] S65. Combine all dictionaries into a new list in client order, where the new list is used to store client-layer similarities;
[0107] S66. According to the guidance of the "layer-index" dictionary list, the reorganized local model weight list newW is obtained locals [W1,W2,...,W K ].
[0108] In one example, the process of step S6 is as follows Figure 3 As shown, C is the client, D is the client's local dataset, Local Models is the client model, Layer n represents the nth layer (the last layer) of the model, Aggregation is the weighted average aggregation algorithm, W_local n represents the local model weight of the nth client, and W_glob is the global model weight. First initialize the local model weight list W locals [W1,W2,...,W K ] and obtain the layer name list L of all activated local models names [L1,L2,...,L n ]. Then, the layers of each client are traversed through the similarity comparison formula to calculate the input and output similarity between different clients in the same layer. Based on the similarity, the layers of the two clients with the highest similarity are paired and their best “layer-index” pair is added. Stored in a dictionary where represents the nth layer of the i-th client in the t-th round, I c Represents the index corresponding to the client with the highest similarity to the i-th client in the n-th layer. Finally, all dictionaries are combined into a new list in the order of the clients, forming a reorganized local model weight list new W locals [W1,W2,...,W K ]. By dynamically reorganizing the local model parameters on the client side, the heterogeneity between different data can be effectively reduced, avoiding the problem of low global model reasoning performance caused by simple aggregation in traditional methods.
[0109] In step S7, the server updates the local model weights of each target client according to the reorganized hierarchical parameters, and sends the local model to the corresponding target client. Specifically, the server updates the updated local model weight list new W locals [W1,W2,...,W K ] is sent to the client.
[0110] In step S8, the target client updates the local model according to the reorganized hierarchical parameters, and completes the local model local training and local model update according to the preprocessed training data set. Specifically, it includes:
[0111] S81. The client loads the personalized local model according to the local model after the weight update;
[0112] S82. The client trains a new local model using the preprocessed training data set stored locally;
[0113] S83. The client uploads a new local model to the server again.
[0114] In step S9, it is determined whether the global model of the server has converged. If it has converged, the training process is terminated. If it has not converged, the above steps S3 to S8 are repeated until the global model of the server has converged.
[0115] There are some existing methods in the field of federated learning to alleviate the problem of local optimal solutions. For example, the CluSamp method groups users according to sample size or model similarity, which can achieve better customer representation and reduce the variance of client random aggregation parameters, solving the problem of data heterogeneity in federated learning and the problem of optimizing communication between servers and clients. The FedMut method uses gradients to mutate the global model and assigns the mutated model to local training. This method mutates the global model according to the gradient change to generate multiple intermediate models. These intermediate models will be distributed to different clients for local training in the next training round. Specifically, by mutating the global model, more model space can be explored to avoid the model from falling into the local optimal solution. When each intermediate model is trained locally on the client, it will be adjusted and optimized according to the local data of the client. Finally, within the range of the mutated model, the global model will converge to a flat area. The FedProx framework is mainly used to alleviate the problem of heterogeneity in federated networks. It is a generalization and reparameterization of FedAvg. Although the modification is small, the theoretical and practical impact is significant. In theory, it provides convergence guarantees for learning with different distributed data and follows device-level system constraints. FedProx has stronger convergence than FedAvg on real federated datasets, and is more stable and accurate in highly heterogeneous environments. The algorithm adds a proximal term to the objective function of the supervised learning task on each device, which is used to measure the parameter-based distance between the server and the local model. The local loss function is regularized using the square of the distance between the local model and the global model to stabilize the convergence of the model.
[0116] Compared with the existing technical methods, the present invention has significant effects. The specific results are shown in Table 1 below, where the existing methods used for comparison include the client grouping-based method CluSamp, the global model mutation-based method FedMut, the model distance comparison-based method FedProx, and the classic algorithm FedAvg.
[0117]
[0118] Table 1 Test Accuracy (%) Comparison Table
[0119] Table 1 compares the test accuracy of four existing methods and the method of the present invention under different parameter settings of independent and identically distributed data and non-independent and identically distributed data. From the performance index data in the table, it can be seen that for the retinal image data of the real scene, the present invention is significantly better than the existing methods in this field.
[0120] Another embodiment of the present invention relates to a system for training a server and client model of personalized federated learning based on adaptive hierarchical parameter reorganization, including a processing module, a server module, and a client module;
[0121] The processing module is used to obtain the training data set and perform preprocessing;
[0122] The server module is used to initialize the global model and send it to the client module;
[0123] The server module is also used to select the target client participating in the training and obtain the local model uploaded by the target client; aggregate the local model uploaded by the target client in the client module;
[0124] The processing module is also used to dynamically determine whether it is necessary to reorganize the hierarchical parameters of the local model of the target client based on the adaptive detection algorithm of the performance index; when reorganization is required, the hierarchical parameter reorganization algorithm based on the personalized decision-making is used to reorganize the hierarchical parameters of the local model of the target client; the server module updates the weight of the local model of each target client according to the reorganized hierarchical parameters and sends the local model to the corresponding target client;
[0125] The client module is also used to update the local model according to the reorganized layer parameters through the target client, and complete the local model local training and local model update according to the preprocessed training data set;
[0126] The processing module is also used to repeat the above steps until the global model of the server module converges.
[0127] It is worth mentioning that all modules involved in this embodiment are logic modules. In practical applications, a logic unit can be a physical unit, a part of a physical unit, or a combination of multiple physical units. In addition, in order to highlight the innovative part of the present invention, this embodiment does not introduce units that are not closely related to solving the technical problem proposed by the present invention, but this does not mean that there are no other units in this embodiment.
[0128] The above are only preferred embodiments of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for training server and client models based on personalized federated learning with adaptive hierarchical parameter reorganization, characterized in that: include: S1 obtains retinal disease dataset and performs preprocessing; S2 initializes the global model of the server and the local model of the client; S3 selects a target client participating in the training through the server and obtains a local model uploaded by the target client; S4 obtains a global model by aggregating the local models uploaded by the target client through the server; S5 dynamically determines whether it is necessary to reorganize the hierarchical parameters of the local model of the target client based on the adaptive detection algorithm of the performance index, and enters step S6 when the hierarchical parameters need to be reorganized, and enters step S7 when the hierarchical parameters do not need to be reorganized; S6 reorganizes the hierarchical parameters of the local model of the target client based on the hierarchical parameter reorganization algorithm of the personalized decision when reorganization is needed; S7: updating the local model weight of each target client according to the reorganized hierarchical parameters through the server, and sending the local model to the corresponding target client; S8 updates the local model according to the reorganized hierarchical parameters through the target client, and completes the local model local training and local model update according to the preprocessed training data set; S9 repeats the above steps S3 to S8 until the global model of the server converges.
2. The method for training server and client models of personalized federated learning based on adaptive hierarchical parameter reorganization according to claim 1, characterized in that: Step S1 includes: S11. Obtain the retinal disease dataset required for training; S12. resize the retinal image data in the retinal disease dataset by using the transforms.Resize method, crop it by using the transforms.CenterCrop method, and finally convert it into a PyTorch tensor by using the transforms.ToTensor method; S13. normalizing the retinal image data by the transforms.Normalize method; S14. Divide the retinal disease dataset into multiple subsets and distribute them to each client.
3. The method for training server and client models of personalized federated learning based on adaptive hierarchical parameter reorganization according to claim 1, characterized in that: Step S2 includes: S21. Select a global model structure and initialize model parameters of the global model; S22. define a global model network layer, wherein the network layer includes a convolutional layer, a residual block layer, a normalization layer, an activation layer, a pooling layer, and a fully connected layer; S23. Initialize the global model weights; S24. Send the initialized global model to the client, and initialize the respective local models through the client.
4. The method for training server and client models of personalized federated learning based on adaptive hierarchical parameter reorganization according to claim 1, characterized in that: Step S3 includes: S31. Determine the number of clients K selected by the server to participate in the training according to the input hyperparameters; S32. The server randomly selects K clients that need to participate in training from all clients as target clients for activation; S33. The target clients upload their respective local models to the server.
5. The method for training server and client models of personalized federated learning based on adaptive hierarchical parameter reorganization according to claim 1, characterized in that: Step S4 includes: The server aggregates the local models uploaded by the target client and combines them with the weight information to obtain the global model.
6. The method for training server and client models of personalized federated learning based on adaptive hierarchical parameter reorganization according to claim 1, characterized in that: Step S5 includes: S51. Obtain the round P corresponding to the check node and the performance index value acc of the first F rounds respectively; S52. When the acc of the previous round i is less than the acc of the current round i+1, set β to 1; when the acc of the previous round i is greater than or equal to the acc of the current round i+1, set β to -1, which is specifically the following formula: S53. Calculate the β values between each two rounds of round P and the first F rounds in order, and add up the obtained β values to obtain the reverse sum accs, which is calculated specifically according to the following formula: S54. The judgment function isFedAlr is set according to the reverse order and accs. When accs is greater than or equal to 0, the overall trend is rising, and it is judged that the local model of the target client needs to be reorganized in terms of hierarchical parameters. Otherwise, it is not necessary. The specific calculation is based on the following formula: S55. Dynamically calculate the next round P' of recombination detection, specifically according to the following formula: P'=P-isFedAlr×rnd Where rnd is a random integer selected from 1-3; S56. If the judgment result is that reorganization is needed, continue to execute step S6, otherwise jump directly to step S7.
7. The method for training server and client models of personalized federated learning based on adaptive hierarchical parameter reorganization according to claim 1, characterized in that: Step S6 includes: S61. Obtain the initialized local model weight list; S62. Obtain a layer name list of the local model corresponding to the target client; S63. Traverse the layers of all clients and compare the inter-layer input and output similarities between different clients in the same layer according to the similarity comparison formula; S64. Pair the layers of the two clients with the highest similarity, and store the pairing results in a dictionary. The pairing results include the best "layer-index" pair of one client for the other client in the two clients with the highest similarity; S65. Combine all dictionaries into a new list in client order, where the new list is used to store the similarity between client layers; S66. According to the guidance of the dictionary list by "layer-index", a reorganized local model weight list is obtained.
8. The method for training server and client models of personalized federated learning based on adaptive hierarchical parameter reorganization according to claim 7, characterized in that: Step S7 includes: The reorganized local model weight list is sent to the server, and the server updates the weights according to the reorganized local model weight list, and sends the local model with updated weights to the corresponding target client.
9. The method for training server and client models of personalized federated learning based on adaptive hierarchical parameter reorganization according to claim 8, characterized in that: Step S8 includes: S81. The client loads the personalized local model according to the local model after the weight update; S82. The client trains a new local model using the preprocessed training data set stored locally; S83. The client uploads a new local model to the server again.
10. A system for training a personalized federated learning server and client model based on adaptive hierarchical parameter reorganization, executing the method for training a personalized federated learning server and client model based on adaptive hierarchical parameter reorganization as described in any one of claims 1 to 9, characterized in that: include: Processing module, server module, client module; The processing module is used to obtain a training data set and perform preprocessing; The server module is used to initialize the global model and send it to the client module; The server module is also used to select a target client participating in the training and obtain a local model uploaded by the target client; aggregate the local models uploaded by the target client in the client module; The processing module is also used to dynamically determine whether it is necessary to reorganize the hierarchical parameters of the local model of the target client based on the adaptive detection algorithm of the performance index; when reorganization is required, the hierarchical parameter reorganization algorithm based on the personalized decision-making is used to reorganize the hierarchical parameters of the local model of the target client; The server module updates the local model weights of each target client according to the reorganized hierarchical parameters and sends the local model to the corresponding target client; The client module is also used to update the local model according to the reorganized layer parameters through the target client, and complete the local model local training and local model update according to the preprocessed training data set; The processing module is also used to repeat the above steps until the global model of the server module converges.