Federal learning model optimization method and system and image recognition method and system

By optimizing the federated learning model through hypersphere decoupling training and negative label distillation methods, the problems of feature offset and knowledge degradation caused by data heterogeneity are solved, and the accuracy and efficiency of image recognition are improved, especially in cross-institutional collaborative modeling and disease diagnosis in the medical field.

CN120688656APending Publication Date: 2025-09-23YUNNAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510816138.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-18
Publication Date
2025-09-23

AI Technical Summary

Technical Problem

Federated learning suffers from local model feature offset, global knowledge degradation, and insufficient communication efficiency due to client data heterogeneity, leading to poor performance in image recognition in the medical field.

Method used

The hypersphere decoupling training method and the negative label distillation method are used to optimize the federated learning model. The classifier weights and feature extractor are optimized through the hypersphere consistency loss function and the negative label distillation loss function to ensure that the classifier weights are equiangularly distributed on the hypersphere. The non-true category probability distribution generated by the global model is used as a soft target to correct the local optimization path of the local model.

Benefits of technology

It significantly improves the recognition accuracy and efficiency of the federated learning model, solves the problems of blurred decision boundaries and global knowledge forgetting caused by data heterogeneity, and achieves accurate diagnosis and privacy protection in complex data environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120688656A_ABST
    Figure CN120688656A_ABST
Patent Text Reader

Abstract

The invention discloses a federated learning model optimization method and system and an image recognition method and system, and relates to the technical field of machine learning, and the method comprises the steps: constructing a sample data set; initializing a federated learning model; the federal learning model comprises a global model and a plurality of local models; each of the global model and the local model comprises a feature extractor and a classifier; and based on the sample data set, optimizing the federated learning model by adopting a hyperspherical decoupling training method and a negative label distillation method to obtain an optimized federated learning model. According to the invention, the precision and efficiency of federal learning model recognition can be improved, and the precision and efficiency of image recognition can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of machine learning technology, and in particular to a federated learning model optimization method and system and an image recognition method and system. Background Art

[0002] Driven by the wave of digitalization, the demand for edge computing and privacy protection is rapidly growing. In this context, federated learning, as a distributed machine learning paradigm, stands out due to its unique advantages. Federated learning allows clients to complete model training locally, uploading only the trained parameters to the server for aggregation, becoming a core technology for addressing data privacy and data silos.

[0003] However, in practical applications, federated learning presents numerous challenges due to significant differences in the distribution of local data across different clients. For example, in the medical field, bacterial pneumonia predominates in X-ray data from Hospital A, with 68% of cases showing lobar consolidation. In contrast, viral pneumonia predominates in Hospital B, with 72% of cases exhibiting ground-glass opacities. This disparate distribution of client data is also known as data heterogeneity. This heterogeneity can lead to biased feature representation in clients. For example, Hospital A's feature extractor overly focuses on regions with consolidation CT values ​​greater than 30 HU, neglecting other potentially important features. It can also cause classifier weight shifts, such as Hospital B's overly expanded weight for viral pneumonia, which crowds out the classification space for other categories. These issues can cause local model drift, leading to poor performance of the aggregated global model for certain specific cases. For example, for interstitial pneumonia cases from Community Hospital C (which only account for 5%), the global model's recognition rate is surprisingly low at less than 10%. In even more extreme heterogeneous scenarios, such as when Hospital D provided only 12 cases of Mycoplasma pneumonia, the imaging features exhibited a grid-like pattern of interstitial infiltration. Traditional federated learning methods (such as FedAvg) suffer from bias in local training, and these unique imaging features are completely forgotten by the global model, significantly hindering accurate disease diagnosis.

[0004] From this, we can see that federated learning has problems such as local model feature offset, global knowledge degradation, and insufficient communication efficiency caused by heterogeneous data distribution. Summary of the Invention

[0005] The purpose of this application is to provide a federated learning model optimization method and system and an image recognition method and system, which can improve the accuracy and efficiency of federated learning model recognition, as well as improve the accuracy and efficiency of image recognition.

[0006] To achieve the above objectives, this application provides the following solutions:

[0007] In a first aspect, the present application provides a federated learning model optimization method, comprising:

[0008] Construct a sample dataset;

[0009] Initializing a federated learning model; the federated learning model includes a global model and multiple local models; the global model and the local model each include a feature extractor and a classifier;

[0010] Based on the sample dataset, the hypersphere decoupling training method and the negative label distillation method are used to optimize the federated learning model to obtain an optimized federated learning model.

[0011] In a second aspect, the present application provides a federated learning model optimization system, comprising:

[0012] Construction module, used to construct sample data sets;

[0013] An initialization module, configured to initialize a federated learning model; the federated learning model includes a global model and multiple local models; the global model and the local model both include a feature extractor and a classifier;

