A picture classification model training and picture classification method
By dynamically adjusting the model parameter proportion and cross-entropy loss update parameters using reinforcement learning in personalized federated learning, the problem that the model cannot predict other domain data due to overfitting local domain distributions is solved, achieving more efficient training and more accurate classification results.
Patent Information
- Application Number
- CN202411642984.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-18
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2044-11-18
AI Technical Summary
When the existing personalized federated learning method processes data in different fields, the model cannot accurately predict data in other fields due to overfitting local domain distributions, and ignores the heterogeneity requirements of different layers in the model, resulting in low training efficiency and classification accuracy.
Reinforcement learning is used to dynamically adjust the ratio of personalized parameters and shared parameters of the local classification model of each client, update the model parameters through cross entropy loss, and calculate global shared parameters according to the parameter aggregation weight during the aggregation process to adapt to the heterogeneity needs of different layers.
It realizes finer-grained hierarchical parameter decoupling, adapts to multiple heterogeneous feature data, improves the training efficiency and classification accuracy of the image classification model, and enhances the robustness and stability of the federated learning model.
Smart Images

Figure CN119152321B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a picture classification model training and a picture classification method, belonging to the technical field of federated learning. Background Art
[0002] Federated learning is a distributed learning paradigm that enables collaborative learning without compromising the privacy of individual participants. The federated average algorithm aims to train a unified global model by iteratively averaging the local model parameters of the client. However, since private data is collected by participants with different preferences, the overall data distribution is non-independent. In a distributed training scenario, each participant tends to optimize its local empirical risk minimization, which is often inconsistent with the global optimal direction, resulting in poor performance of the average global model.
[0003] The personalized federated learning mechanism proposed in the prior art applies image classification, allowing each client to train a customized model to adapt to its own data distribution. At present, most personalized federated learning methods focus on label distribution skew, where the distributed data comes from the same domain and simulates image data heterogeneity through unbalanced sampling. Among them, domain distribution skew is also a heterogeneous data distribution that needs to be considered, that is, private data comes from different domains, and private data in different domains leads to different feature distributions, resulting in the model being unable to accurately predict data in other domains due to overfitting the local domain distribution. Among these personalized methods, a popular method is parameter decoupling, where the model parameters are divided into a global backbone and a personalized head. The global backbone is responsible for extracting common features and is centrally trained using a federated average algorithm, while the personalized head is fine-tuned for the specific data features of each client. The advantage of this method is that it enhances the personalization of the local model while improving communication efficiency. For example, federated learning of personalized layers and personalized federated learning using shared representations, by dividing a given backbone network into a head and a feature extractor, personalizes the top layer and classifier of the model respectively, and only shares the feature extractor between the server and the client; Federated learning of non-IID features based on local batch normalization, trains local batch normalization parameters during local model training on each client, but excludes these parameters during global model updates, effectively solving the problem of skewed feature distribution. Federated learning of image classification that bridges sharing and personalization explicitly decouples the global and personalized tasks of the model by introducing two prediction tasks, and assigns model parameters to different prediction tasks. However, most of these methods are limited to single-layer personalization, requiring prior knowledge to determine which layers need to be personalized through layer-by-layer reasoning, ignoring the heterogeneous requirements of different layers in the model, resulting in inaccurate personalization and affecting the training efficiency of personalized federated learning. Summary of the invention
[0004] The purpose of the present invention is to overcome the deficiencies in the prior art, provide a picture classification model training and picture classification method, solve the heterogeneity requirements of different layers in the model, and improve training efficiency.
[0005] In order to achieve the above object, the technical solution adopted by the present invention is:
[0006] In a first aspect, the present invention provides a method for training an image classification model, comprising:
[0007] Reinforcement learning is used to dynamically adjust the ratio of personalized parameters to shared parameters of each client's local classification model to obtain an adjusted local classification model;
[0008] Input the local image dataset marked with real labels into the corresponding adjusted local classification model to obtain the predicted image classification results;
[0009] Calculate the cross entropy loss based on the input local image data, true labels and predicted image classification results;
[0010] Based on the cross entropy loss, the personalized parameters and shared parameters in the local classification model are updated, and the updated personalized parameters and shared parameters of each client are obtained;
[0011] Input the updated personalized parameters and shared parameters of each client into the pre-built objective function, and assign the parameter aggregation weight of each client with the goal of minimizing the objective function;
[0012] Calculate the global shared parameters according to the parameter aggregation weights assigned to each client, and update the shared parameters of each client's local classification model to the global shared parameters;
[0013] Repeat the above steps until the local classification model of each client converges to obtain the trained image classification model.
[0014] In combination with the first aspect, further, the expression when the objective function is minimum is:
[0015] ,
[0016] In the formula, Represents the client The parameter aggregation weights, The range is from 1 to K , K Indicates the number of clients; Indicates the personalized parameters of all clients. Represents the shared parameters of all clients. Represents the client Personalized parameters, Represents the client The shared parameters, Represents the client The loss function is F represents the loss function.
[0017] Furthermore, reinforcement learning is used to dynamically adjust the ratio of personalized parameters to shared parameters of the local classification model of each client to obtain the adjusted local classification model, including:
[0018] According to the variance of the personalized parameters and shared parameters of each layer in the local classification model and the current decoupling ratio of each layer, the state space of each layer is obtained;
[0019] Based on the state space of each layer, maximize the expected reward function to obtain the optimal action;
[0020] According to the optimal action, an adjusted local classification model is obtained.
[0021] Furthermore, the state space of each layer is expressed as:
[0022]
[0023] In the formula, Represents the client In the The state of the layer, The range is from 1 to K , K Indicates the number of clients; The range is from 1 to N , N Indicates the total number of layers of the client's local classification model; and Respectively represent the client The local classification model in The variance of the layer’s personalized parameters and the variance of the shared parameters, is the decoupling ratio, indicating that the client The local classification model in The personalized parameter ratio of the layer.
[0024] Furthermore, the maximized expected reward function is expressed as:
[0025] ,
[0026] In the formula, represents the expected reward function, is the discount factor used to discount future rewards, Indicates the trajectory The expected value of Follow the distribution , trajectory In reinforcement learning, it represents the state-action sequence from the initial state to the final state. For each time step in the trajectory From 0 to H Sum, H is the maximum number of time steps of the trajectory; Indicates the serial number of the client. K Indicates the number of clients. Indicates the hierarchical sequence number of the client's local classification model. The range is from 1 to N , N Indicates the total number of layers of the client's local classification model; and Respectively represent the client The local classification model in The variance of the layer's personalized parameters and the variance of the shared parameters.
[0027] Furthermore, the personalized parameters and shared parameters in the local classification model are updated based on the cross entropy loss, and the updated personalized parameters and shared parameters of each client are obtained as follows:
[0028] ,
[0029] ,
[0030] In the formula, Represents the client Updated personalization parameters, Represents the client Updated shared parameters, Represents the client Personalized parameters, Represents the client The shared parameters of Represents the learning rate, which is a hyperparameter used to determine the step size of a gradient descent update; Represents a gradient descent The change value of Represents a gradient descent The change value of
[0031] is the cross entropy loss, , represents the cross entropy loss function, Represents the client Input image data sample, Represents the classification prediction value of the image data, represents the true label of the image data, Represents the sum of the loss values of all clients, where Indicated in the sample In each data point and the corresponding true label Appear in pairs.
[0032] Furthermore, the parameter aggregation weights assigned to each client are:
[0033] ,
[0034] In the formula, Aggregate weights for parameters assigned to each client; Represents the client The amount of data in the local image dataset, Indicates the serial number of the client. K Indicates the number of clients. is a small constant that prevents division by zero. represents the difference between the local subnet and shared subnet predictions;
[0035] ,
[0036] In the formula, Represents the local subnet prediction value, represents the shared subnetwork prediction value, express Divergence.
[0037] Furthermore, the expression for calculating the global shared parameter according to the parameter aggregation weights assigned to each client is:
[0038] ,
[0039] represents the global shared parameters after aggregation, Represents the client Uploaded shared parameters, Represents the client The aggregate weight corresponding to the uploaded shared parameters, The range is from 1 to K , K Indicates the number of clients.
[0040] In a second aspect, the present invention provides a method for image classification, which inputs an image to be classified into an image classification model obtained by training using any of the above-mentioned image classification model training methods to obtain an image classification result.
[0041] In a third aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in any one of the first aspect or the method described in the second aspect.
[0042] Compared with the prior art, the present invention has the following beneficial effects:
[0043] (1) The present invention fully considers the heterogeneity requirements of different layers in the model and realizes dynamic hierarchical decoupling by using reinforcement learning. It is not limited to personalized processing of a single layer or certain layers, but realizes more fine-grained hierarchical parameter decoupling. It can adapt to a variety of heterogeneous feature data and provide more accurate and universal classification results on different types of heterogeneous data.
[0044] (2) The present invention updates the personalized parameters and shared parameters in the local classification model based on the cross-entropy loss function. It not only personalizes the specific layers, but also takes into account the sensitivity of different layers in the model to heterogeneous data, realizes hierarchical model personalization, and allocates parameter weights of each client in different layers during the aggregation process.
[0045] (3) The present invention uses the prediction values obtained from the personalized subnet and shared subnet of each client to allocate the parameter aggregation weights of each client to obtain the aggregated global shared parameters. Divergence and data volume, enhance the robustness of the federated learning model, and adjust the contribution of each client according to the difference between the local model and the global model prediction and the data volume of each client's local image dataset, thereby alleviating the impact of data heterogeneity and promoting stability and fairness.
[0046] (4) The present invention can automatically adapt to the data characteristics of different clients and utilize the sensitivity of different layers of the neural network to heterogeneous data to provide more accurate and universal classification results on different types of heterogeneous data. It can handle image classification tasks in various data heterogeneous scenarios including those with skewed label distribution and skewed domain distribution, improve the training efficiency in personalized federated learning and the image classification accuracy in different heterogeneous feature data scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 is a flow chart of a method for training a picture classification model provided by an embodiment of the present invention;
[0048] Figure 2 It is a schematic diagram of an image classification model training provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0049] The present invention will be further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and cannot be used to limit the protection scope of the present invention.
[0050] Embodiment 1:
[0051] An embodiment of the present invention provides a method for training an image classification model, such as Figure 2 As shown in the figure, it is a schematic diagram of image classification model training. First, initialize the local data set, build a local classification model, and define the objective function of image classification model training, as follows:
[0052] Initialize local dataset: for client Accessible local image datasets ,Under the data heterogeneity setting, the data distribution of two different clients is different,,i.e. ,in, , They all represent the serial numbers of different clients, specifically:
[0053] (1) The label distribution varies between different clients, that is, ;
[0054] (2) The distribution of conditional features for a given tag varies across clients ,even though ;
[0055] The present invention uses federated learning benchmark datasets, including EMNIST, FMNIST, CIFAR-10, CIFAR-100, Digits5, and DomainNet datasets. In order to study the problem of label distribution skew, the present invention uses statistical heterogeneity settings on the EMNIST, FMNIST, CIFAR-10, and CIFAR-100 datasets. The present invention sets the hyperparameters of the Dirichlet distribution Set to 0.1 and 0.5 to generate two different distributions. The smaller the hyperparameter setting, the more prominent the heterogeneity of label distribution skew on these image datasets. In order to evaluate the effectiveness of solving the problem of domain distribution skew, this embodiment is extensively verified on two real-world image datasets, namely the DomainNet dataset, which contains natural images from six different data sources: Clipart, Infograph, Painting, Quickdraw, Real, and Sketch; and the mixed digital dataset Digits5, which consists of five data sources: MNIST, SVHN, USPS, SynthDigits, and MNIST-m.
[0056] Build a local classification model:
[0057] Regarding the label distribution skew problem, for EMNIST, FMNIST, and CIFAR-10, the embodiment of the present invention uses a four-layer CNN model for training. For CIFAR-100, the embodiment of the present invention uses ResNet-18. Regarding the domain distribution skew problem, the classification model of the embodiment of the present invention adopts the AlexNet architecture, and adds a BN layer after each convolutional layer and fully connected layer. Before entering the neural network, all images are resized to 256 × 256 × 3.
[0058] For clients , each client The network is composed of personalized parameters and shared parameters Composition. For personalized parameters , introducing the decoupling ratio Adjust the ratio of personalized parameters and global parameters of each layer of the client.
[0059] The client parameters are expressed as:
[0060] ,
[0061] In the formula, Represents the client exist The parameters of the layer, The range is from 1 to K , The range is from 1 to N , K Indicates the number of clients. N Indicates the total number of layers of the client's local classification model; is the decoupling ratio, indicating that the client The local classification model in The personalized parameter ratio of the layer, between 0 and 1; Represents the client In the The shared parameters of the layer, Represents the client In the Personalization parameters of the layer;
[0062] Define the objective function: The local classification model works by training a set of K model to adapt it to The client's local image dataset does not need to be shared with other clients.
[0063] Corresponding to the client The loss function is defined as:
[0064] ,
[0065] in Indicated by the parameter The network output composed of the given input image data The true label The sample loss between Indicates the personalized parameters of all clients. Represents the shared parameters of all clients. Represents the client The loss function is Represents all samples in the client image dataset Calculate the expected value.
[0066] For all clients, the expression of the minimum overall objective function is:
[0067] ,
[0068] In the formula, Represents the client The parameter aggregation weights, K Indicates the number of clients. Represents the client Personalized parameters, Represents the client The shared parameters of Represents the client Personalized parameters, Represents the client The shared parameters of F Represents the loss function, which aims to minimize the weighted loss function of all clients.
[0069] like Figure 1 As shown in the figure, it is a flowchart of the training method of the picture classification model, which specifically includes the following steps:
[0070] S1. Use reinforcement learning to dynamically adjust the ratio of personalized parameters to shared parameters of each client's local classification model to obtain the adjusted local classification model;
[0071] S2. Input the local image dataset marked with the real label into the corresponding adjusted local classification model to obtain the predicted image classification result;
[0072] S3 then calculates the cross entropy loss based on the input local image data, the true label and the predicted image classification result;
[0073] S4. Update the personalized parameters and shared parameters in the local classification model based on the cross entropy loss, and obtain the updated personalized parameters and shared parameters of each client;
[0074] S5. Input the updated personalized parameters and shared parameters of each client into the pre-built objective function, and allocate the parameter aggregation weight of each client with the goal of minimizing the objective function;
[0075] S6. Calculate the global shared parameters according to the parameter aggregation weights assigned to each client, and update the shared parameters of the local classification model of each client to the global shared parameters;
[0076] S7. Repeat steps S1-S6 until the local classification model of each client converges, and obtain the trained image classification model.
[0077] Step S1 uses reinforcement learning to dynamically adjust the ratio of personalized parameters to shared parameters of each client's local classification model, which specifically includes the following sub-steps:
[0078] S1.1. Markov decision process: In order to dynamically adjust the decoupling ratio of each layer of the client, the embodiment of the present invention adopts a reinforcement learning method. Specifically, the dynamic adjustment of the decoupling ratio of each layer of the client is modeled as a Markov decision process.
[0079] The Markov decision process is defined as .in, represents the Markov decision process, S represents the state space, and A represents the action space; for represents the state transition probability, , indicating the state at that moment, Indicates the state at the next moment. , indicating the action at that moment; represents the initial state distribution, represents the reward function.
[0080] The interactions between the agent and the environment are described as trajectories . The agent follows the policy . Trajectory The sampling probability depends on the strategy , defined as follows:
[0081] ,
[0082] Indicated in the parameter Generate trajectory The probability distribution of In reinforcement learning, it represents the sequence of states and actions from the initial state to the final state. is the initial state distribution function, indicating that at the initial time step When in state The probability of is a cumulative symbol, indicating that for each time step arrive The product of strategy is a conditional probability distribution, expressed in terms of parameters In this case, the agent is in state Take action when The probability of Indicates taking action After that, from the state Transition to next state The probability of Indicates that at time step The state of Indicates that at time step The state of Indicates that at time step The action of time, represents the strategy parameters, which are used to adjust the probability distribution of the strategy. H is the maximum number of time steps for the trajectory.
[0083] Trajectory The discounted total reward is defined as:
[0084] ,
[0085] in is the discount factor, which attenuates future rewards, Indicates The reward at each time step will be of Second power discount. is the cumulative reward, which is used to measure the The cumulative reward from the initial state to the final state. Contains a sequence of states and the corresponding action sequence , Represents the time step arrive Gradually accumulate the rewards for each time step.
[0086] S1.2. Reinforcement Learning Objective Definition: State Represents the client exist The state of the layer, which contains the client In layer Decoupling ratio and other relevant parameters.
[0087] ,
[0088] in and Respectively represent the client The local classification model in The variance of the layer's personalized parameters and the variance of the shared parameters.
[0089] Action Space Composed of possible adjustments of the decoupling ratio, each action , modify the decoupling ratio according to the action , Represents the client In the The actions of the layer are defined as follows:
[0090] ,
[0091] Transition probability Indicates taking action From the state Transition to next state The probability of Indicates that at the next moment the client exist The state of the layer, specifically:
[0092] .
[0093] Reward Function , Represents the client In the The reward of the layer guides the adjustment of the decoupling ratio by considering the consistency of parameter updates:
[0094] ,
[0095] Adjusting the decoupling ratio using reinforcement learning The goals are to:
[0096] ,
[0097] In the formula, represents the expected reward function, Indicates the trajectory The expected value of Follow the distribution , For each time step in the trajectory From 0 to H Sum, H is the maximum number of time steps for the trajectory.
[0098] S1.3, Application of SAC algorithm: The embodiment of the present invention adopts the SAC reinforcement learning algorithm to optimize the strategy of adjusting the decoupling ratio. SAC is a reinforcement learning algorithm that combines value-based and policy-based methods to select actions that maximize the expected reward on the trajectory. The SAC algorithm ensures that the decoupling ratio can be dynamically adjusted to achieve the best performance for different clients by balancing exploration and development update strategies. In addition, the entropy regularization term in the SAC algorithm encourages exploration, avoids falling into local suboptimal values, and effectively improves the overall adaptability of the local classification model.
[0099] In steps S2 and S3, the embodiment of the present invention inputs the local image data set marked with the real label into the corresponding adjusted local classification model, obtains the predicted image classification result, and calculates the cross entropy loss according to the input local image data, the real label and the predicted image classification result, specifically including:
[0100] For the entire network parameters , the network parameters are generally divided into personalized parameters and shared parameters The embodiment of the present invention will be based on and The subnets with parameters are written as and For the client, Plan to Learn personalized local representations in It means to learn the global generalization representation. and The overall network is represented as For each input sample , respectively from , and Collecting Predictions , and .
[0101] Overall prediction Minimize and True Label The cross entropy loss between , defined as follows:
[0102] ,
[0103] in, represents the cross entropy loss function, Represents the client Input image data sample, Represents the classification prediction value of the image data, represents the true label of the image data, Represents the sum of the loss values of all clients, where Indicated in the sample In each data point and the corresponding true label Appear in pairs.
[0104] In step S4, the personalized parameters and shared parameters in the local classification model are updated based on the cross entropy loss, and the updated personalized parameters and shared parameters of each client are obtained, which specifically includes:
[0105] The updated personalized parameters Keep it locally without global aggregation, and share the parameters Upload to the central server for aggregation. For each client, the local personalized parameters and shared parameters The update is expressed as follows:
[0106] ,
[0107] ,
[0108] in is the learning rate, a hyperparameter used to determine the step size of a gradient descent update. Represents a gradient descent The change value of Represents the client Updated personalization parameters, Represents the client Updated shared parameters, Represents a gradient descent The change value of .
[0109] In step S5, the updated personalized parameters and shared parameters of each client are input into the pre-built objective function, and the parameter aggregation weight of each client is allocated with the minimum objective function as the goal, which specifically includes the following steps:
[0110] Defining parameter aggregation weights: To further improve personalized parameters and shared parameters The semantic consistency between Divergence is used to measure the difference between the predictions of each client's personalized sub-network and the shared sub-network, and combined with the amount of data in each client's local image dataset to ultimately determine the shared parameters of each client. Parameter aggregation weight , The specific definition is as follows:
[0111] ,
[0112] in Represents the client The amount of data in the local image dataset, is a small constant that prevents division by zero. represents the difference between the local subnet and shared subnet predictions;
[0113] ,
[0114] in express Divergence, The smaller the value, the closer the predicted value of the local subnet in the client is to the predicted value of the shared subnet, which means that the parameters of the client are more helpful for global generalization.
[0115] The embodiment of the present invention is based on the client with a smaller metric value. give Higher aggregation weight .
[0116] In step S6, the global shared parameters are calculated according to the parameter aggregation weights assigned to each client, and the shared parameters of the local classification model of each client are updated to the global shared parameters. The specific steps are as follows:
[0117] Global shared parameter aggregation: Global shared parameters are shared parameters uploaded by each client. and the corresponding aggregation weight Definition, expressed as:
[0118] .
[0119] The embodiment of the present invention introduces Divergence and data volume improve the convergence speed of the image classification model. The contribution of each client is adjusted according to the difference between the local model and the global model prediction and the data volume of each client's local image dataset, thereby alleviating the impact of data heterogeneity and accelerating the convergence of the classification model.
[0120] In step S6, the central server updates the global shared parameters Distribute to all clients, each client uses global shared parameters Replace the previous shared parameters , but does not update the parameters retained locally , each client gets a new local classification model network .
[0121] S7. Repeat steps S1-S6 until the local classification models of each client converge, and obtain the trained image classification model.
[0122] Embodiment 2:
[0123] An embodiment of the present invention provides an image classification method, which inputs the to-be-identified images obtained by each client into an image classification model trained by any of the above-mentioned image classification model training methods to obtain image classification results for actual application scenarios.
[0124] Embodiment three:
[0125] An embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the computer program implements any of the above-mentioned image classification model training methods or the above-mentioned image classification methods.
[0126] The above is only a preferred embodiment 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 technical 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 an image classification model, characterized in that: include: Reinforcement learning is used to dynamically adjust the ratio of personalized parameters to shared parameters of each client's local classification model to obtain an adjusted local classification model; Input the local image dataset marked with real labels into the corresponding adjusted local classification model to obtain the predicted image classification results; Calculate the cross entropy loss based on the input local image data, true labels and predicted image classification results; Based on the cross entropy loss, the personalized parameters and shared parameters in the local classification model are updated, and the updated personalized parameters and shared parameters of each client are obtained; Input the updated personalized parameters and shared parameters of each client into the pre-built objective function, and assign the parameter aggregation weight of each client with the goal of minimizing the objective function; Calculate the global shared parameters according to the parameter aggregation weights assigned to each client, and update the shared parameters of each client's local classification model to the global shared parameters; Repeat the above steps until the local classification model of each client converges to obtain the trained image classification model; Reinforcement learning is used to dynamically adjust the ratio of personalized parameters to shared parameters of each client's local classification model to obtain the adjusted local classification model, including: According to the variance of the personalized parameters and shared parameters of each layer in the local classification model and the current decoupling ratio of each layer, the state space of each layer is obtained; Based on the state space of each layer, maximize the expected reward function to obtain the optimal action; According to the optimal action, an adjusted local classification model is obtained; The state space of each layer is represented as: , In the formula, Represents the client In the The state of the layer, The range is from 1 to , Indicates the number of clients; The range is from 1 to N , N Indicates the total number of layers of the client's local classification model; and Respectively represent the client The local classification model in The variance of the layer’s personalized parameters and the variance of the shared parameters, is the decoupling ratio, indicating that the client The local classification model in Personalized parameter ratio of the layer; The maximized expected reward function is expressed as: , In the formula, represents the expected reward function, is the discount factor used to discount future rewards, Indicates the trajectory The expected value of Follow the distribution , trajectory In reinforcement learning, it represents the state-action sequence from the initial state to the final state. For each time step in the trajectory From 0 to H Sum, H is the maximum number of time steps of the trajectory; Indicates the serial number of the client. Indicates the number of clients. Indicates the hierarchical number of the client's local classification model. The range is from 1 to N , N Indicates the total number of layers of the client's local classification model; and Respectively represent the client The local classification model in The variance of the layer's personalized parameters and the variance of the shared parameters.
2. The method according to claim 1, characterized in that The expression for the minimum objective function is: , In the formula, Represents the client The parameter aggregation weights, The range is from 1 to , Indicates the number of clients; Indicates the personalized parameters of all clients. Represents the shared parameters of all clients. Represents the client Personalized parameters, Represents the client The shared parameters, Represents the client The loss function is F represents the loss function.
3. The method according to claim 1, characterized in that Based on the cross entropy loss, the personalized parameters and shared parameters in the local classification model are updated, and the updated personalized parameters and shared parameters of each client are obtained as follows: , , In the formula, Represents the client Updated personalization parameters, Represents the client Updated shared parameters, Represents the client Personalized parameters, Represents the client The shared parameters of Represents the learning rate, which is a hyperparameter used to determine the step size of a gradient descent update; Represents a gradient descent The change value of Represents a gradient descent The change value of is the cross entropy loss, , represents the cross entropy loss function, represents the image data sample input by client i, Represents the classification prediction value of the image data, represents the true label of the image data, Represents the sum of the loss values of all clients, where Indicated in the sample In each data point and the corresponding true label Appear in pairs.
4. The method according to claim 1, characterized in that: The parameter aggregation weights assigned to each client are: , In the formula, Aggregate weights for parameters assigned to each client; Represents the client The amount of data in the local image dataset, Indicates the serial number of the client. Indicates the number of clients. is a small constant that prevents division by zero. represents the difference between the local subnet and shared subnet predictions; , In the formula, Represents the local subnet prediction value, represents the shared subnetwork prediction value, express Divergence.
5. The method according to claim 1, characterized in that The expression for calculating the global shared parameters based on the parameter aggregation weights assigned to each client is: , represents the global shared parameters after aggregation, Represents the client Uploaded shared parameters, Represents the client The aggregate weight corresponding to the uploaded shared parameters, The range is from 1 to , Indicates the number of clients.
6. A method for image classification, characterized in that: Input the image to be classified into the image classification model trained by the method described in any one of claims 1 to 5 to obtain the image classification result.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Image classification method based on personalized federated learning and conditional generative adversarial network
CN117788949A
Semi-asynchronous federal optimization method based on prepolymerization and information theory
CN118350453A