[0014] An optimization module is used to optimize the federated learning model based on the sample data set by using a hypersphere decoupling training method and a negative label distillation method to obtain an optimized federated learning model.

[0015] In a third aspect, the present application provides an image recognition method, comprising:

[0016] Obtain the image to be recognized;

[0017] The image to be recognized is input into the global model of the optimized federated learning model described in the first aspect above to obtain the image recognition result.

[0018] In a fourth aspect, the present application provides an image recognition system, comprising:

[0019] An image acquisition module, used to acquire an image to be identified;

[0020] The image recognition module is used to input the image to be recognized into the global model of the federated learning model described in the first aspect above to obtain the image recognition result.

[0021] According to the specific embodiments provided in this application, this application has the following technical effects:

[0022] (1) The minimum hypersphere energy loss function is maximized through the hyperspherical uniformity gap (HUG) method to maximize the inter-class distance, eliminate the bias phenomenon of the classifier weight caused by data heterogeneity in the traditional method, and make the classifier weight vector present an equiangular distribution on the hypersphere, which significantly improves the rationality of the decision boundary and improves the accuracy and speed of the final classification result of the classifier, thereby improving the accuracy and efficiency of the federated learning model recognition; the global model of the optimized federated learning model is used to identify the image to be identified, which can accurately and quickly identify the image to be identified and obtain the image recognition result, thereby improving the accuracy and efficiency of image recognition.

[0023] (2) The negative label distillation method uses the non-real category probability distribution generated by the global model as a soft target, so that the local model retains global knowledge in the feature space. The negative class gradient direction provided by the global model corrects the local optimization path of the local model, thereby achieving strong robustness to extreme data heterogeneity. Through the classifier-feature representation decoupling architecture, the classifier layer is not disturbed by the local feature distribution of the local model, so that the global model can quickly and accurately identify, thereby improving the accuracy and efficiency of the federated learning model recognition. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0025] Figure 1 A schematic diagram of the federated learning process provided in one embodiment of the present application.

[0026] Figure 2 A flowchart of a federated learning model optimization method provided in one embodiment of the present application.

[0027] Figure 3 Schematic diagram of client data distribution.

[0028] Figure 4 Schematic diagram of the process of processing data for global and local models. DETAILED DESCRIPTION

[0029] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0030] Federated Learning is a distributed machine learning paradigm that allows multiple clients (such as mobile devices and edge servers) to collaborate on training a global model without sharing the original data. Figure 1 As shown, the client for this round is first selected. The parameters of the global model on the central server (i.e., the server) are sent to the client's local model. The local model is trained using its own local data. The trained local model parameters are then sent to the central server for aggregation. The aggregated parameters are then used to update the parameters of the central server's global model. After training is complete, the global model is evaluated. The evaluation process involves testing the trained global model, deploying it by analysts, and obtaining predictions that are compared with the true labels of the data. The prediction accuracy is calculated as the number of samples with the true labels divided by the total number of samples.

[0031] However, in the federated learning process, the imbalanced label distribution of client local data (i.e., the data categories held by different clients vary significantly) leads to the following core problems:

[0032] 1. Local model bias: When the client's local data categories are severely skewed (for example, client 1's cat samples account for 68%, while birds account for only 3%; client 2: car samples account for 72% (including cars and trucks), and ships are completely missing), the trained local model will over-adapt to the dominant category and ignore the scarce category. Specifically, it manifests as: Feature space distortion: The feature extractor of the local model will over-compress the feature distribution of the dominant category (for example, client 1's cat features are concentrated in a local area of ​​the hypersphere). Classifier weight bias: The classifier's weight vector for the dominant category (such as cats) occupies a larger hypersphere space, causing the weights of other categories (such as birds) to be squeezed. For example, when testing, the local model of client 1 has an accuracy of 89.2% for local cat test samples and only 6.7% for global bird test samples (due to too little local bird data); however, the local model of client 2 is completely unable to recognize ship samples (there are no relevant samples in the local data).

[0033] 2. Global knowledge degradation: During the parameter aggregation phase, after the offset models from different clients are fused, the global model can experience: Blurred decision boundaries: Classifier weights for different clients conflict (for example, the weight for cats on client 1 is at an odd angle to the weight for cars on client 2). Generalization capability decreases: When the global model is tested across clients (for example, on client 2's ship class), its prediction accuracy significantly decreases. For example, the global model achieved only 7.3% accuracy on client 1's bird test set, while achieving 0% accuracy on client 2's ship test set (because no client provided relevant feature knowledge).

[0034] In some cases, the FedProx, FedFN, and FedKD methods are used to address the problem of local model feature shift in federated learning. However, the FedProx method constrains model updates by using proximal terms, which helps stabilize model training to a certain extent but increases the computational effort. The FedFN method normalizes model features to attempt to eliminate the impact of data heterogeneity, but ignores the fact that local models can forget knowledge, resulting in a decrease in the model's ability to recognize certain categories. The FedKD method improves the transfer of global knowledge to enhance the performance of local models, but lacks the targeted retention of negative label information. For example, the model at Hospital A failed to learn the characteristics of Mycoplasma pneumonia, making it difficult to accurately identify related cases in subsequent applications.

[0035] To address these thorny issues, this application innovatively proposes a federated learning model optimization method. This method employs neural breakdown theory to perform a deep, structured decoupling of the traditional cross-entropy loss through hypersphere decoupling training. This operation successfully constructs two key modules: inter-class separability loss and intra-class compactness loss. This decoupling approach enables independent optimization of the geometrically regularized distribution of classifier weights and the intra-class aggregation characteristics of the feature space. This acts as a "clearing barrier" for the model's decision boundary, effectively eliminating the interference caused by parameter coupling and making model decisions more accurate and efficient.

[0036] At the same time, this application uses a knowledge distillation mechanism based on global negative labels. This mechanism fully utilizes the implicit knowledge generated by the global model, acting like an "intelligent tutor" for the local training process. This mechanism strictly constrains the local training process, ensuring that the client's local model always maintains a high degree of consistency with the global knowledge system, thereby improving the accuracy and efficiency of federated learning model recognition.

[0037] In addition, this application optimizes the feature extractor and classifier in the federated learning model through the hypersphere decoupling training method and the negative label distillation method, significantly improving the model generalization ability in non-independent and identically distributed data scenarios, suppressing local model deviation while reducing communication overhead, and solving the performance degradation problem caused by the conflict between the client's local optimization goal and the global model in traditional methods. It fundamentally solves the performance degradation problem caused by the conflict between the client's local optimization goal and the global model goal in traditional methods, and provides strong support for the application of federated learning in complex data environments.

[0038] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.

[0039] In an exemplary embodiment, Figure 2 As shown, a method for optimizing a federated learning model is provided, comprising the following steps S1 to S3.

[0040] Step S1: Construct a sample dataset.

[0041] Specifically, we use the CIFAR-10 dataset to construct a sample dataset, taking 10 clients as an example. If there are 10 clients, each client has its own local data in is a 32×32 RGB image (such as animals / vehicles in CIFAR-10), There are 10 categories (airplanes, cars, birds, cats, deer, dogs, frogs, horses, ships and trucks).

[0042] The data distribution shows category skew characteristics:

[0043] Client 1: Cat samples account for 68% (including subcategories such as tabby cats and Persian cats), and birds account for only 3%.

[0044] Client 2: Automobile samples account for 72% (including cars and trucks), and ships are completely missing.

[0045] Client 3: Bird samples account for 55%, while cat samples account for only 2%. The other clients 4-10 are similar.

[0046] Client data distribution diagram example Figure 3 As shown below, the darker the color, the more data representing that category.

[0047] Step S2: Initialize the federated learning model; the federated learning model includes a global model and multiple local models; both the global model and the local model include feature extractors and classifiers, such as Figure 4 shown.

[0048] Specifically, initialize the parameters of the feature extractor of the global model Parameters of the classifier with the global model (The subscript g denotes the parameters of the global model, and the superscript 0 denotes the model parameters for communication round 0.) Configure the inter-class separability weight α, the intra-class compactness weight β, the distillation strength coefficient μ, the temperature coefficient τ, the number of communication rounds T, the number of local rounds E, and the learning rate η. The global model is set on the central server, and the local model is set on the client.

[0049] Step S3: Based on the sample data set, the hypersphere decoupling training method and the negative label distillation method are used to optimize the federated learning model to obtain the optimized federated learning model.

[0050] In a specific embodiment, step S3 specifically includes:

[0051] Step S31: Based on the sample data set, a hypersphere decoupling training method is used to calculate the loss function in the local model training process to obtain a hypersphere consistency loss function. The sample data set includes: sample data and corresponding category labels.

[0052] Step S31 specifically includes: inputting the sample data into the feature extractor of the local model to obtain the sample data features; inputting the sample data features into the classifier of the local model to obtain the sample category results; step S313: constructing a hypersphere consistency loss function based on the sample data features and the sample category results.

[0053] Specifically, the central server selects the client and sends the parameters of the global model.

[0054] Execution entity: central server → client, there are T times of communication between the central server and the client.

[0055] When the communication round t∈[1,T], the following operations are performed: the central server selects a client subset K t , the central server sends the current global model parameters (The global model obtained in the previous round) is given to the client subset. For the client k∈K belonging to this subset t , perform client-side optimization.

[0056] After optimization, the client sends the optimized parameters of the local model to the central server.

[0057] Execution entity: client device (parallel execution) → central server.

[0058] Client k has its own local data This dataset consists of N k There are tagged samples. represents the input data (such as cat images, bird images in image classification), is the corresponding category (C is the category set shared by all clients, covering airplanes, cars, birds, cats, deer, dogs, frogs, horses, ships and trucks). The data category distribution of each client has significant differences, which is manifested in the different clients in the category sample data set. The client model adopts a dual-branch structure isomorphic to the global model, including the parameter θ of the feature extractor. k and the classifier parameters φ k .

[0059] In the communication round t, client k receives the global model parameters sent by the central server And use the global model parameters to replace your own model parameters, denoted as (The subscript k represents the parameters of the local model of client k, and the superscript t,0 represents the model parameters of the tth round of communication and the 0th step of local iteration), that is, the global model parameters are used as the starting point for client model training. The client performs phased optimization based on local data: first, the inter-class separability loss is used to constrain the classifier weights to form an equiangular distribution on the hypersphere, and then the intra-class compactness loss is used to drive similar features to converge to the classification weights. At the same time, the negative label distribution generated by the global model is used as the teacher signal for feature normalization distillation. Finally, the client obtains the parameters of the updated feature extractor through gradient descent calculation. and the parameters of the classifier with geometric regularity When the local iteration round is completed, the client sends the model parameters back to the central server.

[0060] The expression of the hypersphere consistency loss function is:

[0061]

[0062]

[0063] Among them, L HUG is the hypersphere consistency loss function; α is the inter-class separability weight; is the classifier weight φ for category label c c The normalized form of is the classifier weight φ for the category label c' c The normalized form of ; β is the compactness weight within the class; is the sample data feature z obtained by the feature extractor for sample data i i The normalized form of A c is the number of sample data i belonging to category label c.

[0064] Specifically, the hypersphere consistency loss function decouples the traditional cross-entropy loss and separately optimizes the model's feature representation and classifier, thereby eliminating the interference of parameter coupling on the model's decision boundary and reducing the loss to achieve the purpose of optimizing the loss function.

[0065] The first part of the hypersphere consistency loss function expression represents maximizing the separability of the classifiers between classes, and letting the normalized classifier weights φ c The design maximizes the separability between classes by summing the negative quadratic norm: when the weights of different classes are and When the spacing increases, As the value of decreases, the inverse optimization forces the weight distance to be maximized, thereby constructing a robust decision boundary to distinguish image categories (such as cats and birds).

[0066] The second part minimizes the compactness of intra-class features, which is used to optimize the feature extractor. For data belonging to category c, the data obtained by the local feature extractor are all intra-class features belonging to category c. By minimizing the Euclidean distance between the features of similar samples and the corresponding classifier weights, the intra-class feature distribution is compressed to combat distribution shifts caused by heterogeneous medical data (such as differences in image categories).

[0067] Step S32: Based on the sample data set, the negative label distillation method is used to calculate the loss function in the local model training process to obtain the negative label distillation loss function.

[0068] Furthermore, step S32 specifically includes:

[0069] Step S321: Based on the parameters of the global model, a teacher model is constructed; based on the parameters of the local model, a student model is constructed; both the teacher model and the student model include a feature extractor and a classifier.

[0070] Step S322: Input the sample data into the feature extractor of the teacher model to obtain the teacher sample data features.

[0071] Step S323: Input the teacher sample data features into the classifier of the teacher model to obtain the teacher sample category result.

[0072] Step S324: Determine the teacher model soft label based on the teacher sample data characteristics and the teacher sample classification results; the teacher model soft label includes negative label information.

[0073] Specifically, in a federated learning scenario based on the CIFAR-10 dataset, the client extracts cross-client negative label knowledge through local data and the global model. Taking client 1 as an example, cat images account for 68% of its local data (including subcategories such as tabby cats and Persian cats), while bird and ship samples account for only 3% or less. When client 1 receives the parameters of the global model sent by the server, Then, for local data (For example, a 32×32 pixel RGB image of a tabby cat) do the following: Input the global feature extractor to get the feature vector Then calculate the logits of this feature on all 10 categories (airplanes, cars, birds, etc.) through the global classifier, and remove the logits of cats to get the logits of the other 9 categories, that is, The other logits are distilled. After smoothing the logits using the temperature coefficient τ, the soft labels of the teacher model are generated.

[0074] Step S325: Input the sample data into the feature extractor of the student model to obtain the student sample data features.

[0075] Step S326: Input the student sample data features into the classifier of the student model to obtain the student sample category results.

[0076] Step S327: Determine the student model soft label based on the student sample data characteristics and student sample category results.

[0077] Specifically, in federated learning based on the CIFAR-10 dataset, the client obtains its own local negative label knowledge through local data and local models. Taking the local training of client 1 as an example, its dataset contains 68% cat images (such as tabby cats and Persian cats), while bird and ship samples account for less than 3%. When the local model of client 1 processes a 32×32 pixel tabby cat image ( When , a 256-dimensional feature vector is first generated by the feature extractor And perform L2 normalization on the features to get the unit vector The local model's classifier then calculates the logits for this feature and the nine other classes except the true label (cat). After removing the cat logit, the remaining logits are scaled and normalized with a temperature coefficient of τ to generate the student model's soft label.

[0078] Step S328: Determine the negative label distillation loss function based on the teacher model soft label and the student model soft label.

[0079] Furthermore, the expression of the negative label distillation loss function is:

[0080] in

[0081]

[0082] Among them, L HKD (·) is the negative label distillation loss function; C is the number of class labels c; Soft labels for the teacher model; is the soft label of the student model; c is the category label index; x is the xth sample data; y is the label of the xth sample data; is the negative label of the x-th sample data; z g,x is the teacher sample data feature; φ g,c is the weight of the classifier in the teacher model; τ is the temperature coefficient; c' is the category index different from the category label index c; is the normalized form of the student sample data characteristics; φ c is the weight of the classifier in the student model.

[0083] Among them, c'≠y represents other classes that are not true classes. For images with the true label "cat" The global model might output raw logits for all classes (e.g., cat = 5.2, dog = 3.8, bird = 3.5, car = 2.1, etc.). It then performs the following key operations: removing the cat logit corresponding to the true label, temperature-scaling and normalizing the remaining nine class logits, and generating a negative label probability distribution. An example output is: {dog: 0.38, bird: 0.32, car: 0.12, ship: 0.08, ...}. This distribution implicitly incorporates cross-client knowledge from the global model, such as car features from client 2 (e.g., tire textures) and bird features from client 3 (e.g., wing edge gradients). Client 1 uses the KL divergence loss to constrain its local predictions to align with this distribution, forcing the local feature extractor to compress cat features (e.g., striped textures) while retaining common features associated with dog markings (Doberman Pinscher) and bird feathers (woodpeckers). Experiments show that this method enables Client 1 to improve the bird recall rate in the global test set from 6.7% to 34.8% while maintaining a local cat class accuracy of 91.5%, and the ship class recognition rate (a category that is completely missing locally) reaches 22.3%, effectively suppressing the feature space distortion caused by data skew.

[0084] Specifically, in federated learning based on the CIFAR-10 dataset, this application uses negative label cross-client knowledge distillation to address the problem of global knowledge forgetting caused by client-side local data category skew. Taking the training process of client 1 as an example, cat images account for 68% of its local data (including subcategories such as tabby cats and Persian cats), while bird and ship samples account for only 3% and 0%, respectively. When client 1 inputs a cat image into the global model (teacher model), the model outputs the original probability distribution of {cat: 0.65, dog: 0.28, bird: 0.07}, where the predicted probability of dog (0.28) reflects the cross-client feature correlation between client 2's car data (such as the local similarity between the car tire texture and cat stripes) and client 3's dog data (such as the black stripes of a Doberman). The teacher model soft labels are calculated, and this distribution dynamically integrates the knowledge of other clients in the global model (such as the wave texture features of the ship class of client 4). At the same time, the student model soft labels are calculated, and its highly cat-biased distribution reflects the influence of local data skew.

[0085] While optimizing for cat features, the local model is forced to improve its responsiveness to non-dominant categories such as dogs (probability increased from 0.10 to 0.20) and birds (0.05 to 0.15). This mechanism allows Client 1's local model to maintain 91.5% cat classification accuracy while increasing the recall of dogs and birds to 34.8% and 22.3% in the global test set, respectively. It also achieves an 18.7% recognition rate for ships (a category Client 1 had never trained on). The federated server aggregates the classifier parameters of each client (such as the cat weight for Client 1 and the car weight for Client 2) and constructs an equiangular distribution on a 256-dimensional hypersphere. This ensures that the cat weight in the global model does not squeeze the feature space of birds or ships, thereby achieving cross-client knowledge compatibility optimization while protecting data privacy.

[0086] Step S33: Determine the total loss function of the local model based on the hypersphere consistency loss function and the distillation loss function.

[0087] Furthermore, the total loss function of the local model is expressed as:

[0088]

[0089] Among them, L H is the total loss function of the local model; L HUG is the hypersphere consistency loss function; μ is the distillation intensity coefficient; τ is the temperature coefficient; L HKD (·) is the negative label distillation loss function; Soft label for student model; Soft labels for the teacher model.

[0090] Step S34: Optimize the federated learning model based on the total loss function to obtain an optimized federated learning model.

[0091] Specifically, client k updates the model parameters by performing gradient descent on the total loss:

[0092]

[0093] in, For client k in the tth communication round, the local iteration optimizes the parameters of the feature extractor of the local model in the eth iteration; For client k in the tth communication round, the local iteration optimizes the parameters of the feature extractor of the local model in the e-1th iteration; η is the learning rate; is the gradient of the feature extractor; L H is the total loss function of the local model; For client k in the tth communication round, the local iteration optimizes the parameters of the classifier of the local model in the e-1th iteration; are the parameters of the feature extractor of the local model in the t-1th communication round; are the parameters of the classifier of the local model in the t-1th communication round; is the sample data set of client k; For client k in the tth communication round, the local iteration optimizes the parameters of the classifier of the local model in the eth iteration; is the gradient of the classifier; L HUG is the hypersphere consistency loss function; are the parameters of the classifier of the first local model in the t-th communication round of local model k.

[0094] When the local iteration number e=E, the client completes this round of training. The client will train the model parameters Sent to the server, the central server performs model aggregation.

[0095] In federated learning based on the CIFAR-10 dataset, the central server integrates the knowledge of each client through a data volume weighted aggregation mechanism to solve the global model bias problem caused by differences in local data distribution. Taking a 10-client scenario as an example, assume that client 1 (data volume 1200) is mainly cat images (accounting for 68%), client 2 (800) focuses on cars (accounting for 72%), client 3 (1500) contains a large amount of bird data (55%), and the remaining clients have similar data distribution and a total data volume of 10,000. In the tth round of communication, each client uploads the model parameters after local training: Client 1 sends the model Its parameters carry the stripe texture features of cats; Client 2 sends the model Encoding the metallic luster characteristics of automobiles; the client 3 sends the model Recording the gradient of the edges of bird feathers. The server calculates the aggregation weights according to the proportion of the data volume of each client (for example, the weight of client 1 is 1200 / 10000 = 0.12, and the weight of client 2 is w0.08), and performs weighted averaging on the feature extractor and the classifier respectively.

[0096] [[ID=​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​): The server sends the global feature extractor and classifier parameters to the client. Taking client 1 as an example, when training with local cat RGB images, the inter-class separability loss (weight α = 0.1) forces the classifier weights to form an equiangular distribution on the hypersphere, eliminating the overlap of decision boundaries caused by data skew in traditional methods. The intra-class compactness loss (β = 15) drives all cat feature vectors to converge towards the classification weight, reducing the standard deviation of the distribution of similar features from 3.8 to 1.2.

[0103] Negative label knowledge distillation (L HKD ): Client 1 inputs the cat image into the global model and obtains the probability distribution of negative categories after removing the true label (for example, the global prediction of a tabby cat image is 28% for birds, 22% for dogs, and 15% for cars, which are smoothed by the temperature coefficient τ = 1). The local prediction distribution (initial bird probability 5%) is constrained to align with the global distribution through the KL divergence loss (weight μ = 10). After E = 5 rounds of local iterations, while the accuracy of client A for cats remains at 91.5%, the recall rates for birds and cars are increased to 34.8% and 28.6% respectively, and the overall accuracy of the global model on the CIFAR-10 test set is increased to 62.9%, and the recognition rate of ships (a category that is scarce for all clients) reaches 22.3%. This method does not increase the exchange of original data, and only transmits model parameters between clients, realizing knowledge collaborative optimization under privacy protection.

[0104] In one embodiment, we first used only the HUG loss function to optimize the model, but found that this would lead to degradation of global knowledge recognition. Then, we added negative label knowledge distillation to optimize the model, which improved the global average accuracy. The specific example is as follows:

[0105] In federated learning, taking the CIFAR-10 dataset and 10 client scenarios as an example, when the client local model is trained using local skewed data, client drift occurs due to uneven category distribution. Specifically, each client trains a local model based on its own data (for example, cat images account for 68% of Client 1's local data, including subcategories such as tabby cats and Persian cats, while birds account for only 3%; Client 2's car images account for 72%, and its local data completely lacks ship images). During the model optimization process, the classification weights produce feature space shifts due to local data skew. For example, when Client 1's local model is optimized using the standard HUG loss function, its cat prediction accuracy can reach 85% (for the local test set), but the recognition accuracy for scarce categories such as birds and ships in the global model drops significantly to 28% or even 7%. This is essentially because the local model overfits to the dominant category (such as cats), causing the classifier weights to over-crowd the hypersphere space (cats are easily distinguished on the hypersphere, while the classifier weights of other missing categories and minority categories are squeezed together (very close and difficult to distinguish)). At the same time, the feature extractor of the local model compresses the distribution radius of cat features (cat features and cat classifier weights are close together, while features of other missing categories and minority categories are close together and difficult to distinguish), thus losing the ability to respond to other categories in the global model. Ultimately, during the server aggregation phase, after the offset local models of each client were fused, the global model experienced decision boundary degradation, and the average accuracy on the test set (CIFAR-10) dropped to 47.3%. This phenomenon is called client drift: the local model forgets global knowledge due to local data limitations (for example, client 1 cannot learn the bird characteristics in client 3, and client 2 cannot inherit the ship-related knowledge of client 4) (global knowledge is the understanding of each category of data. Because each client's local model will be given to the central server, the model is the understanding of the data. Therefore, the global model obtained by the central server aggregating local models has all the knowledge. However, when the global model is used to train the next round of clients, the client will forget its missing categories and minority categories. As a result, the client's model only remembers the data it has, but forgets the global knowledge), resulting in the deterioration of the federated learning effect.

[0106] Under the federated learning based on the CIFAR-10 dataset, this application solves the problem of global knowledge forgetting caused by the skewed label distribution of the client through the knowledge distillation mechanism. Taking a scenario with 10 clients as an example, after aggregating the knowledge of each client (such as the cat image features of client 1 and the car image features of client 2), the global model (teacher model) generates common feature patterns across clients (such as the texture commonality of cat images from different perspectives, and the correlation of edge features between cars and trucks). When the local client (student model) focuses on training its own dominant category (such as 68% of cat images of client 1), it forces the model to learn implicit knowledge across clients by comparing local predictions with the soft targets output by the global model (for example, cat images of client 1 trigger a probability response of 23% for birds and 17% for dogs in the global model). Specifically, when client 1 trains its local model, its cat images not only optimize their own classification weights but also match the global model's probability distribution for non-local dominant categories, such as birds and dogs, using the KL divergence loss. This allows the local feature extractor to capture cross-category common features (such as edge gradients and color contrast) related to bird wing textures and dog ear contours. Even though client 1 has never seen bird or ship data from other clients, its model retains a 36% bird recall rate and a 28% ship recognition rate through the distillation mechanism. This mechanism is similar to how students use a teacher's corrected set of wrong answers (cross-client knowledge provided by the global model). While repeatedly practicing their strengths (local dominant categories), they also strengthen their understanding of weaker knowledge points (categories scarce in other clients). Ultimately, this achieves balanced optimization of the client model on the CIFAR-10 dataset—maintaining a high local cat accuracy of 91.5% while increasing the global average precision from 47.3% to 62.9%, effectively suppressing feature space distortion caused by data skew.

[0107] In an exemplary embodiment, the federated learning model optimization method of the present application can also be used in the medical field; through the hyperspherical decoupling training (HUG) in this application, the classifier weights are forced to form an equiangular distribution (such as the uniform distribution of pneumonia subtype weights), and combined with negative label distillation, the cross-category probability generated by the global model (such as the CT value of mycoplasma pneumonia -600HU to -400HU features) is used as a knowledge carrier to drive the local model to focus on optimizing local data while retaining the ability to respond to missing categories (such as interstitial pneumonia in hospital D), ultimately solving the model degradation problem caused by heterogeneous data, and realizing collaborative modeling of cross-institutional medical features and improving disease diagnosis efficiency under privacy protection.

[0108] The beneficial effects of the federated learning model optimization method proposed in this application are mainly manifested in:

[0109] The accuracy and efficiency of the global model are significantly improved. By maximizing the inter-class distance through the minimum hypersphere energy loss function, the bias in classifier weights caused by data heterogeneity in traditional methods such as FedAvg is eliminated. The classifier weight vectors are uniformly distributed on the hypersphere, significantly improving the rationality of the decision boundary. The non-true category probability distribution generated by the global model is used as a soft target, allowing the local model to retain global knowledge in the feature space. The negative class gradient direction provided by the teacher model corrects the local optimization path of the client model. Strong robustness to extreme data heterogeneity is achieved through a decoupled classifier-feature representation architecture, which prevents the classifier layer from being affected by the client's local feature distribution.

[0110] Based on the same inventive concept, the present application also provides a federated learning model optimization system. The implementation solution provided by this system is similar to the implementation solution described in the above method. Therefore, the specific limitations of one or more federated learning model optimization system embodiments provided below can be found in the above-mentioned limitations of the federated learning model optimization method and will not be repeated here.

[0111] In an exemplary embodiment, a federated learning model optimization system is provided, including:

[0112] Construction module, used to construct sample datasets.

[0113] The initialization module is used to initialize the federated learning model; the federated learning model includes a global model and multiple local models; both the global model and the local model include a feature extractor and a classifier.

[0114] The optimization module is used to optimize the federated learning model based on the sample data set using the hypersphere decoupling training method and the negative label distillation method to obtain the optimized federated learning model.

[0115] In an exemplary embodiment, an image recognition method is provided, comprising:

[0116] Get the image to be recognized.

[0117] The image to be recognized is input into the global model of the optimized federated learning model described in the above embodiment to obtain the image recognition result.

[0118] In an exemplary embodiment, an image recognition system is provided, comprising:

[0119] The image acquisition module is used to acquire the image to be identified.

[0120] The image recognition module is used to input the image to be recognized into the global model of the federated learning model described in the above embodiment to obtain the image recognition result.

[0121] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0122] This document uses specific examples to illustrate the principles and implementation methods of this application. The description of the above examples is only intended to help understand the method and core concept of this application. At the same time, for those skilled in the art, based on the concept of this application, there may be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting this application.

Claims

1. A method for optimizing a federated learning model, characterized in that: include: Construct a sample dataset; Initialize the federated learning model; The federated learning model includes a global model and multiple local models; The global model and the local model both include a feature extractor and a classifier; Based on the sample dataset, the hypersphere decoupling training method and the negative label distillation method are used to optimize the federated learning model to obtain an optimized federated learning model.

2. The method for optimizing a federated learning model according to claim 1, wherein: Based on the sample dataset, the federated learning model is optimized using a hypersphere decoupling training method and a negative label distillation method to obtain an optimized federated learning model, specifically including: Based on the sample data set, a hypersphere decoupling training method is used to calculate the loss function in the local model training process to obtain a hypersphere consistency loss function; Based on the sample data set, a negative label distillation method is used to calculate the loss function in the local model training process to obtain a negative label distillation loss function; Determine the total loss function of the local model based on the hypersphere consistency loss function and the distillation loss function; The federated learning model is optimized based on the total loss function to obtain an optimized federated learning model.

3. The method for optimizing a federated learning model according to claim 2, wherein: The sample data set includes: sample data and corresponding category labels; Based on the sample data set, the hypersphere decoupling training method is used to calculate the loss function in the local model training process to obtain the hypersphere consistency loss function, which specifically includes: Inputting the sample data into a feature extractor of a local model to obtain sample data features; Inputting the sample data features into the classifier of the local model to obtain the sample category result; Based on the sample data features and the sample classification results, a hypersphere consistency loss function is constructed.

4. The method for optimizing a federated learning model according to claim 3, wherein: Based on the sample dataset, the negative label distillation method is used to calculate the loss function in the local model training process to obtain the negative label distillation loss function, which specifically includes: Based on the parameters of the global model, a teacher model is constructed; based on the parameters of the local model, a student model is constructed; the teacher model and the student model both include a feature extractor and a classifier; Inputting the sample data into the feature extractor of the teacher model to obtain teacher sample data features; Inputting the teacher sample data features into the classifier of the teacher model to obtain the teacher sample category result; Determine a teacher model soft label based on the teacher sample data characteristics and the teacher sample classification result; the teacher model soft label includes negative label information; Inputting the sample data into the feature extractor of the student model to obtain student sample data features; Inputting the student sample data features into the classifier of the student model to obtain the student sample category result; Determining a student model soft label based on the student sample data characteristics and the student sample classification results; A negative label distillation loss function is determined based on the teacher model soft labels and the student model soft labels.

5. The method for optimizing a federated learning model according to claim 3, wherein: The expression of the hypersphere consistency loss function is: Among them, L HUG is the hypersphere consistency loss function; α is the inter-class separability weight; is the classifier weight φ for category label c c The normalized form of is the classifier weight φ for the category label c' c The normalized form of ; β is the compactness weight within the class; is the sample data feature z obtained by the feature extractor for sample data i i The normalized form of A c is the number of sample data i belonging to category label c.

6. The method for optimizing a federated learning model according to claim 4, wherein: The expression of the negative label distillation loss function is: in Among them, L HKD (·) is the negative label distillation loss function; C is the number of class labels c; Soft labels for the teacher model; is the soft label of the student model; c is the category label index; x is the xth sample data; y is the label of the xth sample data; is the negative label of the x-th sample data; z g,x is the teacher sample data feature; φ g,c is the weight of the classifier in the teacher model; τ is the temperature coefficient; c' is the category index different from the category label index c; is the normalized form of the student sample data characteristics; φ c is the weight of the classifier in the student model.

7. The method for optimizing a federated learning model according to claim 4, wherein: The total loss function of the local model is expressed as: Among them, L H is the total loss function of the local model; L HUG is the hypersphere consistency loss function; μ is the distillation intensity coefficient; τ is the temperature coefficient; L HKD (·) is the negative label distillation loss function; Soft label for student model; Soft labels for the teacher model.

8. A federated learning model optimization system, characterized in that: include: Construction module, used to construct sample data sets; Initialization module, used to initialize the federated learning model; The federated learning model includes a global model and multiple local models; The global model and the local model both include a feature extractor and a classifier; An optimization module is used to optimize the federated learning model based on the sample data set by using a hypersphere decoupling training method and a negative label distillation method to obtain an optimized federated learning model.

9. An image recognition method, characterized in that: The image recognition method comprises: Obtain the image to be recognized; The image to be recognized is input into the global model of the optimized federated learning model described in any one of claims 1 to 7 to obtain an image recognition result.

10. An image recognition system, characterized in that: The image recognition system comprises: An image acquisition module, used to acquire an image to be identified; An image recognition module is used to input the image to be recognized into the global model of the federated learning model described in any one of claims 1 to 7 to obtain an image recognition result.